Autonomous Engineering & Governance Intelligence System.
"AI proposes and reasons. Deterministic software controls and verifies."
AEGIS utilizes a highly modular FastAPI app factory. On startup, it initializes the PostgreSQL async engine, the durable EventBus, the ResourceGovernor (for concurrency limits), and wires the MCP Gateway.
def create_app(settings: Settings | None = None) -> FastAPI:
app = FastAPI(title="AEGIS", version="0.1.0")
# Instantiate deterministic concurrency governor
governor = ResourceGovernor(
max_ai_calls=settings.max_concurrent_ai_calls,
max_tool_calls=settings.max_concurrent_tool_calls
)
app.state.governor = governor
# Attach durable PostgreSQL EventBus
engine = get_async_engine(settings.database.database_url)
app.state.event_bus = EventBus(get_async_session_factory(engine))
return app
The System Overview dashboard showing aggregate risk and real-time telemetry.
OpenAPI documentation generated by FastAPI.
The REST API is secured via JWT Bearer tokens. Passwords are hashed with bcrypt. Routers are cleanly mounted by domain (e.g., /incidents, /missions, /policies).
async def login(payload: LoginRequest, session: AsyncSession = Depends(get_db_session)):
repo = UserRepository(session)
user = await repo.get_by_email(payload.email)
if not verify_password(payload.password, user.hashed_password):
raise HTTPException(status_code=401, detail="Invalid credentials")
token = create_access_token(subject=user.email)
return TokenOut(access_token=token)
AEGIS avoids WebSocket complexity. It uses authenticated Server-Sent Events (SSE) to stream live mission updates and tool calls to the React frontend.
@router.get("/stream")
async def stream_updates(request: Request, current_user: User):
event_bus = request.app.state.event_bus
q = event_bus.attach_stream()
return StreamingResponse(
event_generator(request, q),
media_type="text/event-stream"
)
The Audit Log page actively consuming the SSE stream.
AEGIS utilizes an Agent-to-Agent (A2A) architecture. Every agent exposes a discoverable capability card. However, agents do not use OAuth or API keys; their identities are strictly enforced internally via deterministic boundaries and the ToolRegistry.
The Agent Roster showing real-time A2A capability cards and strict "CANNOT" boundaries.
Ingests telemetry, detects anomalies.
CANNOT: write to DB or execute tools.
Forms hypotheses, collects evidence.
CANNOT: write files or alter infra state.
Generates patches in isolated sandboxes.
CANNOT: merge without Verifier sign-off.
Runs independent regression suites.
CANNOT: modify the patch or trust Coder's claims.
Intercepts tool requests, calculates risk.
CANNOT: generate code or execute remediation.
Orchestrates the mission state machine.
CANNOT: execute low-level infra tools directly.
Probes boundaries via prompt injection.
CANNOT: bypass the actual policy engine.
Retrieves source-backed documentation.
CANNOT: modify system state or execute code.
Every tool invocation is persisted in the tool_calls table. This provides a cryptographic audit trail of every argument passed and every result returned, completely decoupled from the LLM context window.
class ToolCall(UUIDPrimaryKeyMixin, TimestampMixin, Base):
__tablename__ = "tool_calls"
tool_name: Mapped[str] = mapped_column(String(255))
agent_id: Mapped[uuid.UUID | None]
mission_id: Mapped[uuid.UUID | None]
state: Mapped[ToolCallState]
arguments: Mapped[dict | None] = mapped_column(JSONB)
result: Mapped[dict | None] = mapped_column(JSONB)
The Tool Calls archive showing real git_status invocations.
Every action is assigned a dynamic Risk Score (0-100) based on blast radius, reversibility, and environment sensitivity. Actions categorized as DESTRUCTIVE or DEPLOY are forced to a CRITICAL score and blocked.
# Deterministic policy enforcement. LLMs cannot bypass this gate.
if action.category in (ActionCategory.DESTRUCTIVE, ActionCategory.DEPLOY):
risk_score = max(risk_score, RiskLevel.CRITICAL)
if risk_score >= RiskLevel.HIGH:
return PolicyDecision(
approved=False,
requires_human_approval=True
)
The Policy Engine dashboard displaying risk bands and tool categories.
The Replay interface showing an immutable execution snapshot.
Missions are tightly controlled state machines enforced in application code. The LLM cannot hallucinate a state transition; the Incident Commander enforces the lifecycle programmatically.
async def plan_remediation(self, mission, mission_repo):
# Deterministically transition to REMEDIATION_PLANNED
return await mission_repo.update_state(
mission.id, MissionState.REMEDIATION_PLANNED
)
The Mission Archive provides a complete historical view of all incidents. Every mission is tracked from CREATED to RESOLVED or FAILED, ensuring zero data loss and full auditability.
Agents never touch the infrastructure directly. They interact through an MCP Gateway that registers strict tool domains: Filesystem, Git, Docker, Database, and Testing. Tools are registered with typed Pydantic schemas.
class GitStatusArgs(BaseModel):
repo_path: str = Field(default=".")
class GitStatusTool:
name = "git_status"
parameters = GitStatusArgs.model_json_schema()
async def execute(self, arguments: dict, guard: PolicyGuard):
params = GitStatusArgs(**arguments)
guard.assert_allowed(self.name)
return await run_git_status(params.repo_path)
The core operational entities (Mission, Incident, Approval, ToolCall, Agent) are stored as typed relational entities with UUID primary keys, timestamp mixins, and JSONB artifact columns for flexible investigation/remediation payloads.
class Incident(TimestampMixin, UUIDPrimaryKeyMixin, Base):
__tablename__ = "incidents"
title: Mapped[str] = mapped_column(String(255))
severity: Mapped[IncidentSeverity]
status: Mapped[IncidentStatus]
investigation: Mapped[dict | None] = mapped_column(JSONB)
remediation: Mapped[dict | None] = mapped_column(JSONB)
AEGIS implements a deterministic, observable memory system. Retrieval uses keyword-overlap relevance (not black-box embeddings). Every result exposes the record ID, type, relevance, source, and reason for retrieval.
class MemoryRecord:
id: uuid.UUID
type: MemoryType
content: str
source: str
timestamp: datetime
quarantined: bool = False # poisoned memories excluded
Independent verification suite showing passed checks.
AEGIS maintains strict system health guarantees. The frontend consumes a dedicated /health/ready endpoint which checks DB connection pools, LLM provider status, and Agent readiness before serving traffic.
The Chaos Lab allows engineers to inject synthetic faults (DB exhaustion, memory leaks, container crash loops) into a shadow environment. AEGIS must detect, investigate, and remediate autonomously without human intervention.
An evaluation framework that measures autonomous performance using deterministic ground-truth metrics. It drives the same agents used in production.
| Root cause selected | 100% |
| Security review passed | 100% |
| Independent verification | 100% |
| Unsafe actions | 0 |
| Mean pipeline duration | ~0.57 ms |
Detailed view of a critical incident, showing the investigation hypotheses and remediation plan.
Actions requiring human authorization. Pending patches and destructive commands are held here.
Complete timeline of state changes and tool calls for auditability.
API liveliness, DB readiness, and Tool Registry status.