Articles

A2A Inspector Tutorial: Validate Agent Cards and Debug Tasks

Install the A2A Inspector from its Go release, validate agent cards, and debug A2A tasks that stall, stream with no final event, or fail behind an HTTP 200.

· 14 min read
a2a-inspector a2a-protocol agent-card ai-agent-debugging multi-agent-systems traceai opentelemetry
Banner with the title on the left and, on the right, a response card reading HTTP 200 and No problems with its corner peeled back to reveal TASK_STATE_FAILED and upstream order service timed out.

You deploy an order-lookup agent on the A2A protocol. A caller agent asks about order A-1, gets HTTP 200 back and reports the order as handled. Inside that response the task state says failed, because the upstream order service timed out. Nothing in the HTTP layer said so.

The A2A Inspector is the A2A project’s own web tool for debugging A2A agents: it validates an agent’s card and shows every task, stream event and wire exchange. It also shows where its checks stop, because a well-formed response can still carry failed work.

This tutorial runs A2A Inspector v1.0.0-alpha.2, a prerelease, against seven local fixture agents on 2026-11-18, and every screen and timing below comes from that session. The scripts are tested end to end. The findings then become four scripted checks, and Future AGI traceAI follows the failed task into the agent.

TL;DR

  • Install the A2A Inspector with go install at the v1.0.0-alpha.2 prerelease tag and start it with -a pointed at your agent; it opens your browser at a tokenized URL unless you pass —no-open, as we did.
  • The card check found 2 errors and 5 warnings on a broken card, and passed a valid card whose interface pointed at a port where nothing listened.
  • A task left in working, a stream that closed without a final status, and a failed task all came back as HTTP 200 with No problems on the response.
  • Four scripted checks with the a2a-sdk 1.3.1 client catch each failure outside the UI and print a PASS or FAIL matrix you can run in CI.
  • Future AGI traceAI-a2a 0.1.1 marks the failed task as an ERROR span and links the agent’s tool span into the caller’s trace.

Install the A2A Inspector from its GitHub repo at a pinned tag

The A2A Inspector is a single Go binary with its web UI built in. Install it with go install at a release tag, then check the version it prints. This A2A Inspector tutorial pins v1.0.0-alpha.2, a prerelease published on 2026-11-16, so every screen and finding below matches that build.

The tool became a Go binary in v0.2.0 (2026-10-27), still the newest non-prerelease as of 2026-11-18 in the A2A Inspector repository, so guides that run uv sync and npm install describe an older build. It needs Go 1.26.10 or later; see the Go installation guide.

go install github.com/a2aproject/a2a-inspector@v1.0.0-alpha.2
a2a-inspector --version
a2a-inspector 1.0.0-alpha.2
commit:  none
built:   unknown
go:      go1.27.4
os/arch: darwin/arm64

Commit reads none and built reads unknown because the release pipeline stamps both through linker flags, which go install skips. The go and os/arch lines describe your own machine, so compare only the version line with the v1.0.0-alpha.2 release page.

a2a-inspector --no-open --port 18280 -a 127.0.0.1:19201
A2A Inspector is running at http://127.0.0.1:18280/?token=<per-run token>
Press Ctrl+C to stop.
  1. Start it with -a and your agent’s host and port. It listens on 127.0.0.1, port 8080 by default, and —no-open skips the browser.
  2. Open the printed URL. Its token becomes the cookie a2a_inspector_18280, httpOnly and SameSite Strict; the bare address showed “No session”.
  3. Add more agents in the Agent card URL field, which takes a host or the full card URL.

The A2A Inspector No session page, shown when the bare address is opened without the per-run token

Docker, release binaries and the a2a CLI plugin

The README also documents a container, docker run --rm -p 127.0.0.1:8080:8080 ghcr.io/a2aproject/a2a-inspector, release archives for macOS, Linux and Windows with a checksums.txt file, and an a2a inspector command in the a2a CLI. This session used the go install build only.

What the A2A Inspector checks on an agent card

The A2A Inspector fetches the card from /.well-known/agent-card.json, detects whether it is a v1.0 or v0.3 card, and validates it against that version’s schema plus semantic rules. Each finding names a JSON path, a rule and a severity: an error breaks a MUST, and a warning flags a SHOULD or something clients may trip over.

The agent card validator returned ERROR required for each of the healthy card’s eight top-level fields and every skill and interface subfield, removed one at a time. v0.3 cards are checked against the spec’s JSON Schema, and v1.0 cards against one generated from a2a.proto. Findings also have an INFO level for notes.

without name                               -> ['ERROR required name']
without description                        -> ['ERROR required description']
without version                            -> ['ERROR required version']
without supportedInterfaces                -> ['ERROR required supportedInterfaces']
without capabilities                       -> ['ERROR required capabilities']
without defaultInputModes                  -> ['ERROR required defaultInputModes']
without defaultOutputModes                 -> ['ERROR required defaultOutputModes']
without skills                             -> ['ERROR required skills']
without skills[0].id                       -> ['ERROR required skills[0].id']
without skills[0].name                     -> ['ERROR required skills[0].name']
without skills[0].description              -> ['ERROR required skills[0].description']
without skills[0].tags                     -> ['ERROR required skills[0].tags']
without supportedInterfaces[0].url         -> ['ERROR required supportedInterfaces[0].url']
without supportedInterfaces[0].protocolBinding -> ['ERROR required supportedInterfaces[0].protocolBinding', 'WARNING no-supported-interface']
without supportedInterfaces[0].protocolVersion -> ['ERROR required supportedInterfaces[0].protocolVersion', 'WARNING no-supported-interface']
unchanged healthy card                    -> no finding

The card location comes from section 8.2 of the A2A Protocol v1.0 specification.

For the protocol itself, see how to build an A2A agent in Python and read its agent card.

The A2A Inspector Validation tab for the healthy fixture agent, reading Card checked against the v1.0 specification with no problems

Version detection between v1.0 and v0.3 cards

The healthy card was listed as “v1.0 · No problems”, its interface declared in supportedInterfaces[0]. The v0.3 fixture was listed as “v0.3 · No problems”, its JSONRPC 0.3 interface read from the top-level url field, and its Validation tab said “Card checked against the v0.3 specification: no problems.”

A broken card, finding by finding

The bad-card fixture carries six defects in its JSON (BAD_CARD in agents.py below) and is served as text/plain. On 2026-11-18 the agent list read “v1.0 · 2 errors, 5 warnings”, yet findings do not block a session: the Chat tab still offered Send to “JSONRPC 1.0 /rpc”.

SeverityJSON pathRuleFinding text as shownWhat a caller hits
ErrorsupportedInterfaces[0].urlinterface-url”/rpc” isn’t an absolute URL.No address to call
ErrorversionrequiredRequired field “version” is missing. A string, for example “version”: “1.0.0”.Strict clients reject the card
Warningnone showncontent-typeThe card was served as “text/plain; charset=utf-8”. Serve it as application/json.Type-checking clients refuse it
WarningdefaultInputModes[0]media-type”text” isn’t a media type, such as “text/plain” or “application/json”.Input negotiation fails
WarningsecurityRequirements[0].schemes.apiKeysecurity-schemeRequires security scheme “apiKey”, which isn’t in securitySchemes.Callers cannot build the auth
Warningskills[1].idduplicate-skillSkill id “lookup” is also used by skills[0].Skill routing is ambiguous
WarningsupportedInterfaces[0].protocolBindingprotocol-bindingCore binding names are upper case: use “JSONRPC”.Binding match fails

The A2A Inspector Validation tab for the bad-card fixture, listing 2 errors and 5 warnings, each with its severity, rule name and message

A valid card that points at a dead port

The dead-port fixture on port 19209 served a valid card whose interface named 127.0.0.1:19208, a port with no listener. It passed validation, yet the first send failed with “dial tcp 127.0.0.1:19208: connect: connection refused” and a Traffic row of failed, POST / and 0 ms. Only a send exposed the dead port.

A healthy session from send to cancel

Before breaking anything, run one clean session against the healthy echo agent (agents.py, next section). Send a streamed message, then a blocking one, look the task up on the Tasks tab, try to cancel a finished task, and read the same calls on the Traffic tab. This baseline is what each failure later departs from.

Cancel task on the completed blocking task returned TaskNotCancelableError, code -32002, “Task cannot be canceled”, as sent by the agent. The spec defines that error for a task no longer cancelable, such as one already completed, so this is the right answer here.

Streaming and blocking sends on the Chat tab

With Stream ticked, “hello from the tutorial” produced four events marked No problems: Task submitted at 21 ms, Status update working at 31 ms, Artifact update “echo: hello from the tutorial” at 412 ms and Status update completed at 615 ms. Unticked, one Task came back completed in 606 ms. Each event carries Raw JSON and Wire traffic links.

The A2A Inspector Chat tab for the healthy fixture agent, showing a streamed message with submitted, working, artifact and completed events, each marked No problems

Traffic, edit and resend

Traffic lists exchanges newest first: both 200 and POST /, the blocking call at 606 ms and the stream at 614 ms with 4 events. Expanded rows show request, response and headers. Edit and resend returned “echo: resent with edited body”, and malformed JSON returned JSONParseError, code -32700, noting “The inspector doesn’t know this operation, so it doesn’t check the answer.”

The A2A Inspector Traffic tab for the healthy fixture agent, listing two exchanges with status 200, one at 606 ms and one at 614 ms with 4 events

The A2A Inspector Traffic tab for the healthy fixture agent with Edit and resend open, the edited body reading resent with edited body and a completed Resent task below it

Three task failures the A2A Inspector reports as no problems

Validation in the A2A Inspector checks the shape of each response. It never asks whether the work finished. Our three faulty agents returned well-formed payloads, so every response read No problems and every Traffic entry read 200. The failures show only in the task state, which you have to read yourself on the Chat and Tasks tabs.

The fixtures run on the a2a-sdk 1.3.1 server API, uploaded to PyPI on 2026-11-17, with no LLM behind them. They are synthetic: requirements.txt pins the packages, and agents.py below holds every fixture, each a Starlette app on its own fixed port.

# Agents, checks and tracing demo (Python 3.12). Versions checked on PyPI 2026-11-18.
a2a-sdk[http-server]==1.3.1
uvicorn==0.54.0
traceAI-a2a==0.1.1
"""Local A2A agents for the Inspector tutorial. Synthetic fixtures, no LLM.

One healthy echo agent plus faulty variants. Each variant is one Starlette app on
127.0.0.1, built with the a2a-sdk server API (pinned in requirements.txt).

    python agents.py healthy      # serves on its fixed port
    python agents.py --list       # variant -> port
"""
import asyncio
import json
import sys

import uvicorn
from starlette.applications import Starlette
from starlette.responses import Response
from starlette.routing import Route

from a2a.helpers import new_task_from_user_message, new_text_part
from a2a.server.agent_execution import AgentExecutor, RequestContext
from a2a.server.events import EventQueue
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.routes import create_agent_card_routes, create_jsonrpc_routes
from a2a.server.tasks import InMemoryTaskStore, TaskUpdater
from a2a.types import AgentCapabilities, AgentCard, AgentInterface, AgentSkill, TaskState

PORTS = {
    "healthy": 19201,
    "bad-card": 19202,
    "stuck": 19203,
    "no-final": 19204,
    "failed200": 19205,
    "v03-card": 19206,
    "traced": 19207,  # used by trace_failed_task.py
    "dead-port": 19209,  # serves a valid card whose interface URL points at DEAD_PORT, where nothing listens
}
DEAD_PORT = 19208
HOST = "127.0.0.1"


def user_text(context: RequestContext) -> str:
    return context.get_user_input() if hasattr(context, "get_user_input") else ""


class Base(AgentExecutor):
    """Enqueues the Task first (the SDK requires it for a new task), then runs steps()."""

    async def execute(self, context: RequestContext, event_queue: EventQueue) -> None:
        task = context.current_task or new_task_from_user_message(context.message)
        if not context.current_task:
            await event_queue.enqueue_event(task)
        up = TaskUpdater(event_queue=event_queue, task_id=task.id, context_id=task.context_id)
        await self.steps(up, user_text(context))

    async def steps(self, up: TaskUpdater, text: str) -> None:
        raise NotImplementedError("wire the variant's steps here")

    async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None:
        task = context.current_task
        await TaskUpdater(event_queue, task.id, task.context_id).cancel()


class Healthy(Base):
    """submitted -> working -> artifact -> completed."""

    async def steps(self, up, text):
        await up.start_work()
        await asyncio.sleep(0.4)
        await up.add_artifact([new_text_part(f"echo: {text}")], name="echo", last_chunk=True)
        await asyncio.sleep(0.2)
        await up.complete()


class Stuck(Base):
    """Moves to working, then the executor returns and never sets a terminal state."""

    async def steps(self, up, text):
        await up.start_work()


class NoFinal(Base):
    """Working status plus a partial artifact chunk, then the stream just ends."""

    async def steps(self, up, text):
        await up.start_work()
        await asyncio.sleep(0.2)
        await up.add_artifact([new_text_part("partial: order A-1")], name="partial", last_chunk=False)


class Failed200(Base):
    """Fails the task. The HTTP response is still 200 because the failure is task state."""

    async def steps(self, up, text):
        await up.start_work()
        msg = up.new_agent_message([new_text_part("upstream order service timed out (synthetic)")])
        await up.failed(msg)


EXECUTORS = {"healthy": Healthy, "stuck": Stuck, "no-final": NoFinal, "failed200": Failed200, "traced": Failed200}


def good_card(port: int, name: str) -> AgentCard:
    return AgentCard(
        name=name,
        description="Synthetic fixture agent for the A2A Inspector tutorial. No LLM.",
        version="0.1.0",
        default_input_modes=["text/plain"],
        default_output_modes=["text/plain"],
        capabilities=AgentCapabilities(streaming=True),
        supported_interfaces=[
            AgentInterface(protocol_binding="JSONRPC", url=f"http://{HOST}:{port}", protocol_version="1.0")
        ],
        skills=[AgentSkill(id="echo", name="Echo", description="Repeats the message.", tags=["demo"])],
    )


# Raw cards: served as plain JSON so they can be wrong in ways the SDK model refuses to build.
BAD_CARD = {
    "name": "Order Lookup (bad card fixture)",
    "description": "Synthetic fixture: a card with several defects.",
    # no "version" (required)
    "supportedInterfaces": [{"url": "/rpc", "protocolBinding": "jsonrpc", "protocolVersion": "1.0"}],
    "capabilities": {"streaming": True},
    "defaultInputModes": ["text"],
    "defaultOutputModes": ["text/plain"],
    "skills": [
        {"id": "lookup", "name": "Lookup", "description": "Find an order.", "tags": ["orders"]},
        {"id": "lookup", "name": "Lookup again", "description": "Find an order.", "tags": ["orders"]},
    ],
    "securityRequirements": [{"schemes": {"apiKey": {"list": []}}}],
}


def v03_card(port: int) -> dict:
    return {
        "name": "Legacy v0.3 agent (card only fixture)",
        "description": "Synthetic fixture: a v0.3 card. No message route behind it.",
        "url": f"http://{HOST}:{port}/",
        "version": "0.1.0",
        "protocolVersion": "0.3.0",
        "preferredTransport": "JSONRPC",
        "capabilities": {"streaming": False},
        "defaultInputModes": ["text/plain"],
        "defaultOutputModes": ["text/plain"],
        "skills": [{"id": "echo", "name": "Echo", "description": "Repeats the message.", "tags": ["demo"]}],
    }


def dead_port_card(port: int) -> dict:
    card = good_card(port, "dead-port agent")
    from google.protobuf.json_format import MessageToDict

    d = MessageToDict(card)
    d["supportedInterfaces"][0]["url"] = f"http://{HOST}:{DEAD_PORT}"
    return d


def raw_card_app(card: dict, content_type: str) -> Starlette:
    async def serve(request):
        return Response(json.dumps(card), media_type=content_type)

    return Starlette(routes=[Route("/.well-known/agent-card.json", serve)])


def build_app(variant: str, tracer_provider=None):
    port = PORTS[variant]
    if variant == "bad-card":
        return raw_card_app(BAD_CARD, "text/plain")
    if variant == "v03-card":
        return raw_card_app(v03_card(port), "application/json")
    if variant == "dead-port":
        return raw_card_app(dead_port_card(port), "application/json")
    card = good_card(port, f"{variant} agent")
    executor = EXECUTORS[variant]()
    if variant == "traced":
        executor = TracedFailed200(tracer_provider)
    handler = DefaultRequestHandler(agent_executor=executor, task_store=InMemoryTaskStore(), agent_card=card)
    app = Starlette(routes=create_agent_card_routes(card) + create_jsonrpc_routes(handler, "/"))
    if tracer_provider is not None:
        from traceai_a2a import A2ATracingMiddleware

        app = A2ATracingMiddleware(app, tracer_provider=tracer_provider, agent_url=f"http://{HOST}:{port}")
    return app


class TracedFailed200(Failed200):
    """Failed200 plus one TOOL span, the stand-in for an agent's tool call (there is no LLM here)."""

    def __init__(self, tracer_provider):
        self.tracer = tracer_provider.get_tracer(__name__)

    async def steps(self, up, text):
        from fi_instrumentation.fi_types import FiSpanKindValues, SpanAttributes

        with self.tracer.start_as_current_span("tool.lookup_order") as span:
            span.set_attribute(SpanAttributes.GEN_AI_SPAN_KIND, FiSpanKindValues.TOOL.value)
            span.set_attribute("order.id", "A-1")
        await super().steps(up, text)


def jsonl_provider():
    """Tracer provider whose finished spans are printed to stdout, one JSON object per line."""
    from opentelemetry.sdk.trace import TracerProvider
    from opentelemetry.sdk.trace.export import SimpleSpanProcessor, SpanExporter, SpanExportResult

    class JsonLines(SpanExporter):
        def export(self, spans):
            for s in spans:
                print(json.dumps({
                    "name": s.name, "kind": s.kind.name, "status": s.status.status_code.name,
                    "trace": f"{s.context.trace_id:032x}", "span": f"{s.context.span_id:016x}",
                    "parent": f"{s.parent.span_id:016x}" if s.parent else None,
                    "attributes": dict(s.attributes),
                }), flush=True)
            return SpanExportResult.SUCCESS

    p = TracerProvider()
    p.add_span_processor(SimpleSpanProcessor(JsonLines()))
    return p


if __name__ == "__main__":
    if sys.argv[1:] == ["--list"]:
        print(json.dumps(PORTS, indent=2))
        sys.exit(0)
    name = sys.argv[1]
    tp = jsonl_provider() if name == "traced" else None
    uvicorn.run(build_app(name, tp), host=HOST, port=PORTS[name], log_level="warning")

A task left in working

The Stuck executor moves the task to working and returns. A blocking send came back after 13 ms as Task “working” with No problems, and its Traffic row read 200, POST / and 12 ms. The raw response carried “TASK_STATE_WORKING” inside an ordinary result object.

The A2A Inspector Chat tab for the stuck fixture agent, where a blocking send returned a Task in the working state marked No problems after 13 ms

The spec says a blocking SendMessage MUST wait until the task reaches a terminal or interrupted state (section 3.2.2). Nothing flagged it, because a working task is well-formed and the validator checks form. On the Tasks tab, Get task returned working again, and Cancel task moved the streamed task to canceled while the blocking one stayed working.

The A2A Inspector Tasks tab for the stuck fixture agent after Cancel task, with the streamed task now canceled and the earlier Get task result still showing working

A stream that ends without a final status event

In NoFinal, the executor emits working plus an artifact chunk, “partial: order A-1”, then returns. The stream showed Task submitted, Status update working and an Artifact update, then closed after 3 events, and Traffic read 200, POST / and 203 ms.

The A2A Inspector Chat tab for the no-final fixture agent, where the streamed send shows submitted, working and a partial order A-1 artifact, then nothing after it

The spec says a task stream MUST close when the task reaches a terminal state (section 3.1.2), so closing on working is the agent’s bug. No warning appeared: once any event arrives, the Inspector treats a stream that closes without error as done. The Tasks tab still listed both tasks as working.

An HTTP 200 whose task state is failed

Failed200 sets the task to failed with the message “upstream order service timed out (synthetic)”. The blocking send showed Task “failed” beside No problems, and its Traffic row read 200, POST / and 8 ms. In the raw response, “state”: “TASK_STATE_FAILED” sat inside a normal result object, with no JSON-RPC error.

The A2A Inspector Chat tab for the failed200 fixture agent, where a blocking send shows a failed chip beside a No problems chip and the message upstream order service timed out

The stream showed the same over 3 events: submitted, working and failed. A2A reports protocol problems as error objects (section 3.3.2) and outcomes as task state, so a failed task is a valid response. A caller that reads only the HTTP status records this order lookup as handled.

Matrix of four fixture agents: Traffic shows 200 and Validation shows No problems for all four, while task state reads completed, working, working and failed

Turning Inspector findings into protocol checks

The A2A Inspector is a tool you click through, so a finding there is not checked again on the next deploy. Write each finding as a check with the a2a-sdk client: selected v1.0 card checks, a blocking call that settles, a task that completes, and a stream that ends on a settled state. Run them on every build.

checks.py below pairs the a2a-sdk 1.3.1 client with httpx and prints one PASS, FAIL or SKIP line per check. For spec coverage beyond its four checks, the A2A Technology Compatibility Kit runs conformance tests against a live agent at must, should and may levels.

Whether one agent handed work to another well is a separate question, covered in scoring agent handoffs.

"""Protocol checks for an A2A server, outside the Inspector (a2a-sdk client + httpx).

Each check is the repeatable form of something the Inspector showed by eye:

    card_valid             selected v1.0 card smoke checks, not full schema validation
    blocking_settles       a blocking SendMessage returns a terminal or interrupted task (spec 3.2.2)
    task_succeeded         the task the agent returned is COMPLETED (HTTP 200 alone proves nothing)
    stream_ends_settled    a streamed send ends on a terminal or interrupted status (spec 3.1.2)

Usage: python checks.py            # runs the matrix against the local agents and self-checks it
       python checks.py <port>     # one agent, exit 1 when any check fails or is skipped
"""
import asyncio
import sys
from urllib.parse import urlparse

import httpx

from a2a.client import A2ACardResolver, ClientConfig, create_client
from a2a.helpers import new_text_message
from a2a.types import Role, SendMessageRequest, TaskState

from agents import HOST, PORTS

TERMINAL = {
    TaskState.TASK_STATE_COMPLETED,
    TaskState.TASK_STATE_FAILED,
    TaskState.TASK_STATE_CANCELED,
    TaskState.TASK_STATE_REJECTED,
}
SETTLED = TERMINAL | {TaskState.TASK_STATE_INPUT_REQUIRED, TaskState.TASK_STATE_AUTH_REQUIRED}
# Required card fields: the Inspector's own validator returned "ERROR required" for each one when it was removed
# from the healthy card (the probe output in the agent card section above).
REQUIRED = ["name", "description", "version", "supportedInterfaces", "capabilities", "defaultInputModes", "defaultOutputModes", "skills"]
REQUIRED_SKILL = ["id", "name", "description", "tags"]
BINDINGS = {"JSONRPC", "GRPC", "HTTP+JSON"}


def name(state) -> str:
    return TaskState.Name(state)


def card_problems(card: dict, content_type: str) -> list[str]:
    out = [f"missing required field {k!r}" for k in REQUIRED if k not in card]
    if "json" not in content_type:
        out.append(f"card served as {content_type!r}, not JSON")
    interfaces = card.get("supportedInterfaces", [])
    if not interfaces:
        out.append("supportedInterfaces must contain at least one interface")
    for i, iface in enumerate(interfaces):
        for k in ("url", "protocolBinding", "protocolVersion"):
            if not iface.get(k):
                out.append(f"supportedInterfaces[{i}] missing {k!r}")
        u = urlparse(iface.get("url", ""))
        if not (u.scheme in ("http", "https") and u.netloc):
            out.append(f"supportedInterfaces[{i}].url {iface.get('url')!r} is not an absolute URL")
        if iface.get("protocolBinding") not in BINDINGS:
            out.append(f"supportedInterfaces[{i}].protocolBinding {iface.get('protocolBinding')!r} is not one of {sorted(BINDINGS)}")
    for i, sk in enumerate(card.get("skills", [])):
        out += [f"skills[{i}] missing {k!r}" for k in REQUIRED_SKILL if k not in sk]
    ids = [s.get("id") for s in card.get("skills", [])]
    if len(ids) != len(set(ids)):
        out.append(f"duplicate skill ids {ids}")
    for k in ("defaultInputModes", "defaultOutputModes"):
        out += [f"{k} entry {m!r} is not a media type (type/subtype)" for m in card.get(k, []) if "/" not in m]
    declared = set(card.get("securitySchemes", {}))
    for i, req in enumerate(card.get("securityRequirements", [])):
        out += [f"securityRequirements[{i}] names undeclared scheme {n!r}" for n in req.get("schemes", {}) if n not in declared]
    return out


async def send(base: str, streaming: bool, timeout: float = 8.0):
    """Returns (states, message-only reply); states=None means streaming is unsupported."""
    async with httpx.AsyncClient(timeout=timeout) as http:
        card = await A2ACardResolver(httpx_client=http, base_url=base).get_agent_card()
        if streaming and not card.capabilities.streaming:
            return None, False  # the SDK would otherwise fall back to a unary send
        client = await create_client(agent=card, client_config=ClientConfig(httpx_client=http, streaming=streaming))
        states, message_only = [], False
        try:
            req = SendMessageRequest(message=new_text_message("check the order", role=Role.ROLE_USER))
            async for ev in client.send_message(req):
                if ev.HasField("task"):
                    states.append(ev.task.status.state)
                elif ev.HasField("status_update"):
                    states.append(ev.status_update.status.state)
                elif ev.HasField("message"):
                    message_only = True
        finally:
            await client.close()
        return states, message_only


async def run_checks(port: int) -> dict[str, tuple[bool | None, str]]:
    """check -> (True pass | False fail | None skipped, detail)."""
    base = f"http://{HOST}:{port}"
    results: dict[str, tuple[bool | None, str]] = {}
    async with httpx.AsyncClient(timeout=5) as http:
        r = await http.get(f"{base}/.well-known/agent-card.json")
    problems = card_problems(r.json(), r.headers.get("content-type", ""))
    results["card_valid"] = (not problems, "; ".join(problems) or "ok")
    if problems:
        for k in ("blocking_settles", "task_succeeded", "stream_ends_settled"):
            results[k] = (None, "not run: card invalid")
        return results

    try:
        states, msg_only = await send(base, streaming=False)
    except Exception as e:  # a dead endpoint, a refused call: report it as a failed check, not a crash
        why = f"send raised {type(e).__name__}: {str(e)[:80]}"
        return {**results, "blocking_settles": (False, why), "task_succeeded": (False, why), "stream_ends_settled": (False, "not run: first send failed")}
    last = states[-1] if states else None
    results["blocking_settles"] = (msg_only or last in SETTLED, f"last state {name(last) if last is not None else 'none'}")
    results["task_succeeded"] = (msg_only or last == TaskState.TASK_STATE_COMPLETED, f"last state {name(last) if last is not None else 'none'}")

    states, msg_only = await send(base, streaming=True)
    if states is None:
        results["stream_ends_settled"] = (None, "not run: streaming not advertised")
        return results
    last = states[-1] if states else None
    seen = " > ".join(name(s).removeprefix("TASK_STATE_") for s in states)
    results["stream_ends_settled"] = (msg_only or last in SETTLED, f"stream states: {seen or 'none'}")
    return results


# Expected matrix: which check each faulty agent must trip. A fixture that stops tripping its check, or a
# healthy agent that starts failing or skipping one, makes this script exit non-zero.
EXPECTED_FAIL = {
    "healthy": set(),
    "bad-card": {"card_valid"},  # the other three are skipped, not failed
    "dead-port": {"blocking_settles", "task_succeeded", "stream_ends_settled"},
    "stuck": {"blocking_settles", "task_succeeded", "stream_ends_settled"},
    "no-final": {"blocking_settles", "task_succeeded", "stream_ends_settled"},
    "failed200": {"task_succeeded"},
}
EXPECTED_SKIP = {
    "bad-card": {"blocking_settles", "task_succeeded", "stream_ends_settled"},
}


async def main() -> int:
    if len(sys.argv) > 1:
        res = await run_checks(int(sys.argv[1]))
        for k, (ok, why) in res.items():
            print(f"{'SKIP' if ok is None else 'PASS' if ok else 'FAIL'}  {k:20s} {why}")
        return 0 if all(ok is True for ok, _ in res.values()) else 1
    bad = 0
    for variant, expected in EXPECTED_FAIL.items():
        res = await run_checks(PORTS[variant])
        print(f"\n== {variant} (port {PORTS[variant]})")
        for k, (ok, why) in res.items():
            print(f"{'SKIP' if ok is None else 'PASS' if ok else 'FAIL'}  {k:20s} {why}")
        failed = {k for k, (ok, _) in res.items() if ok is False}
        skipped = {k for k, (ok, _) in res.items() if ok is None}
        expected_skips = EXPECTED_SKIP.get(variant, set())
        if failed != expected or skipped != expected_skips:
            bad += 1
            print(f"UNEXPECTED: failed {sorted(failed)}, expected {sorted(expected)}; "
                  f"skipped {sorted(skipped)}, expected {sorted(expected_skips)}")
    print("\nmatrix matches expectations" if not bad else f"\n{bad} agent(s) off expectation")
    return 1 if bad else 0


if __name__ == "__main__":
    sys.exit(asyncio.run(main()))

Four checks and the matrix they printed

== healthy (port 19201)
PASS  card_valid           ok
PASS  blocking_settles     last state TASK_STATE_COMPLETED
PASS  task_succeeded       last state TASK_STATE_COMPLETED
PASS  stream_ends_settled  stream states: SUBMITTED > WORKING > COMPLETED

== bad-card (port 19202)
FAIL  card_valid           missing required field 'version'; card served as 'text/plain; charset=utf-8', not JSON; supportedInterfaces[0].url '/rpc' is not an absolute URL; supportedInterfaces[0].protocolBinding 'jsonrpc' is not one of ['GRPC', 'HTTP+JSON', 'JSONRPC']; duplicate skill ids ['lookup', 'lookup']; defaultInputModes entry 'text' is not a media type (type/subtype); securityRequirements[0] names undeclared scheme 'apiKey'
SKIP  blocking_settles     not run: card invalid
SKIP  task_succeeded       not run: card invalid
SKIP  stream_ends_settled  not run: card invalid

== dead-port (port 19209)
PASS  card_valid           ok
FAIL  blocking_settles     send raised A2AClientError: Network communication error: All connection attempts failed
FAIL  task_succeeded       send raised A2AClientError: Network communication error: All connection attempts failed
FAIL  stream_ends_settled  not run: first send failed

== stuck (port 19203)
PASS  card_valid           ok
FAIL  blocking_settles     last state TASK_STATE_WORKING
FAIL  task_succeeded       last state TASK_STATE_WORKING
FAIL  stream_ends_settled  stream states: SUBMITTED > WORKING

== no-final (port 19204)
PASS  card_valid           ok
FAIL  blocking_settles     last state TASK_STATE_WORKING
FAIL  task_succeeded       last state TASK_STATE_WORKING
FAIL  stream_ends_settled  stream states: SUBMITTED > WORKING

== failed200 (port 19205)
PASS  card_valid           ok
PASS  blocking_settles     last state TASK_STATE_FAILED
FAIL  task_succeeded       last state TASK_STATE_FAILED
PASS  stream_ends_settled  stream states: SUBMITTED > WORKING > FAILED

matrix matches expectations

card_valid is a smoke check, not full schema validation; settled means terminal or interrupted. The 2026-11-18 run ended with “matrix matches expectations”: the bad card failed card_valid and skipped the rest as “not run: card invalid”, and stuck and no-final tripped the same three checks.

The Inspector tells those two apart: Get task still working for the stuck agent, a stream closed after a partial artifact for no-final. Only task_succeeded catches failed200, because failed is a terminal state, so both settle checks pass on it.

Fixture agentWhat the Chat or Tasks tab showedHTTP status in TrafficChecks that failed
bad-card”2 errors, 5 warnings” on the cardNo send madecard_valid, others skipped
dead-port”No problems”, then “connection refused”failed, no statusblocking_settles, task_succeeded, stream_ends_settled
stuckTask “working”, still “working” on Get200blocking_settles, task_succeeded, stream_ends_settled
no-finalStream closed after “partial: order A-1”, last status “working”200blocking_settles, task_succeeded, stream_ends_settled
failed200Task “failed” with “No problems”200task_succeeded only

Pointing the checks at your own agent

$ python ./checks.py 19205
PASS  card_valid           ok
PASS  blocking_settles     last state TASK_STATE_FAILED
FAIL  task_succeeded       last state TASK_STATE_FAILED
PASS  stream_ends_settled  stream states: SUBMITTED > WORKING > FAILED
[exit 1]

python checks.py PORT checks one agent and exits 1 on any FAIL or SKIP. This CI policy requires streaming support; a nonstreaming agent is not protocol-invalid, but its stream check is SKIP, not PASS.

Under this policy: exit 0 for the healthy agent on 19201, exit 1 for failed200 on 19205. The script reads v1.0 cards only and calls 127.0.0.1, so edit the base URL in run_checks for a remote agent.

If you also run MCP servers, see what the MCP Inspector misses when debugging.

Following a failed A2A task into the agent with Future AGI traceAI

The Inspector shows that a task failed. traceAI shows where inside the agent it failed. traceAI-a2a, Future AGI’s A2A instrumentation built on OpenTelemetry, records the task ID and state on the caller’s span, marks a failed task as ERROR, and carries the trace context into the agent, so the agent’s tool spans join the caller’s trace.

On the caller, A2AInstrumentor().instrument(tracer_provider=provider) runs before the client exists. On the agent, A2ATracingMiddleware wraps the app, as build_app in agents.py shows. trace_failed_task.py drives the traced failed200 variant and is tested end to end.

The source is traceAI A2A instrumentation on GitHub, pinned as traceAI-a2a 0.1.1 on PyPI.

pip install "traceAI-a2a==0.1.1" "fi-instrumentation-otel==1.4.0" "a2a-sdk[http-server]==1.3.1"
"""Follow an HTTP 200 whose task failed into traceAI-a2a spans. Offline: no Future AGI key.

The agent (agents.py "traced": it fails the task after opening one TOOL span, a stand-in for a tool call, no LLM)
runs as its own process and prints its finished spans as JSON lines. The client runs here with an in-memory exporter.
"""
import asyncio
import json
import subprocess
import sys
import time
from pathlib import Path

import httpx
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter

from a2a.client import A2ACardResolver, ClientConfig, create_client
from a2a.helpers import new_text_message
from a2a.types import Role, SendMessageRequest, TaskState
from traceai_a2a import A2AInstrumentor

from agents import HOST, PORTS

HERE = Path(__file__).parent
port = PORTS["traced"]
exporter = InMemorySpanExporter()
provider = TracerProvider()
provider.add_span_processor(SimpleSpanProcessor(exporter))
# Instrument the client only. No global tracer provider is set.
A2AInstrumentor().instrument(tracer_provider=provider)

log = open(HERE / "traced_agent_spans.jsonl", "w")
agent = subprocess.Popen([sys.executable, str(HERE / "agents.py"), "traced"], stdout=log, stderr=subprocess.STDOUT)
try:
    for _ in range(100):
        try:
            httpx.get(f"http://{HOST}:{port}/.well-known/agent-card.json", timeout=1)
            break
        except httpx.HTTPError:
            time.sleep(0.1)

    async def main():
        async with httpx.AsyncClient() as http:
            card = await A2ACardResolver(httpx_client=http, base_url=f"http://{HOST}:{port}").get_agent_card()
            client = await create_client(agent=card, client_config=ClientConfig(httpx_client=http, streaming=False))
            try:
                req = SendMessageRequest(message=new_text_message("check order A-1", role=Role.ROLE_USER))
                async for ev in client.send_message(req):
                    print("client got task state:", TaskState.Name(ev.task.status.state))
            finally:
                await client.close()

    asyncio.run(main())
    time.sleep(0.5)
finally:
    agent.terminate()
    agent.wait(timeout=5)
    log.close()

keep = ("gen_ai.span.kind", "gen_ai.a2a.task.state", "gen_ai.a2a.task.id", "http.response.status_code", "order.id")
rows = []
for s in exporter.get_finished_spans():
    rows.append(("client", {"name": s.name, "kind": s.kind.name, "status": s.status.status_code.name,
                            "trace": f"{s.context.trace_id:032x}", "span": f"{s.context.span_id:016x}",
                            "parent": f"{s.parent.span_id:016x}" if s.parent else None, "attributes": dict(s.attributes)}))
for line in (HERE / "traced_agent_spans.jsonl").read_text().splitlines():
    if line.startswith("{"):
        rows.append(("agent", json.loads(line)))
for side, r in rows:
    print(f"{side:6s} {r['name']:48s} {r['kind']:8s} status={r['status']:5s} trace={r['trace']} span={r['span']} parent={r['parent']}")
    print(f"       attributes: { {k: v for k, v in r['attributes'].items() if k in keep} }")

# Self-check of what the post says about this run.
client_span = next(r for side, r in rows if side == "client" and r["kind"] == "CLIENT" and "send_message" in r["name"])
agent_req = [r for side, r in rows if side == "agent" and r["name"] == "A2AServer.request" and r["parent"]]
tool = next(r for side, r in rows if side == "agent" and r["name"] == "tool.lookup_order")
assert client_span["status"] == "ERROR" and client_span["attributes"]["gen_ai.a2a.task.state"] == "failed"
assert any(r["attributes"].get("http.response.status_code") == 200 and r["status"] == "UNSET" for r in agent_req), "agent span: HTTP 200, status UNSET"
assert any(r["trace"] == client_span["trace"] and r["parent"] == client_span["span"] for r in agent_req), "agent span is a child of the client span"
assert tool["trace"] == client_span["trace"] and tool["parent"] in {r["span"] for r in agent_req}, "tool span sits under the agent span, same trace"
print("\ntrace checks passed: HTTP 200 + failed task = ERROR client span; the agent span and the tool span share the client's trace")
$ python ./trace_failed_task.py
client got task state: TASK_STATE_FAILED
client a2a.client.transports.jsonrpc.JsonRpcTransport.send_message CLIENT   status=ERROR trace=d0f906c0bea0f6ba7271d90ba94a72cb span=d5627c5adb9b73ab parent=None
       attributes: {'gen_ai.span.kind': 'A2A_CLIENT', 'gen_ai.a2a.task.id': 'a9358a7c-7590-405c-94d2-cc7a52cd7cf2', 'gen_ai.a2a.task.state': 'failed'}
client a2a.client.transports.jsonrpc.JsonRpcTransport.close CLIENT   status=OK    trace=e8d3a730d7166817564286f1ed289c3c span=6c11ae8248adab16 parent=None
       attributes: {}
agent  A2AServer.request                                SERVER   status=UNSET trace=718358af78bedac5daf5a3f35f6d9989 span=80ae62d0683a255b parent=None
       attributes: {'gen_ai.span.kind': 'A2A_SERVER', 'http.response.status_code': 200}
agent  A2AServer.request                                SERVER   status=UNSET trace=bb1ac7db845b47f5d7ade7f90a4eb55d span=4c31eef04a933366 parent=None
       attributes: {'gen_ai.span.kind': 'A2A_SERVER', 'http.response.status_code': 200}
agent  tool.lookup_order                                INTERNAL status=UNSET trace=d0f906c0bea0f6ba7271d90ba94a72cb span=733a4088ad0996e8 parent=6091ada43a0e0a24
       attributes: {'gen_ai.span.kind': 'TOOL', 'order.id': 'A-1'}
agent  A2AServer.request                                SERVER   status=UNSET trace=d0f906c0bea0f6ba7271d90ba94a72cb span=6091ada43a0e0a24 parent=d5627c5adb9b73ab
       attributes: {'gen_ai.span.kind': 'A2A_SERVER', 'http.response.status_code': 200}

trace checks passed: HTTP 200 + failed task = ERROR client span; the agent span and the tool span share the client's trace

The client span had status=ERROR and gen_ai.a2a.task.state ‘failed’. The card fetches ran outside the instrumented client, so each made its own A2AServer.request span in a separate trace, and the close call made its own OK span. The Python adapter records task IDs and endpoint origins and keeps message bodies out of its spans.

The tool span is a manual stand-in for a tool call, with SpanAttributes.GEN_AI_SPAN_KIND set to TOOL. A real agent’s LLM spans come from its framework instrumentor, and creating tool spans shows one nested under a tool span.

To stamp the order ID on a span, add attributes and metadata to spans.

Go agents get the same ERROR status on a failed task from traceAI A2A for Go.

Exporting these spans to Future AGI means replacing the in-memory provider with register() and setting FI_API_KEY and FI_SECRET_KEY. register() leaves the global tracer provider alone, so manual spans use provider.get_tracer(name). The calls in register_traceai.py below match fi-instrumentation-otel 1.4.0 and traceAI-a2a 0.1.1.

"""The same instrumentation exporting to Future AGI. not executed: needs FI_API_KEY and FI_SECRET_KEY.

The two lines that differ from trace_failed_task.py are register() and the tracer it returns. The variable names
FI_API_KEY and FI_SECRET_KEY are read by fi_instrumentation (checked in the installed fi-instrumentation-otel 1.4.0).
register() does not set the global provider by default, so spans are made with provider.get_tracer(__name__).
"""
from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from traceai_a2a import A2AInstrumentor

provider = register(project_type=ProjectType.OBSERVE, project_name="a2a-inspector-tutorial")
A2AInstrumentor().instrument(tracer_provider=provider)  # before creating the A2A client
tracer = provider.get_tracer(__name__)  # for any manual tool span inside the agent

Reading the three spans side by side

Read together, the three spans repeat the split from the Inspector. The client span is ERROR with task state failed, while the agent span stays UNSET at HTTP 200, because the middleware sets ERROR for HTTP 500 and above or an exception.

Client send_message span with status ERROR and task state failed, its child A2AServer.request span at HTTP 200 with status UNSET, and the tool.lookup_order span below it, in one trace

Client span d5627c5adb9b73ab is the parent of agent span 6091ada43a0e0a24, which is the parent of tool span 733a4088ad0996e8, all in trace d0f906c0bea0f6ba7271d90ba94a72cb. From the task ID on the client span, you walk down to the tool call that ran before the failure.

Shipping an A2A server other agents can rely on

Back to the order-lookup agent that returned 200 on a failed task. The card now validates, the checks fail the build when a task stays in working, a stream closes early or a task fails, and the trace shows the tool call before the failure. Install the Inspector at a pinned tag and run one session before you publish.

Copy checks.py into CI against a staging copy of your agent, point the Inspector at it, and read the Tasks tab for anything left in working. Then add traceAI-a2a to both sides, so the next failed task arrives with its spans.

Frequently Asked Questions

How to use A2A Inspector?

Install the A2A Inspector with go install at a release tag such as v1.0.0-alpha.2, then run a2a-inspector -a with your agent's host and port. It opens your browser at a URL that carries a per-run token; with --no-open, open the printed URL yourself. The browser trades the token for a session cookie.

Where is the A2A Inspector GitHub repo?

The A2A Inspector GitHub repo is a2aproject/a2a-inspector, an Apache-2.0 tool from the a2aproject GitHub organization that ships one Go binary with its web UI built in. Its releases include archives for macOS, Linux and Windows with a checksums file, and you can also install it with go install at a release tag.

What does an A2A agent card validator check?

An A2A agent card validator checks required fields, interface URLs, binding names, media types, duplicate skill IDs and declared security schemes against the protocol version the card uses. The A2A Inspector reports each finding with a JSON path and a severity. It does not test whether the advertised endpoint answers calls.

Is there an A2A Inspector Docker image?

Yes, the A2A Inspector README documents a container image at ghcr.io/a2aproject/a2a-inspector, with a latest tag built from main and one tag per release. Run it with port 8080 published on 127.0.0.1. Inside the container, reach an agent on your machine at host.docker.internal instead of localhost.

How to test A2A agent?

Test an A2A agent in two layers: the A2A Inspector for interactive sessions and card findings, then scripted checks with the a2a-sdk client. The checks cover selected v1.0 card fields, a blocking call that settles, a completed task and a stream that ends on a settled state. The A2A TCK adds spec conformance tests.
Related Articles
View all