Skip to main content

C-14 Agent Kill Switch

Brick C: Agents, autonomy, execution. French version: C-14-agent-kill-switch

1. Role and responsibilities​

Emergency stop of an agent: blocks new runs, cancels active runs, revokes credential leases.

  • Set the agent to killed
  • Cancel signal to all active workflows
  • Revoke OpenBao leases

2. Position in the architecture and interactions​

  • Callers: security_officer, tenant_admin, incidents (POST /v1/incidents/{id}/actions).
  • Execution path: Synchronous for blocking, asynchronous for propagation.
  • Every interaction goes through the Control Plane API v1 (/v1) behind the API Gateway (D-14).

3. Open source component and developed part​

  • Open source: none (to develop)
  • Developed: Fully developed.
  • External integration through an adapter eai/integrations/<system>.py with an in-process fallback when the URL is not configured.

4. Data model​

Tables (schema eai, tenant_id RLS):

  • eai.agents (status)
  • eai.runs

Common columns: id uuid, tenant_id uuid NOT NULL, created_at, updated_at; RLS policy current_setting('app.tenant_id', true)::uuid.

5. Contract​

  • Applied contract: execution-contract
  • JSON Schema: contracts/v1/execution-contract.schema.json
  • Key fields: state=killed
  • Validation: POST /v1/contracts/{name}/validate; manifest apply: POST /v1/manifests/apply.

6. API endpoints​

  • POST /v1/agents/{id}/kill
  • POST /v1/agents/{id}/suspend
  • POST /v1/agents/{id}/resume

Request POST /v1/agents/{id}/kill:

{
"reason": "suspected exfiltration",
"incident_id": "inc_7"
}

Response:

{
"id": "agt_support",
"status": "killed",
"runs_cancelled": 3,
"leases_revoked": 2
}

7. SDK examples​

Python:

from enterprise_ai import EnterpriseAI

client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_xxx_secret")
client.agents.kill("agt_support", reason="incident inc_7")

TypeScript:

import { EnterpriseAI } from "@enterprise-ai/sdk";

const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY });
await client.agents.kill("agt_support", { reason: "incident inc_7" });

Java:

EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.build();
client.agents().kill("agt_support", Map.of("reason", "incident inc_7"));

Go:

c, _ := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")))
c.Agents.Kill(ctx, "agt_support", "incident inc_7")

8. Configuration​

  • Environment variables: EAI_DATABASE_URL
  • Helm values keys: controlPlane.config, controlPlane.secrets

9. Security controls​

  • security_officer or tenant_admin roles only
  • Resume after kill requires an approval
  • Every request carries the tenant resolved from the credential; PostgreSQL RLS
  • Every mutation and policy decision writes a hash-chained audit event

10. Observability​

  • Prometheus metrics: eai_agent_kills_total, eai_kill_propagation_seconds
  • Traces: OpenTelemetry spans with GenAI semantic conventions (gen_ai.operation.name, gen_ai.agent.id, gen_ai.tool.name), attributes eai.tenant_id, eai.run_id, traceparent propagation.
  • Audit actions: agent.kill, agent.suspend, agent.resume

11. FinOps units​

  • Stops consumption immediately.
  • Emitted as Usage Event (POST /v1/finops/usage) with tenant, project, agent and run.

12. Failure modes and resilience​

  • Kill is idempotent
  • Status checked at every loop step, not only by signal
  • Normalized errors (error envelope, message_i18n en/fr)

13. Standalone adoption (client of a client)​

  • enterprise_ai.agent.
  • SDK: enterprise_ai.agent (AgentsClient, RunsClient, SessionsClient)
  • Minimal deployment: Helm chart with controlPlane.enabled=true and PostgreSQL; disabled external components use their in-process fallback.

14. Acceptance tests​

  1. After kill, POST runs -> 409 agent_killed
  2. Active runs cancelled in under 10 s
  3. Cross-tenant access refused
  4. Error returned in fr with Accept-Language: fr