Skip to content
← Free FDE training guides

Free learning / A2A 101 + optional SDK lab

A2A 101: follow an agent's first handoff

Separate messages, tracked tasks, context and artifacts. Follow a missing-input request, then compare a local model with a real Python SDK exchange over loopback HTTP.

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.

Search titles, outcomes and prerequisites, then narrow by runtime.

2 of 2 labs · All labs

  1. 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

  2. Real library, SDK or framework · Scripted inputs

    A2A SDK over local HTTP

    Discover the real local agent card, continue a tracked task and hold a completed result with the wrong source.

    Python 3.11+ · Fresh environment · Five pinned packages · No model or key

LockedIn Labs Training · Edition 2 · 40-minute foundation plus optional 25-minute SDK lab · Updated 2026-10-25

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.

FOLLOW THE WORK

Watch one example, step by step.

6 authored stepsYou control the pace
01 / EXPLORE THE PARTSControls loading · written explanations below
Direction of information or workReturn / feedback

WHAT THIS PART DOES

Requesting app

The client asks for work and decides whether the result is usable. It can be an ordinary application, not necessarily another AI agent.

CONNECTED TO
  • Request work: Message
  • Accept or hold: Client decision
Read the full worked example
  1. 01
    Send the first message

    M-1 asks for the review date. Like a service work order, the request needs enough information for the other application to act.

    Local teaching request: M-1 · Find the review due date in the procedure.

  2. 02
    Pause for missing input

    The receiver creates T-17 in C-7 and asks which procedure to read. Input-required is a waiting state, not a failed job or a finished answer.

    Local task: T-17 · C-7 · input-required · Which procedure should I read?

  3. 03
    Continue the same task

    M-2 supplies P-17 and addresses T-17 in C-7. This is a new message about the existing job. The wrong-task exercise instead addresses T-99 and is refused.

    Follow-up message: M-2 · task T-17 · context C-7 · procedure P-17

  4. 04
    Return an artifact

    The scripted specialist returns A-17 and completes T-17. The caller now has output to inspect; completion alone does not say the output is correct.

    Local task output: T-17 completed · A-17 · P-17 · due 2026-11-12

  5. 05
    Check before accepting

    The ordinary case matches P-17. In unverified-artifact, the completed task cites P-99 instead. The client holds that result while the task remains completed.

    Two different decisions: Task: completed · Client: hold when source is P-99

  6. 06
    Start a related follow-up

    The refine case refuses another message to completed T-17. It creates T-18 in the same C-7 context with a reference to T-17. The earlier result stays unchanged; the new task waits for input.

    New task, same conversation: T-18 · C-7 · references T-17 · input-required

Read the connections in plain English
  1. 01
    Requesting app → Message

    M-1 asks for the date but leaves out the procedure ID.

  2. 02
    Message → Receiving app

    The first message starts work; M-2 later supplies the missing procedure ID.

  3. 03
    Receiving app → Tracked task

    The receiving application creates T-17 in C-7 and reports input-required until the missing input arrives.

  4. 04
    Tracked task → Output artifact

    The local task completes with artifact A-17 after reading the supplied procedure fixture.

  5. 05
    Output artifact → Client decision

    The client compares task, context, source and date against its exercise contract.

  6. 06
    Client 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

PartWhat it means hereFamiliar comparison
ClientThe requesting applicationA service calling another service
Agent cardMetadata describing a service's capabilities and connection requirementsA service directory entry
MessageOne turn of communication, identified by a message IDOne request or reply
TaskA tracked unit of work with its own ID and stateA job ticket
ContextA grouping for related interactionsA conversation folder
ArtifactThe output of the workA 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.

Code example
node --version
node fde-a2a-first-task.mjs clarify

This 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.

  1. 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.
  2. Ask for missing input. initialTask.state is input-required. The question asks which procedure to read. There is no artifact yet.
  3. 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.
  4. Return the result. reply.events records working, then completed. Artifact A-17 contains source P-17 and the fixture's date, 2026-11-12.
  5. Decide whether to use it. clientDecision accepts 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 refinement starts a new interaction: if the receiver creates tracked work, it uses a new task. A quick reply can instead be a message. Related tasks and independent messages 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.

Code example
node fde-a2a-first-task.mjs wrong-task
node fde-a2a-first-task.mjs unverified-artifact
node fde-a2a-first-task.mjs refine
CaseWhat you should inspectWhat it teaches
wrong-taskM-2 addresses T-99; reply reason is unknown-task; T-17 still needs input and has zero artifactsAn answer to the wrong job must not silently finish the original job
unverified-artifactThe task is completed, but its artifact cites P-99; the client holds itReporting completion and accepting an output are different decisions
refineterminalFollowUp is refused; newTask is T-18 in C-7 and references T-17The 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.

6a. Cross the boundary with the real Python SDK

The first exercise is a local model of the handoff. Now observe the protocol actually carrying it. Download fde-a2a-sdk-lab.py. This optional exercise starts an HTTP server on your own computer, discovers its agent card, sends two messages through the official A2A Python SDK and reads the resulting task. The specialist still reads the fictional P-17 fixture; no language model is involved.

Use Python 3.11 or newer. Check its version before creating a new environment; choose a newer Python executable if your system default is older. Package installation needs internet access. The program itself makes requests only to its own 127.0.0.1 listener and does not install anything.

On macOS or Linux:

Code example
python3 --version
python3 -m venv .venv-a2a
.venv-a2a/bin/python -m pip install --upgrade "pip==26.2.0"
.venv-a2a/bin/python -m pip install "a2a-sdk[http-server]==1.2.3" "httpx==0.28.1" "starlette==1.10.0" "uvicorn==0.38.0" "protobuf==7.36.2"
.venv-a2a/bin/python -m pip check
.venv-a2a/bin/python fde-a2a-sdk-lab.py compare
.venv-a2a/bin/python -m pip freeze

On Windows, use py -3.12 -m venv .venv-a2a if Python 3.12 is installed, then replace .venv-a2a/bin/python with .venv-a2a\Scripts\python.exe in the remaining commands. The first install updates only this virtual environment’s packaging tool. Keep the installation pins. Save the full resolved package list with your actual output; these five direct pins are not a lockfile for every transitive dependency. Uvicorn supplies the HTTP server and is installed separately from the SDK's HTTP extra.

Predict before running

Both cases start with fresh memory-only task storage. The first message omits the procedure; the second supplies P-17 for that same task. Predict whether changing the returned source to P-99 breaks the HTTP exchange, the task state, or the client's acceptance rule.

Observationclarifyheld-artifact
First taskTASK_STATE_INPUT_REQUIRED; no artifactsTASK_STATE_INPUT_REQUIRED; no artifacts
Follow-upNew message ID; same task and context IDsNew message ID; same task and context IDs
Stored task after completionTASK_STATE_COMPLETED; one artifactTASK_STATE_COMPLETED; one artifact
Artifact's source / dateP-17 / 2026-11-12P-99 / 2026-11-12
Client decisionAccepts this fixtureHolds the source mismatch

Read the actual exchange

The requests array records SDK-created HTTP traffic. You should see GET /.well-known/agent-card.json, two POST /rpc calls using SendMessage, then POST /rpc using GetTask. All four responses are 200 in both cases. The request hook observes framing; the exercise does not hand-build JSON-RPC envelopes. Non-streaming client calls still expose an async iterator in this SDK.

Compare initialMessage, initialTask, sentMessage, completedTask and storedTask. The generated identifiers will differ between runs; their relationships must stay intact. Inspect storedTask.artifacts[0].parts[0].data, not just the status label. clientDecision is an authored fixture check: task/context, completion, one structured artifact and the exact source/date. It is separate from SDK serialization and lifecycle handling. It is not a general factuality check.

Three versions mean different things: sdkVersion is 1.2.3, the interface's protocolVersion is 1.0, and the example Agent Card's version is the specialist application's 1.0.0. Do not send the earlier JavaScript teaching records to this server. The current SDK uses A2A 1.0 protobuf types and method names; older 0.3 tutorials describe a different Python API.

To isolate the client rule, run .venv-a2a/bin/python fde-a2a-sdk-lab.py check. It checks matching and mismatched identities, unfinished work, missing output, wrong source and wrong date. That command uses neither SDK transport nor a socket; it is not a replacement for compare.

Keep both completed results, including the held one. Do not weaken the source check to make both green. The server stops after each case, its ephemeral port closes, and its memory task store disappears. The lab demonstrates local discovery, SDK serialization, HTTP dispatch and task storage during one process lifetime. It does not test authentication, persistent recovery, another implementation, concurrent delivery, cancellation or live model quality. No model key or cloud account is needed.

UNDERSTAND THE SYSTEM

A completed task still needs a client decision.

Follow the optional Python SDK lab from service discovery to a checked output. The program uses real loopback HTTP and A2A 1.0; the specialist reads a fictional fixture. These compact labels summarize the observed report. Task and message IDs are generated at runtime; this visual does not call a service.

FOLLOW THE WORK

Watch one example, step by step.

4 authored stepsYou control the pace
01 / EXPLORE THE PARTSControls loading · written explanations below
Direction of information or workReturn / feedback

WHAT THIS PART DOES

Requesting program

The caller is ordinary Python. It discovers a local service, supplies a missing procedure ID and decides whether the resulting artifact fits its request.

CONNECTED TO
  • Discover / send: SDK over HTTP
  • Accept or hold: Client acceptance
Read the full worked example
  1. 01
    Discover the service

    The SDK fetches /.well-known/agent-card.json. The card advertises a JSONRPC interface using protocol version 1.0 at this lab's local endpoint. It describes how to connect, without authenticating the service or granting access.

    OBSERVED LOCAL HTTP: GET agent card · HTTP 200 · A2A 1.0

  2. 02
    Ask for missing input

    SendMessage starts a tracked task. Its state is TASK_STATE_INPUT_REQUIRED and it has no artifact. A new message supplies P-17 while retaining the same task/context IDs. The no-package model teaches the same idea; this optional lab actually crosses the HTTP boundary.

    OBSERVED SDK TASK: SendMessage · input-required · artifacts 0

  3. 03
    Complete and accept

    The clarify case follows up with P-17. The SDK returns and stores a completed task with one data artifact. GetTask reads it back. The client accepts the exact source and date, after checking the task and context identities.

    OBSERVED FIXTURE CONTROL: Completed · source P-17 · client accepts

  4. 04
    Complete but hold

    The independent held-artifact case returns P-99 for the same P-17 request. All HTTP requests still succeed and the SDK task remains completed. The client's source check holds the artifact. Changing the check to trust completed would erase the very failure the learner needs to see.

    OBSERVED MISMATCH CONTROL: Completed · source P-99 · client holds

Read the connections in plain English
  1. 01
    Requesting program → SDK over HTTP

    First GET the agent card; then let the SDK construct SendMessage requests.

  2. 02
    SDK over HTTP → Scripted specialist

    The SDK handler routes the message into our scripted executor.

  3. 03
    Scripted specialist → SDK task store

    The executor reports missing input or supplies an artifact and completes work.

  4. 04
    SDK task store → Structured artifact

    GetTask reads the stored task and its artifact after completion.

  5. 05
    Structured artifact → Client acceptance

    Compare the structured output with the requested synthetic source.

  6. 06
    Client acceptance → Requesting program

    Preserve both the reported task status and the client's decision.

Check your understanding: Does a 200 response and a completed task prove the artifact is usable?

No. Those observations establish successful communication and the reported task state in this run. The client's request-specific acceptance rule must still check the output. This lab leaves authentication, durable recovery, concurrency and model quality untested.

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.

After the local SDK comparison, use our shared delegation exercise to add aggregate attempt limits, deadlines and late-result handling. The protected agent-to-agent lesson adds Explain, Debug and Design rehearsals before 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. Task lifecycle and SDK references rechecked 2026-10-25; the remaining introductory references were 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.

For the optional implementation, see the pinned SDK release, current server setup and SDK 1.0 migration guide, checked 2026-10-25. The visual summarizes this original lab's observed output; it is not an external certification or claim of complete protocol conformance.

Before you move on

Keep the evidence of your work.

  • Four predictions compared with actual local task records.
  • Two changed-copy results separating task identity from artifact acceptance.
  • An SDK request report separating completed tasks from accepted artifacts.

Keep these in your own working copy. Reading this page does not save work or record completion.

Suggested next free session

Build and test a bounded AI agent

Add shared budgets, deadlines and late-result handling to the handoff you can now explain. This is a suggested sequence; choose the practice that addresses your current gap.

Open the next free guide

Free account

Give your practice a home.

Try a role exercise with account drafts and a downloadable worksheet. Keep the files you made in this guide in your own working copy.

Create a free learning account

Guided training · by application

Build toward a program.

Request structured lessons and a training seat. Scope, schedule, feedback arrangements and tuition are confirmed in writing before you commit.

Explore a training application
Have Academy access?

Use your existing training seat to open worked explanations and practice in the related lesson. Creating a free account does not grant a seat.

Open the related Academy lesson →
Back to top ↑