Markdown Editor

Agent Orchestration Platform System Design Template

Agent run platform design: durable step journal, resume, MCP tool broker with Tasks, A2A calls, human approvals, tenant budgets, evaluation hooks

Thiết kế hệ thốngĐầy đủMCP 2026-07-28 (Tasks extension); A2A 1.0.1; OWASP Agentic Top 10 2026designagentorchestrationplatform
Mở trong editorTải .md

Cách dùng: Use it when several teams need agents that survive crashes, wait for people and tools, and stay within budgets. Fill the run, step and parked-run estimates (3.2 to 3.4) and the tool classes by idempotency first. The main pitfall is retrying a side-effecting tool after a crash: journal every result before using it and send idempotency keys.

Xem trước

System Design: [Agent orchestration platform name]

Reference design for a multi-tenant platform that runs AI agents as durable, resumable executions. It covers durable execution of agent runs, checkpoints and resumption, tool calls over the Model Context Protocol (MCP, revision 2026-07-28, with the optional Tasks extension for long-running tools), agent-to-agent calls over the Agent2Agent (A2A) protocol 1.0.1, human-in-the-loop pauses, tenant isolation, budgets, observability and evaluation hooks. Agent behaviour design (roles, prompts, hand-offs) is covered by the Multi-Agent System Design Template (ai-data/multi-agent-system-design). It follows the 12-section structure of the System Design Document Template (system-design/system-design-document) and is pre-filled with a worked design to adapt. Replace every [bracketed] value and every row marked Example; all numbers are illustrative, not benchmarks.

Document control

FieldValue
Document ID[SDD-AOP-001]
System / feature[Agent orchestration platform]
Version[0.1]
Status[Draft / In review / Approved / Implemented / Superseded]
Owner[@owner]
Approvers / reviewers[@reviewer-1], [@reviewer-2]
Last updatedYYYY-MM-DD
Classification[Internal]
Protocol versions[MCP 2026-07-28 (Tasks extension: yes / no)], [A2A 1.0.1, protocol version 1.0]
Model access[Through the LLM gateway (system-design/design-llm-gateway) / direct]
Related[Multi-agent system design], [Agentic threat model], [Agent evaluation plan], [Human oversight design]

Approvals

RoleNameDecisionDate
Tech lead, agent platform[@name][Approved / Changes requested]YYYY-MM-DD
Staff / principal engineer[@name][Decision]YYYY-MM-DD
Security[@name][Decision]YYYY-MM-DD
SRE / operations[@name][Decision]YYYY-MM-DD
AI governance / risk[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First draft for design review
0.2YYYY-MM-DD[@name]Example: Switched long tool calls to the MCP Tasks extension
0.3YYYY-MM-DD[@name]Example: Added per-run budget in currency next to token and step limits
1.0YYYY-MM-DD[@name]Example: Approved

Contents

1. Overview

1.1 Problem statement

[Example: Twelve teams build agents with different frameworks, each running the agent loop inside a web request or a background job. When a pod restarts, running agents are lost and users must start again; three incidents last quarter came from agents that repeated a side-effecting tool call (a refund, a ticket update) after a retry. Approvals by people are implemented as polling loops that hold a worker for hours. Nobody can cap what one run may spend, and traces stop at the framework boundary, so a failing multi-agent task cannot be followed end to end.]

1.2 Proposed solution

[Example: A shared platform runs each agent run as a durable execution. The agent loop is split into steps (model call, tool call, sub-agent call, human wait); every step is written to an append-only run journal before its result is used. Workers are stateless: any worker can resume any run from its last checkpoint plus the journal. Tools are reached over MCP through a tool broker that injects scoped credentials and records each call with an idempotency key; long tools use the MCP Tasks extension so the run waits without holding a worker. Remote agents are called over A2A. Human approvals park the run with zero compute until a decision arrives. Every run has a budget in tokens, steps, wall-clock time and currency, enforced before each step.]

1.3 Decisions requested from reviewers

IDQuestionRecommended optionSection
Q-01Example: Durable execution model?Step journal with recorded results plus periodic state checkpoints7.2
Q-02Example: Build on a workflow engine or own the journal?Own journal on a durable store for v1; revisit an engine at 10x7.2, 10
Q-03Example: Long tool calls?MCP Tasks extension where the server supports it; platform-side async wrapper otherwise7.3
Q-04Example: Isolation unit?Tenant: separate queues, quotas, credentials and storage prefixes7.5
Q-05Example: What happens when a budget is exhausted mid-step?Finish the current step, then pause for approval or stop with a partial result7.5
[Q-nn][Question][Option][Section]

1.4 45-minute interview path

MinutesTopicWhat to show
0 to 5ScopeA run is a workflow; the platform runs agents, it does not design them
5 to 10RequirementsCore list (2.1), durability and isolation numbers (2.2), below the line (2.3)
10 to 15EstimatesActive runs, checkpoint write rate, parked runs (3.2 to 3.4) and their consequences
15 to 20APIStart, stream events, approve, cancel (4)
20 to 28High-level designDiagram (6) and the step sequence (7.1)
28 to 40One deep diveDurable execution and exactly-once side effects (7.2) is the strongest choice; budgets and isolation (7.5) for multi-tenant questions
40 to 45Wrap-upFailure modes (9.1) and what changes at 10x (10)

2. Requirements

2.1 Core functional requirements

IDRequirementPriority
FR-01Example: Start an agent run from a registered agent definition and an input; return a run ID immediatelyMust
FR-02Example: Stream run events (steps, partial outputs, status) to the caller and allow reconnection from the last eventMust
FR-03Example: Persist every step so a run resumes after a worker crash or deploy without repeating completed stepsMust
FR-04Example: Call tools on MCP servers registered per tenant, with per-run scoped credentialsMust
FR-05Example: Call remote agents over A2A and expose selected platform agents as A2A serversShould
FR-06Example: Pause a run for a human decision, with timeout and escalation, and resume on approval or rejectionMust
FR-07Example: Per-run and per-tenant budgets in tokens, steps, wall-clock time and currencyMust
FR-08Example: Cancel a run; cancellation reaches in-flight tools and sub-agentsMust
FR-09Example: Evaluation hooks: export run trajectories and attach graders online and offlineShould
FR-10Example: Replay a finished run from its journal for debugging, without side effectsShould
[FR-nn][Requirement][Must / Should / Could]

2.2 Non-functional requirements

IDQualityTargetMeasured as
NFR-01DurabilityExample: No completed step lost after it is acknowledgedChaos test: kill workers during runs
NFR-02Side-effect safetyExample: Zero duplicate executions of tools marked non-idempotentTool broker idempotency audit
NFR-03Resume timeExample: p95 at or below 5 s from worker loss to the run continuingChaos test timing
NFR-04Scheduling overheadExample: p95 at or below 100 ms between a step finishing and the next step startingSpan timing
NFR-05IsolationExample: One tenant at its limits raises other tenants' scheduling delay p95 by at most 20%Mixed-tenant load test
NFR-06Parked costExample: A run waiting for a person or a task holds no worker and no model capacityWorker metrics during waits
NFR-07AvailabilityExample: 99.9% for run start and event APIsSLO on API responses
[NFR-nn][Quality][Target][Measurement]

2.3 Below the line (out of scope)

  • [Example: Agent behaviour, roles and prompts (see Multi-Agent System Design Template (ai-data/multi-agent-system-design) and AI Agent Specification Template (ai-data/ai-agent-spec))]
  • [Example: Model serving and provider routing (see LLM Gateway System Design Template (system-design/design-llm-gateway))]
  • [Example: Running untrusted generated code (see Agent Code Execution Sandbox System Design Template (system-design/design-agent-sandbox-execution))]
  • [Example: Building MCP servers; the platform consumes them (see MCP Server Specification Template (ai-data/mcp-server-spec))]
  • [Example: End-user chat interface (see LLM Chat Assistant System Design Template (system-design/design-llm-chat-assistant))]
  • [Item deferred, with the release that will take it]

3. Capacity estimation

3.1 Assumptions

All values are Example planning inputs.

InputValueSource
Runs per day1.2 millionTenant forecasts
Peak-to-average ratio3Hourly pattern of pilot tenants
Steps per run (mean)15Pilot traces
Share of steps that are model calls60%Pilot traces
Mean active run duration, excluding waits4 minPilot traces
Checkpoint plus journal entry per step (mean)40 KBMessage deltas, tool results, metadata
Runs that pause for a human5%Pilot
Mean human wait2 hPilot
Tool calls that are long-running10%Tool inventory
Concurrent runs per worker200Load test (async I/O)
Mean model and tool cost per runUSD 0.04Gateway metering

3.2 Run and step rates

QuantityCalculationResultConsequence
Average runs per second1,200,000 / 86,400about 13.9
Peak runs per second13.9 x 3about 41.7Run start API is light; it only writes a run record and enqueues
Steps per day1,200,000 x 1518 million
Peak steps per second41.7 x 15about 625The scheduler dispatches about 625 steps per second at peak, so a queue per tenant class with batching is enough; no exotic scheduler
Model calls per day18 million x 0.610.8 millionThe platform is one large tenant of the LLM gateway and needs its own quota there
Peak model calls per second625 x 0.6375Concurrency limits per tenant protect the gateway quota

3.3 Active runs and workers

Little's law: active runs = arrival rate x active duration. Average: 13.9 x 240 s = about 3,340 active runs; peak: 41.7 x 240 s = about 10,000. At 200 concurrent runs per worker, peak needs 50 workers at full load, or 72 at a 70% utilisation target (50 / 0.7 = 71.4, rounded up). Consequence: workers must be asynchronous and stateless; a run is never pinned to a worker, so scaling and deploys move runs freely.

3.4 Parked runs

Runs pausing for a person: 1.2 million x 5% = 60,000 per day. With a mean wait of 2 hours, the number parked at any time is 60,000 x 2 / 24 = 5,000. Consequence: 5,000 waiting runs would hold 25 workers if they stayed in memory; parking must persist state and release the worker, and the wake-up must come from a durable timer or an approval event.

3.5 Journal storage

QuantityCalculationResultConsequence
Journal per day18 million x 40 KB720 GBStore deltas, not full state; large tool results go to object storage with a reference
Peak write rate625 x 40 KB per second25 MB/sPartition the journal by run ID; one partition per run keeps ordering simple
Hot retention, 30 days uncompacted720 GB x 3021.6 TBToo much for the hot store: compact finished runs to a final snapshot plus an archived journal after 7 days, which keeps it near 720 GB x 7, about 5 TB
Long-running tool tasks per day7.2 million tool calls x 10%720,000Prefer task status notifications; poll with backoff otherwise

3.6 Spend

1.2 million runs x USD 0.04 = USD 48,000 per day, about USD 1.44 million per 30 days. Consequence: a runaway loop that multiplies a run's cost by 100 is expensive within minutes, so budgets are checked before every step, not in a nightly report.

3.7 Summary

QuantityEstimateDesign consequence
Peak stepsabout 625 per secondSimple per-class queues with tenant fairness
Peak active runsabout 10,00072 stateless async workers
Parked runsabout 5,000 at any timeZero-compute parking with durable timers
Journal720 GB per dayDelta journal, compaction, object storage for large results
Spendabout USD 48,000 per dayPre-step budget enforcement

4. API design

4.1 Endpoints

Method and pathPurpose
POST /v1/runsStart a run; body names the agent, version, input and optional budget; Idempotency-Key header required
GET /v1/runs/{id}Run status, current step, budget used
GET /v1/runs/{id}/eventsServer-sent events stream; supports Last-Event-ID for resumption
POST /v1/runs/{id}/approvals/{approval_id}Approve, reject or edit a pending action
POST /v1/runs/{id}/cancelCooperative cancellation
POST /v1/runs/{id}/replayDebug replay from the journal with tools stubbed
GET /v1/runs/{id}/trajectoryExport steps for evaluation
POST /a2a/{agent}A2A endpoint for platform agents exposed to other systems

4.2 Run states

The platform maps its states to the A2A task states when a run is exposed over A2A: waiting_human maps to TASK_STATE_INPUT_REQUIRED, running and waiting_tool to TASK_STATE_WORKING, and the terminal states to TASK_STATE_COMPLETED, TASK_STATE_FAILED and TASK_STATE_CANCELED.

4.3 Errors

StatusProblem typeMeaning
400invalid-inputInput does not match the agent's input schema
403agent-not-allowedTenant may not run this agent or version
409run-not-waitingApproval sent to a run that is not waiting for it
429tenant-concurrency-exceededToo many active runs for the tenant
402budget-exhaustedTenant budget exhausted; runs cannot start

Errors use RFC 9457 problem details. A repeated POST /v1/runs with the same Idempotency-Key returns the existing run instead of starting a second one.

5. Data model

5.1 Entities

The run journal is the source of truth; the run record is a projection that can be rebuilt from it.

5.2 Access patterns

IDQueryKey or index that serves itPartition key and rationale
AP-01 (Example)Load a run to resume itLatest CHECKPOINT by run_id, then JOURNAL_ENTRY where seq > at_seqrun_id: all of one run's entries in one partition, ordered by seq
AP-02 (Example)Append a stepJOURNAL_ENTRY (run_id, seq) with conditional write on seqConditional write gives one writer per run (fencing)
AP-03 (Example)Has this tool call already run?TOOL_CALL by idempotency_keyKey derived from run ID and step number, so a replayed step finds it
AP-04 (Example)List a tenant's active runsSecondary index (tenant_id, status)Tenant-scoped dashboards and concurrency checks
AP-05 (Example)Pending approvals for a reviewer groupIndex (group, decision = pending, expires_at)Reviewer inbox sorted by deadline
AP-06 (Example)Wake runs whose timer firedTimer index by fire_at bucket (per minute)Bucketing avoids a hot single index
AP-07 (Example)Export a trajectoryJournal by run_id, joined to traces by trace IDRead-only; served from the archive for old runs

5.3 Storage choices

DataStoreNotes
Runs, approvals, tool registrationsRelational or document databaseStrong consistency for status changes
Journal and checkpointsPartitioned key-value or log store with conditional writesOrdered per run
Large tool results and attachmentsObject storage, per-tenant prefix and keyJournal holds a reference and hash
TimersDurable timer service or indexed tableWakes parked runs
TracesTracing backendLinked by trace ID in each journal entry

6. High-level design

ComponentResponsibilityScales by
Run APIStart, status, events, approvals, cancelHorizontally
SchedulerTenant-fair queues, concurrency limits, wake-upsPartitioned by tenant hash
WorkersExecute one step at a time for many runs; write the journalActive runs (3.3)
Tool brokerMCP client, credential injection, idempotency, Tasks pollingTool calls per second
Approval serviceApproval requests, reviewer inbox, timeouts, escalationPending approvals
A2A client and serverRemote agent calls; exposes platform agentsCalls per second
Evaluation hooksOnline graders and trajectory exportSampled share of runs

7. Detailed design

7.1 Step execution

A worker holds a lease on a run while it executes a step. The conditional append on seq acts as a fencing token: if a worker lost its lease and a second worker resumed the run, the first worker's late write fails. A stale worker can still reach a tool before its append fails, so both workers derive the same idempotency key for the same step and the broker returns the recorded result instead of running the tool twice.

7.2 Deep dive 1: durable execution and exactly-once side effects

OptionStrengthsWeaknesses
A. In-memory loop with retriesSimple; any frameworkCrash loses the run; retries repeat side effects
B. Snapshot the full state after each stepSimple resumeLarge writes; does not by itself prevent a tool running twice when the crash falls between the call and the snapshot
C. Event-sourced history with deterministic replay of workflow codeProven model; resume anywhereAgent code must be deterministic; model outputs must be recorded as activities
D. Step journal of recorded results plus periodic checkpoints, with idempotency keys on side effectsFits agent loops; small writes; no determinism constraint on prompt logic between stepsThe platform owns more of the engine

Choice: D for v1. Every step result is appended before it is used; checkpoints every 10 steps (Example) bound resume time; every tool call carries an idempotency key derived from run ID and step number.

Reason: agent loops are dominated by non-deterministic steps (model calls), so most of the value of deterministic replay is lost and its constraints on code remain. Recording results gives the same guarantee the journal needs. Exactly-once side effects still need the tool's help: the broker sends the idempotency key, and tools that cannot honour one are marked non-idempotent and require an approval or a reconciliation read before retry.

Tool classRetry rule
Read-onlyRetry freely with backoff
Idempotent write (accepts a key)Retry with the same key
Non-idempotent writeNever retry blindly; read the target state first, or ask a person

How real systems do it: Temporal durable execution (paraphrased)

Temporal's documentation describes workflow executions whose progress is stored as an event history in the service's persistence layer. When a worker fails, the workflow code runs again and the commands it produces are checked against the recorded history, so execution continues from the last recorded event instead of starting over. External work runs as activities with retry policies, timers can wait without using resources, and a long-running execution can continue as a new run to keep its history bounded. Source: Temporal documentation, "Workflow Execution", https://docs.temporal.io/workflow-execution. LangGraph's persistence layer offers a related checkpoint-per-thread model (see 12.4). This box summarises; read the originals for details.

7.3 Deep dive 2: tool calls over MCP, including long-running tools

MCP revision 2026-07-28 uses stateless, self-contained JSON-RPC requests with per-request capability negotiation. Optional extensions are opt-in on both sides; the Tasks extension (io.modelcontextprotocol/tasks) lets a server answer a request such as tools/call with a task handle instead of blocking. The client then polls tasks/get, answers input requests with tasks/update and can send tasks/cancel; task states are working, input_required, completed, failed and cancelled.

OptionStrengthsWeaknesses
A. Block the worker until the tool returnsSimpleHolds a worker; breaks on transport timeouts; lost on crash
B. Tasks extension where the server supports it; store the task ID in the journal and park the runDurable handle survives crashes; zero-compute waitNeeds server support; polling load
C. Platform-side async wrapper (the broker runs the blocking call on a separate pool and parks the run)Works with any serverThe wrapper itself must be durable

Choice: B when the server advertises the extension, C otherwise, A only for tools with a p99 under 2 s (Example).

Reason: 720,000 long tool calls per day (3.5) cannot hold workers. The task ID is written to the journal before the run parks, so a crash loses nothing; the broker resumes polling at the server's suggested interval, or uses status notifications when the server offers them. An input_required task becomes a human or agent decision in the platform's approval flow.

Broker rules:

  • Each run gets credentials scoped to its tenant, user and the tools its agent definition lists; tokens expire with the run.
  • Tool descriptions and annotations from servers outside the tenant's trust list are treated as untrusted input, as the MCP specification advises.
  • Tool results and A2A replies are untrusted data: they enter the model context marked as data, never as instructions, and cannot widen the run's tool list or credentials.
  • Tool results are size-limited and stored by reference when large.
  • Permission design follows the Agent Tool and Permission Design Template (ai-data/agent-tool-permission-design).

7.4 Deep dive 3: human-in-the-loop pauses

OptionStrengthsWeaknesses
A. Worker polls an approval tableSimpleHolds compute for hours (3.4)
B. Park the run, emit an approval request, resume on an event or a durable timerZero compute while waiting; timeouts are explicitMore moving parts

Choice: B. The approval request records the exact action (tool, target, arguments summary), the agent's stated reason, the budget used so far and an expiry. The decision (approve, reject, edit arguments) is written to the journal as a step, so replay shows who decided what.

RuleExample value
Actions that always need approvalPayments, deletions, external messages, permission changes
Timeout24 h, then escalate to the group lead; reject after 72 h
Edit allowedArguments within the tool's schema; edits are journaled
Reviewer independenceThe run's initiator cannot approve their own high-risk action

Design the oversight itself with the Human Oversight Design Template (ai-data/human-oversight-design).

7.5 Deep dive 4: tenant isolation and budgets

OptionStrengthsWeaknesses
A. Shared queue, first come first servedSimpleOne tenant's burst starves others
B. Queue per tenant with weighted fair dequeue and per-tenant concurrency capsIsolation with shared workersScheduler complexity
C. Dedicated worker pools per tenantStrong isolationPoor utilisation for small tenants

Choice: B for all tenants; C available for regulated tenants that need dedicated compute.

Reason: NFR-05 needs bounded interference without a pool per tenant.

Budgets are checked before each step against four limits; the first limit hit decides the outcome:

LimitExample defaultOn exhaustion
Steps per run50Stop with a partial result and a reason
Tokens per run200,000Pause for approval to extend, or stop
Wall-clock time per run, excluding human waits30 minStop; cancel in-flight tasks
Currency per runUSD 2.00Pause for approval to extend
Tenant daily currencySet per contractReject new runs with budget-exhausted

A loop detector also stops runs that repeat the same tool call with the same arguments more than 3 times (Example).

7.6 Agent-to-agent calls over A2A

The platform acts as an A2A client towards remote agents and as an A2A server for agents it chooses to expose. It targets A2A specification 1.0.1 (a patch release of 1.0.0, protocol version 1.0), which defines operations such as SendMessage, SendStreamingMessage, GetTask, CancelTask and SubscribeToTask over JSON-RPC, gRPC or HTTP+JSON bindings. A remote agent call is a step like a tool call: its task ID is journaled before the run parks, and cancellation of the run cancels the remote task. Agent Cards for exposed agents are specified with the A2A Agent Card and Interface Specification Template (ai-data/a2a-agent-card-spec).

7.7 Observability and evaluation hooks

  • One trace per run; one span per step, using the OpenTelemetry semantic conventions for generative AI (Development status) for model, tool and agent spans, as set out in LLM and Agent Observability Specification Template (ai-data/llm-observability-spec).
  • The journal sequence number is a span attribute, so a trace and the journal can be joined.
  • Online graders run on a sample of finished runs; offline evaluation reads exported trajectories. Metrics and datasets follow the AI Agent Evaluation Plan Template (ai-data/agent-evaluation-plan).

8. Scalability and performance

ConcernApproachLimit before redesign
Step dispatchPer-class queues, tenant-fair dequeueScheduler partition throughput
Journal writesPartition by run ID; deltas onlySingle very long run (thousands of steps): compact more often
Parked runsPersisted state, durable timersTimer index throughput at wake-up storms
Tool pollingServer-suggested intervals, backoff, notificationsServers with tight polling limits
Model capacityPlatform quota on the LLM gateway, per-tenant capsGateway quota

Scheduling overhead budget (NFR-04, p95 100 ms): dequeue 10 ms, load checkpoint and journal tail 40 ms, budget and policy checks 10 ms, journal append 20 ms, headroom 20 ms.

9. Reliability, security and operations

9.1 Failure modes

IDComponentFailureDetectionBlast radiusMitigationRTO
FM-01WorkerCrash mid-stepLease expiryRuns on that workerAnother worker resumes from the journal; fencing on seq5 s
FM-02Journal storePartition unavailableAppend errorsRuns on that partition pauseReplicated store; runs wait, no data loss15 min
FM-03MCP serverDown or slowBroker error rate, circuit stateRuns using that toolCircuit breaker; runs park and retry later; idempotency keysDepends on the server
FM-04LLM gatewayQuota exhausted or outage429 and 5xx from gatewayAll runs needing model callsBack off; park runs; priority for interactive tenantsGateway RTO
FM-05Agent versionBad prompt or logic releaseEvaluation hooks, error rate, loop detectorRuns of that versionVersion pinning per run; roll back alias; stop affected runs10 min
FM-06Timer serviceMissed wake-upsOverdue timer metricParked runsReconciliation sweep every minute2 min
[FM-nn][Component][Failure][Signal][Scope][Mitigation][Time]

9.2 Security

Mapping to the OWASP Top 10 for Agentic Applications 2026 (OWASP GenAI Security Project); confirm entry names against the current list.

IDThreat (OWASP entry)Control
SEC-01Agent Goal Hijack (ASI01) through tool results or documentsUntrusted-content marking; approval for high-risk actions; guardrails
SEC-02Tool Misuse and Exploitation (ASI02)Per-agent tool allow-lists; argument validation in the broker
SEC-03Identity and Privilege Abuse (ASI03)Per-run scoped, short-lived credentials; no shared service tokens
SEC-04Agentic Supply Chain Vulnerabilities (ASI04)Registered MCP servers only; version pinning; review of server changes
SEC-05Unexpected Code Execution (ASI05)Code runs only in the sandbox service, never in workers
SEC-06Memory & Context Poisoning (ASI06)Provenance on memory writes; tenant-scoped memory
SEC-07Insecure Inter-Agent Communication (ASI07)Authenticated A2A with signed Agent Cards; mutual TLS inside the platform
SEC-08Cascading Failures (ASI08)Budgets, loop detector, circuit breakers per tool
SEC-09Rogue Agents (ASI10)Kill switch per agent version and per tenant; audit of all actions
[SEC-nn][Threat][Control]

Run the full analysis with the Agentic AI Threat Model Template (ai-data/agentic-threat-model).

9.3 Observability

SignalMetricAlert threshold
Scheduling delayp95 step-to-step gapAbove 100 ms for 10 min
Resume timep95 after worker lossAbove 5 s
Journal append errorsRateAny sustained rate above 0.1%
Parked runsCount by reasonSudden rise per tenant
Approval latencyp95 by groupAbove the group's target
Budget stopsCount by tenant and agentRise after a release
Duplicate side-effect attemptsIdempotency hits on non-idempotent toolsAny

9.4 Cost estimate

ItemUnit costQuantityMonthly cost
Model and tool spendFrom gateway meteringabout USD 1.44 million per 30 days (3.6)[USD]
Workers[USD per instance-month]72 at peak[USD]
Journal and checkpoint store[USD per TB-month]about 5 TB hot after 7-day compaction (3.5)[USD]
Object storage for results and archives[USD per TB-month][TB][USD]
Total[USD]

10. Trade-offs and alternatives

DecisionOptionsChosenWhyWhat we give up
Execution modelIn-memory; snapshots; deterministic replay; recorded-step journalRecorded-step journal plus checkpointsFits non-deterministic stepsOwn engine to maintain
EngineGeneral workflow engine; own journalOwn journal for v1Agent-specific steps (tasks, approvals, budgets)Features a mature engine already has
Long toolsBlock; MCP Tasks; async wrapperTasks where supported, wrapper otherwiseDurable handles, zero-compute waitsPolling load
IsolationShared queue; fair queues; dedicated poolsFair queues plus optional dedicated poolsUtilisation with bounded interferenceScheduler complexity
Inter-agentCustom RPC; A2AA2A 1.0.1Interoperable with other vendors' agentsSpec churn
What changes at 10x (12 million runs per day, about 6,250 peak steps per second)Partition the scheduler by tenant hash; dedicated log store for the journal; consider adopting a proven durable execution engineScheduler partitions and journal write rate become the limitsMigration effort and a second engine to learn
What changes at 0.1x (120,000 runs per day)One database for runs and journal, a single scheduler, about 8 workersFixed cost of partitioned stores is not justifiedLess headroom for a single noisy tenant
[Decision][Options][Chosen][Why][Cost]

11. Delivery plan and risks

11.1 Milestones

MilestoneScopeExit criterionTarget date
M1Run API, journal, workers, model stepsChaos test meets NFR-01 and NFR-03YYYY-MM-DD
M2Tool broker with MCP, idempotency keysNFR-02 audit passes on pilot toolsYYYY-MM-DD
M3Approvals and durable timers5,000 parked runs hold no workers (NFR-06)YYYY-MM-DD
M4Budgets, fair schedulingMixed-tenant test meets NFR-05YYYY-MM-DD
M5MCP Tasks, A2A client and server, evaluation hooksPilot multi-agent flow traced end to endYYYY-MM-DD

11.2 Rollout and rollback

[Example: Teams migrate one agent at a time behind a feature flag; runs started on the old path finish there. Agent versions roll out per tenant with a canary share and are pinned per run, so a rollback affects only new runs.]

11.3 Risks

IDRiskLikelihoodImpactMitigationOwner
R-01Example: Tools that cannot honour idempotency keysHighHighMark non-idempotent; reconciliation reads; approvals[@name]
R-02Example: MCP Tasks support uneven across serversHighMediumAsync wrapper fallback[@name]
R-03Example: Journal growth from verbose tool resultsMediumMediumSize limits, references, compaction[@name]
R-04Example: Protocol revisions change behaviourMediumMediumPin versions; contract tests[@name]
[R-nn][Risk][L / M / H][L / M / H][Mitigation][@name]

12. Appendices

12.1 Traceability

RequirementDesign elementVerification
FR-03, NFR-01, NFR-037.1 leases and fencing, 7.2 journalChaos test killing workers
NFR-027.2 idempotency keys, tool classesBroker audit
FR-06, NFR-067.4 parking and timersLoad test with parked runs
FR-07, NFR-057.5 fair queues and budgetsMixed-tenant test
FR-047.3 broker and MCPContract tests per server
[ID][Element][Test]

12.2 Open questions

IDQuestionOwnerDue
OQ-01Example: Do we expose run state as A2A tasks for all agents or only selected ones?[@name]YYYY-MM-DD
OQ-02Example: When does adopting a general durable execution engine pay off?[@name]YYYY-MM-DD
[OQ-nn][Question][@name]YYYY-MM-DD

12.3 Glossary

TermMeaning
RunOne execution of an agent definition on an input
StepOne unit of work in a run: model call, tool call, sub-agent call or human wait
JournalAppend-only, ordered record of each step's result for one run
CheckpointSnapshot of run state at a journal position, used to resume faster
FencingRejecting writes from a worker that has lost its lease
ParkingPersisting a waiting run and releasing its worker
Durable executionExecution that survives process failure without repeating completed work

12.4 References

ReferenceUse
Model Context Protocol specification, revision 2026-07-28, https://modelcontextprotocol.io/specification/2026-07-28Tool calls in 7.3
MCP Tasks extension, https://modelcontextprotocol.io/extensions/tasks/overview (specified in the modelcontextprotocol/ext-tasks repository)Long-running tools in 7.3
Agent2Agent (A2A) Protocol Specification 1.0.1, https://a2a-protocol.org/latest/specification/ and https://github.com/a2aproject/A2AInter-agent calls in 7.6
OWASP Top 10 for Agentic Applications 2026, OWASP GenAI Security Project, https://genai.owasp.org/ (CC BY-SA 4.0)Threats in 9.2
OpenTelemetry semantic conventions for generative AI (Development status), https://github.com/open-telemetry/semantic-conventions-genaiSpans in 7.7
Temporal documentation, "Workflow Execution", https://docs.temporal.io/workflow-executionBox in 7.2 (paraphrased)
LangChain, LangGraph persistence documentation, https://docs.langchain.com/oss/python/langgraph/persistenceCheckpoint-per-thread comparison
RFC 9457, Problem Details for HTTP APIs (2023)Error format
Multi-Agent System Design Template (ai-data/multi-agent-system-design)Agent roles and hand-offs
Agent Code Execution Sandbox System Design Template (system-design/design-agent-sandbox-execution)Code execution
Job Scheduler System Design Template (system-design/design-job-scheduler)Queue and timer patterns
Workflow Orchestration Engine System Design Template (system-design/design-workflow-orchestration-engine)General durable workflow engine, the option to adopt at 10x

Standard and licence note

Based on the Model Context Protocol specification revision 2026-07-28 and its Tasks extension, the Agent2Agent (A2A) Protocol Specification 1.0.1, the OpenTelemetry semantic conventions for generative AI (Development status), RFC 9457, and the OWASP Top 10 for Agentic Applications 2026 by the OWASP GenAI Security Project (CC BY-SA 4.0; entry names are attributed to OWASP, and any adapted OWASP material you redistribute must carry the same licence under its ShareAlike term). Product documentation in 7.2 is paraphrased and cited as inspiration only. The text is original; these protocols change quickly, so check the current official version of each source before approval. Template licence: MIT.

Template liên quan