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

🔑 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"),
)

🧪 Demos

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.2.0.tar.gz (11.9 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.2.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scelabs_aegis-0.2.0.tar.gz
  • Upload date:
  • Size: 11.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 e6e50e1112c12115e3ab93b3e3c61741316c55a2b6cd95bb9bce075d57861716
MD5 cbad6e3193b05d4b12721234da97adf8
BLAKE2b-256 4fca13421d10f9c1ac9da9dd677405358a590b38846e28653625c3b17de053f2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scelabs_aegis-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e449dcbd0a5179e734238ba11fdb1f328db1adaabe93b1ba2d883f40420e56a
MD5 16db2107c80330781c604d5ab1f98d17
BLAKE2b-256 83a2a8a92263ed37372f644543a7cfc521a6aa3f507244c2eeb9bf6e326e403e

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