Skip to main content

Runtime control layer for stabilizing AI systems and improving behavior without retraining

Project description

Aegis

Turn unstable AI into reliable systems.

Aegis is a runtime control layer that predicts instability and returns control plans to stabilize AI behavior — no retraining or prompt rewrites required.

pip install scelabs-aegis

🚀 10-second integration

from aegis import AegisClient
import openai

client = AegisClient()

plan = client.auto(
    system_type="multi_agent",
    base_prompt="You are a support system.",
    symptoms=["agents_disagree"],
    severity="medium",
)

response = openai.chat.completions.create(
    **plan.for_openai(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are a support system."},
            {"role": "user", "content": "Handle this case."}
        ],
    )
)

That’s it.


🧠 What just happened

Aegis analyzed your system and returned a control plan:

  • adjusted generation behavior (temperature, top_p)
  • stabilized prompt behavior
  • improved coordination
  • reduced variability

You didn’t rewrite anything.


🔌 Works everywhere

Aegis plugs into any AI system.

OpenAI

plan.for_openai(...)

LangChain

cfg = plan.for_langchain(messages=messages)

LangGraph

state = plan.apply_to_state(state)

HuggingFace (local / small models)

cfg = plan.for_huggingface(prompt="Handle this clearly")

⚡ Example: Real Workflow Impact

This demo runs the same multi-agent workflow twice:

  • once as baseline
  • once with Aegis applied at runtime

Both reach the same correct final answers.

The difference is how efficiently they get there.

📊 Results

Metric Baseline Aegis
Final Accuracy 1.0 1.0
Lane Accuracy 0.83 1.0
Efficiency 0.82 1.0
LLM Calls 44 32
Verifier Calls 11 8
Replans 5 2
Cost $0.00583 $0.003946

🔥 What changed

  • Same outcomes
  • Fewer steps
  • Fewer retries
  • Better routing
  • Lower cost

🧠 Takeaway

Aegis does not change what your system decides.

It changes how your system behaves while deciding.

Same system. Better execution.



🧠 Local / Smaller Model Example

Aegis makes smaller or local models usable in real systems.

from transformers import pipeline
from aegis import AegisClient

client = AegisClient()
pipe = pipeline("text-generation", model="gpt2")

plan = client.auto(
    system_type="single_agent",
    base_prompt="Provide clear reasoning.",
    symptoms=["inconsistent_outputs"],
    severity="medium",
)

cfg = plan.for_huggingface(
    prompt="Explain this clearly and step by step."
)

output = pipe(cfg["prompt"], **cfg["model_kwargs"])
print(output)

Result:

  • clearer reasoning
  • more consistent outputs
  • fewer retries

🧠 Advanced usage (Plan API)

plan = client.plan(
    system_type="single_agent",
    base_prompt="You are a support assistant.",
    symptoms=["inconsistent_outputs"],
    severity="medium",
)

print(plan.prediction)
print(plan.controls)

🛠 Tool Control Example

Ensure your AI uses tools correctly.

plan = client.auto(
    system_type="multi_agent",
    base_prompt="You must use tools correctly.",
    symptoms=["tool_misuse"],
    severity="medium",
)

print(plan.tool_config())

Result:

  • correct tool usage
  • fewer failures
  • higher task success

💡 What Aegis does

Aegis analyzes instability and returns a control plan that adjusts:

  • prompts
  • generation behavior
  • coordination rules
  • validation and retry behavior
  • tool usage

Result:

  • more consistent outputs
  • fewer retries
  • better decision-making
  • more reliable systems

🔥 Why Aegis

  • Works instantly with your existing setup
  • No retraining required
  • Reduces retries and debugging
  • Improves edge-case handling
  • Makes AI systems production-ready

💰 Cost & Efficiency

Aegis improves first-pass success:

  • fewer retries
  • lower API cost
  • more predictable behavior

In many cases:

Aegis pays for itself by reducing retries alone.


🧠 Use Cases

Customer Support

Handle edge cases consistently without breaking policy.

Tool Calling / Agents

Ensure correct tool usage and execution.

Structured Output

Reduce invalid responses and retry loops.

Multi-Agent Systems

Prevent disagreement and coordination drift.

Local / Smaller Models

Make them reliable and usable.


📦 Installation

pip install scelabs-aegis

After installing, request an API key through the onboarding endpoint and set AEGIS_API_KEY before making calls.


🔑 Onboarding

1. Request an API key

curl -X POST "$AEGIS_URL/v1/onboard" \
  -H "Content-Type: application/json" \
  -d '{"account_name":"My Team","email":"you@example.com"}'

2. Set your API key

export AEGIS_API_KEY=your_api_key

Optional:

export AEGIS_URL=https://your-aegis-url

3. You're ready

from aegis import AegisClient
import os

client = AegisClient(
    api_key=os.environ["AEGIS_API_KEY"],
    base_url=os.getenv("AEGIS_URL"),
)

🧪 Examples

python examples/openai_basic.py
python examples/langchain_basic.py
python examples/langgraph_basic.py
python examples/huggingface_basic.py

🚀 Full Demo (Multi-Agent Workflow)

https://github.com/SCELabs/aegis-agent-workflow-demo


🧩 Design

Aegis is:

  • thin
  • backend-driven
  • runtime-focused
  • production-oriented

It does NOT:

  • replace your model
  • require retraining
  • expose internal engine complexity

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scelabs_aegis-0.3.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scelabs_aegis-0.3.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file scelabs_aegis-0.3.0.tar.gz.

File metadata

  • Download URL: scelabs_aegis-0.3.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for scelabs_aegis-0.3.0.tar.gz
Algorithm Hash digest
SHA256 386ce06562e86f8aaee87a64196b855b179e21a5c78277b72e173835fc23045f
MD5 ff68788f925841bc42b9e0552bf36e12
BLAKE2b-256 332e3a9203c2627f2526093320bd685bb71c5f3f15fb21d7f9339564e5f0d08d

See more details on using hashes here.

File details

Details for the file scelabs_aegis-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: scelabs_aegis-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for scelabs_aegis-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1f34ade1cf3cd13c60381ef7805a72ec2f8639cff28e3d1ffb81668012cc50b
MD5 96bff18364661fb8632f124fc928aa2f
BLAKE2b-256 48ad87b6f08591589ee4dcf34d485d17596234c23786e767173a3cadd0432702

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page