Part 3: Frameworks and architecture
Reference architectures
Five shapes that cover most production agents, and the plumbing that keeps them honest
In short
Run an agent like any non-deterministic service: idempotent on input, durable when it waits, split only where context or ownership demands it.
Key ideas
- Five composable shapes; event consumer plus durable workflow covers most back-office work
- An agent consumer is non-deterministic: claim the input event, then commit write, outbox row and done-mark together
- Model calls are durable steps; split agents only for parallelism or context isolation
A summary only. The reasoning, examples, checklist and what to do on Monday are in the chapter. Read it in the book
Inside the chapter
- 1Overview: five shapes
- 21. Single agent behind an API
- 32. The agent as a step in an event-driven system
- 43. Durable execution for long-running agents
- 54. Multi-agent inside one system
- 65. Agents across organization boundaries: A2A
- 7Hosted runtimes versus self-hosted
Try it: an event-driven agent
Reveal the path of one event, stage by stage.
- 1Event arrivesAt-least-once delivery: the same event can come twice.
- 2Dedupe on event idCheck the input event id first, so a replay cannot write twice.
- 3Bounded agent runStep, cost and time caps; budget exhaustion is a failure, not a retry.
- 4Write result + outbox in one transactionDedupe record, business write and outbox row commit together: no lost events, no ghosts.
- 5Relay publishesCDC or a poller publishes the outbox row, possibly twice; consumers dedupe.
- 6Failure goes to the DLQAfter a few fixed attempts: error, trace id and attempt count, for triage and replay.
Go further: free on this site
Questions readers asked about this chapter, a 5-question self-check with explanations, and every source it cites.
Questions readers ask (3)
3 questions. Open one to read the answer.
Where do triggers come from if we do not run Kafka?
Webhooks, queues (SQS, Pub/Sub, a jobs table) and cron. They also deliver at least once, so architecture 2's rules apply: dedupe on the sender's event id in your write transaction, acknowledge fast, work asynchronously, keep a dead-letter path. A handler that runs the whole agent before returning hits the sender's timeout and runs twice.
Who should own an agent consumer: the platform team or the product team?
The product team that owns the business outcome, including prompts, tools and evals. The platform team owns the paved road: a consumer template with dedupe, outbox and DLQ, the durable engine, model gateway and tracing. A central "AI team" owning every consumer becomes a bottleneck running rules it does not know (RACI in Ch 12).
Microsoft now gives our agents an Entra Agent ID. Do we still need our own registry?
Yes. Microsoft said in November 2026 that agents connected to Agent 365 get an Entra Agent ID automatically, with support for 11 platforms rolling out through December (Microsoft). Use it for identity and sign-in. Keep the registry fields that make an agent governable in your own repo: owner, mandate, pinned tools, A/B/C status and review date (Chapter 12). The identity provider can change; your source of truth should not.
Answered in the book, not repeated here: See Chapter 7, Hosted runtimes versus self-hosted; See Chapter 7, 1. Single agent behind an API; See Chapter 7, 4. Multi-agent inside one system; See Chapter 7, What durability gives an agent
Self-check (5)
Score: 0 / 5 (0 answered)
Question 1 of 5
Why must an agent consumer on a Kafka-style topic be idempotent on the input event rather than on its output?
Show the answer
Answer: D.
Delivery is at least once in practice, and a second run can produce a different result, so only the input event id identifies a duplicate reliably. Deduping on output fails exactly when the model changes its mind.
Question 2 of 5
An agent takes about two minutes per event and your consumer group keeps rebalancing. What is the preferred fix?
Show the answer
Answer: A.
Handing off moves the slow agent run out of the poll loop, and the workflow id gives idempotency. Raising the interval only hides the problem until a slower run, and more partitions do not shorten a single run.
Question 3 of 5
In a durable execution engine, where should the model call live?
Show the answer
Answer: C.
Workflow code is replayed deterministically, so a non-deterministic model call must be a recorded step. The 2026-07-28 MCP spec removed SSE resumability, so durability belongs in the workflow layer, not the transport.
Question 4 of 5
When is A2A the right choice instead of an MCP tool or an internal API?
Show the answer
Answer: B.
A2A pays off across a boundary of ownership; inside one trust boundary, a function call or MCP tool is simpler. Exposing internal agents over A2A to be future-proof is the multi-agent theater anti-pattern.
Question 5 of 5
Anthropic's March 2026 harness for long-running app development added a separate evaluator next to the planner and generator. Why?
Show the answer
Answer: B.
The solo run was cheap ($9, 20 minutes) but shipped a broken core feature; the full harness cost far more and worked. The lesson is never to let the builder grade itself, and to remove harness parts one at a time as models improve.
Sources
Sources cited
- Model Context Protocol, The 2026-07-28 Specification (MCP blog), July 2026. blog.modelcontextprotocol.io
- Apache Kafka, KIP-62: Allow consumer to send heartbeats from a background thread, accessed November 2026. cwiki.apache.org
- Temporal, Production-ready agents with the OpenAI Agents SDK + Temporal, July 2025 (GA update March 2026). temporal.io
- Inngest, Durable agents (documentation), accessed November 2026. inngest.com
- Model Context Protocol, Key Changes (2026-07-28 specification changelog), July 2026. modelcontextprotocol.io
- Anthropic, Scaling Managed Agents: decoupling the brain from the hands, April 2026. anthropic.com
- Temporal, You don't need to build a new reliability system for every AI Framework, October 2026. temporal.io
- TechCrunch (Marina Temkin), Restate lands $20M as the need for durable infrastructure increases with AI agents, September 2026. techcrunch.com
- Pydantic, Restate (Pydantic AI durable execution documentation), accessed November 2026. pydantic.dev
- DBOS, DBOS (home page and integrations), accessed November 2026. dbos.dev
- Anthropic (Erik Schluntz, Barry Zhang), Building effective AI agents, December 2024. anthropic.com
- OpenTelemetry, Semantic conventions for GenAI agent and framework spans (status: Development), accessed November 2026. github.com
- Anthropic, Harness design for long-running application development, March 2026. anthropic.com
- Google Open Source (Patricia Cruz), A year of open collaboration: Celebrating the anniversary of A2A, April 2026. opensource.googleblog.com
- Agentic AI Foundation, A2A joins AAIF's open agentic stack, August 2026. aaif.io
- The Linux Foundation, A2A Protocol Surpasses 150 Organizations, Lands in Major Cloud Platforms, and Sees Enterprise Production Use in First Year, April 2026. linuxfoundation.org
- Microsoft Tech Community, What's new in Microsoft Agent 365 (Ignite 2026), November 2026. techcommunity.microsoft.com
- AWS, Amazon Bedrock AgentCore is now generally available, October 2025. aws.amazon.com
- AWS News Blog, Runtime instances: persistent compute for production AI agents on Amazon Bedrock AgentCore, August 2026. aws.amazon.com
- LangChain, LangSmith Agent Server (product page, formerly LangSmith Deployment), accessed November 2026. langchain.com
- Google Cloud, Introducing Gemini Enterprise Agent Platform, powering the next wave of agents, April 2026. cloud.google.com
- Anthropic, Claude Managed Agents overview (documentation), accessed November 2026. platform.claude.com
- OpenAI, Introducing the Agents API, September 2026. openai.com
- Microsoft Foundry Blog, Foundry Agent Service at Build 2026, June 2026. devblogs.microsoft.com
Further reading
- Chris Richardson, Pattern: Transactional outbox (microservices.io), accessed November 2026. microservices.io
- Anthropic, How we built our multi-agent research system, June 2025. anthropic.com
- Cognition (Walden Yan), Don't Build Multi-Agents, June 2025. cognition.com
- A2A Protocol, Specification, accessed November 2026. a2a-protocol.org