Design the capstone around a complete user outcome
How to study this lesson
Read one section, trace the worked example, and try the knowledge check. Bookmark saves a shortcut; notes appear in My notebook. Mark lesson complete is your own assessment and does not mark its lab passed.
By the end, you can
- Assign clear responsibilities to the host, tools, peer agents, and user interface.
- Distinguish MCP capabilities from A2A task collaboration.
- Choose an integration slice with measurable end-to-end acceptance.
Pick a task whose success can be inspected
A capstone should solve a bounded problem for a recognizable user. Consider an evidence desk that reviews an incident question, retrieves authorized operational notes, asks a specialist to analyze conflicting evidence, and returns a cited action proposal. The user needs a useful recommendation and a clear statement of uncertainty. The project should specify which actions it may take automatically and which require a separately authorized decision.
Define acceptance before connecting services. A successful task might require every factual claim to cite an available source, all retrieved documents to belong to the authenticated tenant, and a response within a stated call budget. Failure states should include missing evidence, unavailable specialist, denied tool access, and cancellation. A plain deterministic workflow should serve as a baseline. Adding a protocol or another agent is justified when it improves interoperability, ownership, capability, or measured behavior relevant to this task.
Use MCP for capabilities with explicit contracts
MCP standardizes connections between an application host, its clients, and services that expose context and capabilities. Its server features include resources, prompts, and tools. For the evidence desk, a retrieval service can expose authorized incident records and a tool that performs a bounded search. The host remains responsible for how a model's proposed use is validated and presented in the product.
Pin the protocol revision and SDK versions used by the project because message and capability behavior can evolve. Validate inputs and outputs against the selected contracts, handle protocol errors separately from task-level failures, and establish authentication using the documented mechanism for the chosen transport. A server advertising a tool does not mean that every user may execute it. Derive access from trusted identity and enforce it where the underlying resource or operation is used.
Use A2A when another agent owns a task
A2A provides a communication model for independent agent systems, including capability discovery and task-oriented interaction. An Agent Card describes a service's capabilities and how clients interact with it. The specialist in the capstone might accept a bounded evidence-analysis task and return an artifact, without exposing its internal planning or implementation. Discovery information is useful for selecting an interface, but capability claims are not proof of result quality or permission to disclose data.
Decide what the remote agent owns: its task state, intermediate questions, final artifact, and declared error behavior. The host owns the user task and must reconcile remote outcomes into that larger workflow. Give the specialist only the authorized evidence and task context it needs. Avoid forwarding credentials or broad access merely to simplify integration. Track parent and child task references so cancellation, timeouts, and later audits can identify the right work.
Connect contracts before adding model variability
Build a vertical slice with deterministic fixtures first: submit a task, retrieve scoped evidence, call a specialist adapter, validate its artifact, and render the result. The included Python seed simulates these responsibilities in process. It is not an MCP server, an A2A implementation, or a live model benchmark. Replace each adapter with an actual pinned protocol implementation only after the local contract behaves correctly.
Suppose retrieval costs one budget unit and specialist analysis costs two. A three-unit task budget permits exactly that plan in the simulation. If the specialist fails, an automatic retry would require an explicit additional reservation or a different recovery path. Carry typed outcomes such as denied, unavailable, incomplete, and completed instead of treating every returned string as success. This makes the integration explainable when a remote service returns a valid protocol message but fails to complete the requested business task.
Evaluate the whole path and its components
Component checks help locate failures: retrieval recall, artifact schema validity, citation membership, and tenant enforcement. End-to-end checks answer whether the user received a correct and useful result. A specialist can return valid JSON with unsupported content, while retrieval can find the right document and the final answer can still misrepresent it. Keep those measurements separate so improvements target the actual weak link.
Run the same held-out tasks through the deterministic baseline and integrated system under documented resource budgets. Include unavailable dependencies, conflicting evidence, empty results, and malicious instructions inside synthetic documents. Record the exact protocol and application revisions with outcomes. The capstone's strongest claim is the behavior it can demonstrate through reproducible evidence; architectural breadth alone does not establish that collaboration improves task quality or that a production deployment is ready.
Work through the code
The functions represent retrieval, specialist delegation, and artifact validation boundaries. Citation membership checks only that references point to supplied records; it does not prove that the cited text supports the summary. A real capstone must implement and test both protocol adapters and semantic evaluation.
def retrieve(tenant, records):
return [record for record in records if record["tenant"] == tenant]
def specialist(evidence):
return {"summary": "Inspect the queue before adding workers.",
"citations": [record["id"] for record in evidence]}
def validate(artifact, evidence):
allowed = {record["id"] for record in evidence}
return bool(artifact["citations"]) and set(artifact["citations"]) <= allowed
records = [{"id": "r1", "tenant": "red", "text": "Queue depth increased."},
{"id": "b1", "tenant": "blue", "text": "Private blue incident."}]
evidence = retrieve("red", records)
artifact = specialist(evidence)
print("retrieved ids:", [record["id"] for record in evidence])
print("citation membership valid:", validate(artifact, evidence))
print("budget units:", 1 + 2)
print("scope: in-process contract simulation, not MCP or A2A")
retrieved ids: ['r1'] citation membership valid: True budget units: 3 scope: in-process contract simulation, not MCP or A2A
Run Python snippets locally with the prerequisites named above. The module coding lab runs directly in your browser.
Pause and reason
A remote specialist returns a completed task with valid JSON, but cites a document that was not included in its authorized evidence. What should the host do, and what should be recorded?
Check your understanding
Why might an application use both MCP and A2A in one workflow?
Your notes
Explain the mechanism in your own words. Add a failure you want to test.