Goal: Let a script or CI job tell how an a2a command failed from the exit code alone, without parsing output.
User story: As a CI or script author, I want exit code 2 for a bad invocation and 1 for a real failure, so that my pipeline can distinguish a wrong call from a failed agent call without parsing text.
Priority: P0 · Area: CLI code
Problem
Invalid flags/arguments and genuine runtime failures both exit with status 1. A caller cannot distinguish "I invoked the tool wrong" from "the tool ran and failed," so shell/CI branching on $? is impossible.
$ a2a send --bogus-flag 'x'
Error: unknown flag: --bogus-flag
$ echo $?
1 # want: 2 (usage error)
Proposed behavior
A small, stable exit-code scheme that reports whether the CLI did its job — not what the agent decided:
| Code |
Meaning |
0 |
Success — the operation was carried out and reported, regardless of the agent's task outcome (a task that ends FAILED/REJECTED or pauses at INPUT_REQUIRED/AUTH_REQUIRED is still exit 0) |
1 |
Failure the CLI owns and no more specific code applies |
2 |
Usage error — invalid arguments, flags, or flag combination |
Optional, reserved for later (fall back to 1 if unimplemented): 3 agent/card unreachable or unresolvable · 4 authentication required/rejected · 5 timeout.
Acceptance criteria
Environment
- CLI version:
a2a version v0.0.0-…1e29dfe94f95+dirty
- OS: Linux x86_64
Notes
Naturally implemented alongside machine-readable error output (companion request) — both live in the top-level Execute()/error-handling path (internal/cli/root.go). The exit code and any reported error code should agree.
Goal: Let a script or CI job tell how an
a2acommand failed from the exit code alone, without parsing output.User story: As a CI or script author, I want exit code 2 for a bad invocation and 1 for a real failure, so that my pipeline can distinguish a wrong call from a failed agent call without parsing text.
Priority: P0 · Area: CLI code
Problem
Invalid flags/arguments and genuine runtime failures both exit with status
1. A caller cannot distinguish "I invoked the tool wrong" from "the tool ran and failed," so shell/CI branching on$?is impossible.Proposed behavior
A small, stable exit-code scheme that reports whether the CLI did its job — not what the agent decided:
0FAILED/REJECTEDor pauses atINPUT_REQUIRED/AUTH_REQUIREDis still exit0)12Optional, reserved for later (fall back to
1if unimplemented):3agent/card unreachable or unresolvable ·4authentication required/rejected ·5timeout.Acceptance criteria
2.0irrespective of the task's outcome.1.Environment
a2a version v0.0.0-…1e29dfe94f95+dirtyNotes
Naturally implemented alongside machine-readable error output (companion request) — both live in the top-level
Execute()/error-handling path (internal/cli/root.go). The exit code and any reported error code should agree.