Building Defense-in-Depth for Autonomous Agents
Layered runtime controls for secure multi-agent AI: identity, egress, validation, approvals, observability and policy enforcement with Aegis.

Defense-in-Depth for Autonomous Agents
As organizations adopt multi-agent and agentic AI workflows, the attack surface changes — and so must our defenses. Single-layer controls (IP allowlists, perimeter firewalls, or coarse IAM policies) fail when agents chain, coerce, or leak data through parameter-level attacks. This post lays out a practical, operational defense-in-depth approach for agentic systems and shows how a runtime policy plane — Aegis — composes with identity, transport, DLP and human-in-the-loop controls to stop multi-step attacks.
Key data points and why this matters
- Agentic AI adoption is accelerating: industry research forecasts dramatic uptake in 2025–2028 and warns that organizations must build trust and governance into deployments. (Capgemini)
- Many enterprises piloting agentic workflows list security and compliance as a top barrier; independent reports show a large share of leaders are cautious about scaling agentic projects without governance. (Gartner)
(These trends make a layered runtime control plane an operational necessity.)

Why layering? The philosophy
Defense-in-depth for agents is not a checklist; it’s a layered contract of controls that each stop different classes of failures and attack steps.
Primary layers (logical order of enforcement)
- Identity & short-lived tokens — who is the agent, and is its token fresh and scoped?
- Transport & egress policy — can the agent reach the destination at all (mTLS, proxy allowlist)?
- Runtime policy & parameter validation — what action is being requested and do parameters conform to safe schemas?
- DLP / sanitization — are payloads containing PII or secrets redacted?
- Human approvals & escalation — is this action high risk and does it need explicit human sign-off?
- Observability & audit — every decision and override is traced and auditable for SOC/compliance.
Think of these as overlapping nets: an attacker or misbehaving agent that slips through one may be stopped by the next. This pattern also supports progressive enforcement: start in shadow mode, tune rules, then enforce.

Control examples For Mapping Policies to Each Layer
Below is a compact, operational table you can use as a template in policy reviews.
Layer | Control | Example policy snippet |
Identity | Short-lived JWT with agent_id & scope | allow if token.agent == "finance-agent" and token.exp > now |
Egress | Proxy allowlist & domain regex | deny if dest not in ["api.stripe.com","internal-ehr.myorg"] |
Param validation | Schema/range checks | deny if request.amount > policy.max_amount |
DLP | Regex redact SSN/PII fields | sanitize payload.ssn -> "[REDACTED]" |
Approval | Approval_needed + Slack workflow | approval_needed if amount > 5000 |
Observability | OTel span & signed audit | emit span {agent,tool,decision,policy_version} |
(Policy-as-code examples above are intentionally concise; production policies should include version, owner, and test vectors.)
Aegis as the runtime policy plane

Aegis is designed to be the central, composable runtime policy and observability fabric for multi-agent systems. Its role in a layered model is to evaluate every agent→tool call in real time, enforce per-field rules, and generate auditable traces that security and compliance teams can rely on. Core Aegis responsibilities:
- Agent identity & token service: short-lived JWTs with tenant/agent claims and replay protection, issued by the control plane and verifiable by sidecars.
- Data plane enforcement: an Envoy sidecar / forward proxy intercepts outbound calls; the external authorisation server evaluates OPA bundles and returns allow/deny/sanitize/approval_needed decisions. This approach keeps P99 latency targets ≤20ms while enabling deep inspection.
- Parameter inspection & DLP: deterministic regex-based redaction and field-level sanitization — applied before an outbound call leaves your environment.
- Human approval workflows: for high-risk actions Aegis issues an approval request (Slack/MS Teams). On approval it mints a one-time override token; otherwise the action remains blocked.
- Observability & audit: OpenTelemetry spans and signed logs, including policy version and decision reason, are emitted to SOC pipelines for forensic and compliance use.
Aegis is architected to be orchestrator-agnostic (LangChain, LangGraph, AgentKit, etc.) via SDK middleware and sidecars — enabling rapid integration without major rewrites. Use Aegis in shadow mode first to collect would-deny telemetry then progressively tighten enforcement (recommended rollout below).
Example attack chain — and how layered controls stop it
Story: A planner agent attempts to coerce a finance agent into making an unauthorized payment by chaining prompts and manipulating parent_agent headers.
Attack steps vs layered mapping:
- Planner crafts malicious instruction → Identity fails: short token scope prevents planner from impersonating finance.
- Planner proxies via finance agent to payments API → Egress blocks: proxy allowlist only permits known payment domains from approved services.
- Finance agent includes a high amount in parameters → Runtime policy rejects on amount > threshold.
- Planner tries to disguise PII in free-text fields → DLP redacts before send.
- High-risk edge case triggers Approval workflow if thresholds are exceeded; without approved override the call fails.
This layered stopping of each hop is what converts single-point controls into resilient coverage.

Operational KPIs and a comparison table
Track these metrics to measure coverage and efficacy.
Metric | Target (MVP) | Why it matters |
Policy coverage (critical connectors) | ≥ 80% | Ensures policies protect main risk paths. |
Decision latency (P99) | ≤ 20 ms | Keeps agent workflows interactive. |
Blocked vs detected attack steps | Increasing blocked ratio | Shows layered effectiveness. |
Approval throughput & avg time | < 5 min for critical approvals | Balances security & velocity. |
Testing, red-teaming & rollout
Testing is non-negotiable. Recommended plan:
- Shadow mode pilot (dev/staging): run rules in observe-only mode for 7–14 days; collect would-deny events.
- Red team chaining exercises: simulate multi-agent coercion, parameter injection, and egress exfiltration. Tune regexes and schema checks.
- Progressive enforcement: start enforcement on identity + egress, then enable param validation, then approvals. Fail-closed for writes; configurable fail-open for low-risk reads.
Rollout checklist (operational artifact)
- Agent registry populated; tokens issuing correctly.
- Egress allowlist scoped and tested.
- Dry-run results show low false positives.
- Approval workflows integrated with Slack/Teams channels and on-call rotas.
Compliance mapping & common misconfigurations
Map layers to control objectives (e.g., least privilege, separation of duties, tamper-evident logging). One common misconfiguration: trusting parent_agent headers without cryptographic signatures — always validate chain headers with signatures or token binding.

Table 1 — Failure mode and recommended fail strategy
Action type | Fail closed? | Rationale |
Payment writes | Yes | Prevents financial loss. |
PII reads (sensitive) | Yes | Compliance critical. |
Non-sensitive reads | Optional (fail open) | Preserve UX for low risk actions. |
Billing API calls | Depends (budget exhausted -> deny) | Protects FinOps budgets. |
Table 2 — Example rollout phases
Phase | Scope | Mode |
Phase 0 | Identity + Egress | Enforce |
Phase 1 | Param validation + DLP | Shadow → enforce |
Phase 2 | Approvals + observability | Enforce |
Frequently Asked Questions
- What should fail closed versus fail open? — Writes (payments, DB writes, file writes) should fail closed; low-risk reads can be configured fail-open during early rollout.
- How do I avoid approval overload? — Add thresholds, aggregate similar requests, use budgets and rate limits to reduce unnecessary approvals.
- Can Aegis integrate with my orchestrator? — Yes: sidecar/middleware patterns and SDKs support LangChain/LangGraph/AgentKit integrations.
- How do I prove compliance? — Aegis emits signed OTel spans and tamper-evident policy versions to retain audit trails for SOC and regulators.
- What’s the recommended rollout timeline? — Start with identity+egress, progress to param validation/DLP, then approvals — pilot in 2–4 weeks depending on connector complexity.
Next steps & recommended CTA
If you’re running agentic workflows in staging or production, run a rapid risk mapping: identify your top 10 connectors, draft policy schemas, and run a 7-day shadow mode with an enforcement plane.