MAAManaged Agents Anywhere
Docs›Reference

MAA architecture (v1)

MAA, Managed Agents Anywhere, is one codebase sold as two solutions.

UNITED KINGDOM (LONDON) · eu-west-2 · data stays in the regionMAA coreYour appofficial SDK,base URL changedMAA API /v1Managed AgentsAPI shapesAgent loopcalls the model,runs the toolsSandboxone per sessionVault + egresssecrets neverenter the sandboxKeys + certificatesa key per session,signed deletionClaude on Bedrockin-Region inferencecallmodeloutputevents
Blue arrows are requests, gold arrows are results. Everything inside the dashed line runs in eu-west-2. Built and checked locally with a mock model; not yet deployed to AWS.
MAA Cloud MAA Managed
Who uses it The client's developers, self-serve Mat and associates, with the client
How it's sold Prepaid credit (£5 per session-hour + tokens at cost +20%) or dedicated day/week/month/year Diagnostic £5k, Sprint £25k, Co-build £20k + licence, Run £5k a month
Where it lives src/billing/cloud.ts, /portal/billing, /v1/billing, /v1/invoices src/managed/engagements.ts, /admin, /portal/engagements, /v1/engagements
Shared core Everything else: API, runner, sandboxes, vaults, memory, certificates Same

Request path

client (Anthropic SDK, baseURL = MAA) ─▶ ALB ─▶ API instance (Hono)
                                              ├─ /v1/*   Managed Agents-compatible API (+ region, residency, certificates)
                                              ├─ /portal client portal · /admin operator console
                                              ├─ runner: agent loop ─▶ Bedrock in-Region (London: bedrock-runtime)
                                              │                    ─▶ sandbox (Fargate task per session, port 8080)
                                              └─ egress proxy :3128 ◀─ sandbox HTTP(S) (host policy, vault substitution)
Postgres (RDS): objects, encrypted events, leases, ledger, invoices, engagements, certificates, transparency log
S3: encrypted blobs (transcripts, outputs, files)    KMS: data keys (crypto-shred) + signing key (certificates)

Core modules

Module Job
src/api/* Agents, environments, sessions, events (SSE), vaults (env, bearer, MCP OAuth), memory, deployments, files, webhooks, account
src/runtime/runner.ts Agent loop, tool execution, outcomes grading, multi-agent threads, transcript, failover restore
src/runtime/leases.ts Database leases: session ownership across instances; once-per-tick jobs; transparency-log writer lock
src/runtime/webhooks.ts Signed, retried, metadata-only webhook deliveries
src/egress/proxy.ts Per-session proxy grants (in the database), host policy, secret substitution and masking
src/runtime/deletion.ts, certificates.ts Delete everything (threads too), shred keys, sign and log the certificate
src/billing/* Hourly orders (first client flow), Cloud credit and plans, metering, VAT invoices
src/managed/engagements.ts Engagements, milestones, time log, workspace provisioning, economics
src/worker.ts Background loops: deployments, webhooks, lease renewal and adoption, housekeeping
infra/ CDK: one stack per region (MaaUk, MaaEuDublin, …)

Multi-instance model

  1. A session's events are stored first (processed_at null), then the instance holding session:<id> handles them. POST /events on any instance tries to take the lease; if another live instance holds it, that instance's poller picks the events up.
  2. Leases last 30 s and are renewed every 10 s. Sessions with unprocessed events and no live lease are adopted by any instance: transcript reloaded from S3, sandbox reattached from its sealed connection record, egress grant re-registered with the same token, vault placeholders re-derived (they're deterministic per session).
  3. Jobs take job:* leases per tick; certificate issuing takes lock:transparency_log so the hash chain never forks.

Data residency and deletion

Unchanged from the MVP and extended to threads: every session (and thread) has its own data key; deletion removes events, blobs, sandbox and API objects, destroys the keys and issues one signed certificate listing what went (including each thread) and what stayed (billing metadata, the certificate itself). Webhooks never carry content, so nothing from a session leaves the region through them.

Testing

  • npm test: unit tests (cron, globbing, leases, invoices and VAT, webhook signatures, canonical JSON, permission policy, egress proxy end to end on localhost).
  • npm run e2e: two scripts with the official SDK and a mock model. e2e-first-client.ts (22 checks) is the MVP flow; e2e-v1.ts (40 checks) covers webhooks, multi-agent, MCP OAuth, leases, Cloud billing and Managed engagements.