Free learning / 40-minute A2A 101 lab
A2A 101: follow an agent's first handoff
Separate messages, tracked tasks, context and artifacts. Follow a missing-input request visually, then run four local cases before adding multi-agent coordination.
No account needed. Use your own copy for writing and keep the original as a reference.
Engineering lab library / Run locally
Follow the request. Inspect the result.
Predict four handoffs, then run the local file. Compare a waiting job, a wrong task ID, a completed but unusable artifact and a related follow-up.
Local JavaScript task model with scripted messages. No model, network or A2A SDK; this teaches the lifecycle, not protocol conformance.
Start here / Node.js 24 · Offline exercise
First agent handoff
Trace a clarification, wrong-task refusal, held artifact and a new task in the same conversation.
Node.js 24 · Standard library · No model, network or account
LockedIn Labs Training · Edition 1 · 40-minute foundation and local exercise · Updated 2026-10-21
1. Start with a work order
UNDERSTAND THE SYSTEM
Follow a message, a task and a result
One application asks another to find a date in a procedure. A message carries the request; a task tracks the work; an artifact carries the output. A2A is a communication protocol for these handoffs, not a model or programming language. This visual follows a scripted local teaching example.
See what moves and why.
Read the connections in plain English
- 01Requesting app → Message
M-1 asks for the date but leaves out the procedure ID.
- 02Message → Receiving app
The first message starts work; M-2 later supplies the missing procedure ID.
- 03Receiving app → Tracked task
The receiving application creates T-17 in C-7 and reports input-required until the missing input arrives.
- 04Tracked task → Output artifact
The local task completes with artifact A-17 after reading the supplied procedure fixture.
- 05Output artifact → Client decision
The client compares task, context, source and date against its exercise contract.
- 06Client decision → Requesting app
A completed task with the wrong source is held; it is not silently treated as accepted output.
Check your understanding: The task says completed but its artifact cites the wrong procedure. Should the client use it?
No. Keep the task's reported status and the client's acceptance decision separate. The lab holds the mismatched artifact. In a real system, task IDs and context IDs also do not replace authentication, source authorization or a task-specific output check.
Imagine that your application helps an engineer prepare a maintenance review. It needs one date from a procedure. Another team's application already knows how to read that procedure. Your application asks that service for a specific piece of work and waits for a usable result. Neither application needs to see the other's model prompts or internal code.
Agent2Agent (A2A) is an open communication protocol for this kind of collaboration between agent systems. It is not a programming language, model or workflow framework. Agents can also communicate through ordinary function calls, queues or custom APIs; A2A supplies a shared contract when separate implementations need to cooperate. Official introduction.
Think of a service work order. The message is what you send. The task is the job being tracked. The artifact is what comes back. The analogy has a limit: a work-order number does not prove that the caller is allowed to read a document or that the returned date is correct.
As a forward deployed engineer, you need to make a handoff understandable across teams. You should be able to explain who requested the work, what is still waiting, which result belongs to which request, and who decides whether it is usable. Start with those questions before choosing multiple agents.
2. Give each part a job
| Part | What it means here | Familiar comparison |
|---|---|---|
| Client | The requesting application | A service calling another service |
| Agent card | Metadata describing a service's capabilities and connection requirements | A service directory entry |
| Message | One turn of communication, identified by a message ID | One request or reply |
| Task | A tracked unit of work with its own ID and state | A job ticket |
| Context | A grouping for related interactions | A conversation folder |
| Artifact | The output of the work | A report attached to the ticket |
The client does not need to be an AI agent itself. A normal application can call an A2A service. A quick exchange can return a message without creating a task; this exercise deliberately uses a tracked task so you can see waiting and completion. Official core concepts.
MCP and A2A serve different integration needs. MCP exposes tools, resources and prompts to an application. A2A supports communication with another agent system. A specialist may use tools internally, but sending it a task does not transfer your credentials or permissions. Choosing A2A also does not choose LangGraph, LangChain or a model for you.
3. Prepare the small local experiment
Download fde-a2a-first-task.mjs into a new practice folder. Use Node.js 24; there are no packages to install and no API keys to enter.
node --version
node fde-a2a-first-task.mjs clarifyThis is a runnable JavaScript teaching model with synthetic procedure P-17. It performs actual local state transitions and fixture checks. The specialist's behavior is scripted. It uses no network, model, A2A SDK or real document service. The compact records and lowercase state names are teaching notation, not protocol wire payloads. Save your command output as your observation, not as evidence of an A2A integration.
Before running, predict: if the first request omits the procedure ID, does the job fail, finish or ask for input?
4. Follow one request through the diagram
Select each event in the visual walkthrough. Match it to these fields in the local report.
- Request work. M-1 asks for a review date but does not identify the procedure. The receiving application creates task T-17 in context C-7.
- Ask for missing input.
initialTask.stateisinput-required. The question asks which procedure to read. There is no artifact yet. - Continue the same job. M-2 supplies P-17 and addresses T-17 in C-7. Its message ID is new; the task and context IDs stay the same.
- Return the result.
reply.eventsrecords working, then completed. Artifact A-17 contains source P-17 and the fixture's date, 2026-11-12. - Decide whether to use it.
clientDecisionaccepts the exact fixture match. This check is separate from the specialist marking its task completed.
In A2A, input-required pauses work for another contribution. A terminal state such as completed or failed ends that task. A follow-up refinement uses a new task, and related tasks can share a context. Official task lifecycle.
Explain the flow aloud without using the word agent: “The requesting application sent a message. The receiving application opened a job, asked for the missing document, and returned a report. The requester checked it.” Then put the technical terms back in.
5. Challenge the handoff
Predict the task state, artifact count and client decision for each case before running it.
node fde-a2a-first-task.mjs wrong-task
node fde-a2a-first-task.mjs unverified-artifact
node fde-a2a-first-task.mjs refine| Case | What you should inspect | What it teaches |
|---|---|---|
| wrong-task | M-2 addresses T-99; reply reason is unknown-task; T-17 still needs input and has zero artifacts | An answer to the wrong job must not silently finish the original job |
| unverified-artifact | The task is completed, but its artifact cites P-99; the client holds it | Reporting completion and accepting an output are different decisions |
| refine | terminalFollowUp is refused; newTask is T-18 in C-7 and references T-17 | The conversation continues without reopening the completed job |
For the held artifact, inspect validateArtifact. It compares the task/context, requires exactly one artifact, and checks the source ID and date against the supplied fixture. It does not assess arbitrary prose, authenticate the sender or prove document access. In a real integration, replace this tiny exercise contract with the acceptance rules for the customer's task.
The refine case creates T-18 but leaves it waiting for input. Its context and reference connect it to earlier work; they do not automatically copy an artifact or grant access to a source. Keep T-17's completed output as history.
6. Change one thing and explain the difference
Make a disposable copy named fde-a2a-first-task-copy.mjs using your editor. Keep the original beside it.
First change only the wrong-task branch's T-99 to T-17. Run node fde-a2a-first-task-copy.mjs wrong-task. Predict why the job can now finish. The scenario name has not changed, but your code and observed result have; label the output as a changed-copy experiment.
Restore the copy. Now change only the unverified-artifact branch's P-99 to P-17. Run that case again. The source check should now accept the fixture. Explain why repairing one scripted source ID is not evidence that arbitrary specialist outputs are accurate.
Keep a four-row observation sheet: scenario, your prediction, actual state/result, and what the run cannot establish. Add the two changed-copy comparisons. Finish by explaining why a new message, a new task and a new context are three different choices.
7. Take the next step deliberately
For real protocol plumbing, follow the official Python quickstart. It introduces an A2A server, agent card, executor and client. Compare the actual SDK types and serialized fields with this simplified model instead of sending these teaching records to a server. Record the SDK/protocol version you install and the requests you actually observe.
Then use our shared delegation exercise to add aggregate attempt limits, deadlines and late-result handling. The protected Agentic Engineering lesson retains the deeper receiving-team practice. Communication basics, coordination policy and a deployed integration are separate learning steps.
For an enterprise handoff, identify the receiving service, credential boundary, allowed source scope, time and cost limits, output contract and recovery owner. A protocol connection alone answers none of those business decisions. Leave authentication, persistence, streaming, cancellation and distributed concurrency marked unrun until you have exercised them in the receiving environment.
Sources and scope
Original LockedIn Labs explanation, synthetic case, diagram and local code. References checked 2026-10-21: A2A introduction, core concepts, task lifecycle, protocol definition and Python quickstart. This independent practice does not imply vendor affiliation, protocol certification or production readiness.