Skip to content

feat: add elicitations for additive input-required (ADR-002) - #2149

Closed
herczyn wants to merge 2 commits into
a2aproject:dev-1.1from
herczyn:feat-elicitations
Closed

herczyn wants to merge 2 commits into
a2aproject:dev-1.1from
herczyn:feat-elicitations

Conversation

@herczyn

@herczyn herczyn commented Aug 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Split out of #2129 so it can be reviewed on its own merits, per review feedback that the timeline change was bundled with contested extras.

Adds an explicit, additive way to model requests for client input, without overloading the TaskState enum.

  • Elicitation { elicitationId, state, metadata } and ElicitationState (WAITING / BLOCKED / RESOLVED).
  • Task.elicitations — the authoritative, current set.
  • TaskStatus.elicitations — a delta of what was created/changed at that status. Because it rides the status, it is delivered by the existing TaskStatusUpdateEvent and captured in the timeline, so walking the timeline reconstructs elicitation history. No new streaming event type.
  • SendMessageRequest.elicitationId — an optional client hint for which elicitation a message answers.

Why a separate type rather than reusing message ids

A single agent message may raise several elicitations — asking for multiple data points that can be answered separately, where some block progress and others don't. That's not 1:1 with a message, and it's what lets an agent keep working while a non-blocking request is outstanding.

INPUT_REQUIRED mapping

The protocol does not mandate a mapping onto TaskState, and it is not version-conditioned. The expected default (typically an SDK default, so agent authors don't manage the state by hand) is: TASK_STATE_INPUT_REQUIRED while at least one elicitation is BLOCKED; WAITING-only leaves the state as-is (e.g. WORKING). Existing clients reading Task.status.state keep working unchanged; clients reading elicitations additionally see non-blocking requests.

Responding to an elicitation

Resolution stays the agent's responsibility — it decides from content and context what has been satisfied. The elicitationId on SendMessageRequest is a hint only:

  • clients are never required to set it;
  • servers MAY use it, or ignore it and infer from context;
  • servers MUST NOT reject a message solely because it is absent, unknown, or refers to an already-RESOLVED elicitation.

Verification

buf breaking (FILE) clean; api-linter problems: []; protolint clean; markdownlint clean; new spec tables render via the proto_to_table macro. Fully additive — no fields renumbered, no types removed.

Related: #1991, #2084 (ADR-002), #2129

@darrelmiller

Copy link
Copy Markdown
Contributor

We need to make a call as to whether we need this in the v1.1 spec.

herczyn added a commit that referenced this pull request Sep 22, 2026
…(ADR-002) (#2129)

Fixes #1991

## Summary

Implements the coherent task history model from **ADR-002** (#2084,
tracking #1991) in the proto (`specification/a2a.proto`) and the
normative spec prose (`docs/specification.md`), on top of the merged
`generation` field (#1810). **Additive and backward compatible**, and
deliberately **introduces no new wire event**: the timeline reuses the
existing `TaskStatusUpdateEvent` for delivery.

> Elicitations were **split out** of this PR into #2149 following review
feedback, so this change is now scoped to the timeline alone.

## Design (why it's non-breaking)

The `timeline` is a restructuring of the **Task snapshot**, not a new
event on the wire. `TimelineEntry` is a `oneof`:

- `Message message` — client messages recorded in the task.
- `TaskStatus status` — agent status progression (state + the agent's
`message`), delivered by the **existing** `TaskStatusUpdateEvent`.

This matters because a new member of the stream event union is **not**
safely ignorable today: a2a-go, a2a-java and a2a-rs all hard-error on an
unrecognised event (java's `StreamingEventKind` is a `sealed
interface`), a2a-python raises on strict `ParseDict`, and a2a-js /
python-gRPC silently drop it. Reusing an existing event avoids that
entirely.

`TaskStatus.message` is **retained** (not deprecated): the "latest
status message" pollution problem is solved by the timeline retaining
the *full ordered* sequence of statuses rather than just the head.

## What's included

1. **`TimelineEntry`** `{ oneof { Message message; TaskStatus status }
int64 generation }` + `repeated TimelineEntry timeline` on `Task`.
Widens `generation` so appending a timeline entry increments it
(previously only `TaskState` transitions and artifact add/update
counted, so a progress message that doesn't change state wouldn't
advance it).
2. **Artifact interleaving** — `start_generation` / `end_generation` on
`Artifact`, so artifacts are placed relative to timeline entries without
per-chunk events flooding the timeline.
3. **`history` deprecation** — the timeline supersedes it, so
`Task.history` and the three `history_length` params are soft-deprecated
and `timeline_length` added. Deprecated fields stay populated/honored
through v1.x, removed in 2.0.
4. **Spec prose** — Task Timeline Semantics (§3.2.8), artifact
interleaving, the deprecation, the widened generation mutation set, and
a `TimelineEntry` object section.

## Notes for reviewers

- **Fail-open is normative**: clients **MUST** skip a `TimelineEntry`
whose `oneof` kind they don't recognise (its `generation` still counts),
so future entry kinds are additive.
- **Timeline generations are monotonic but not contiguous** — artifact
updates also consume generation numbers, so gaps between entries are
expected.
- Live delivery of *client-message* timeline entries to third-party
subscribers is deferred to the bidirectional work (a new method, where
both parties are 1.1 by construction).
- `Artifact.role` was dropped from this PR and deferred to bidi, per
review.

Related: #2084 (ADR-002), #2149 (elicitations), #1810, #1794
Add Elicitation and ElicitationState (WAITING/BLOCKED/RESOLVED), the
authoritative Task.elicitations set, and a TaskStatus.elicitations delta so
changes ride the existing status update and are captured in the timeline.
Model input-required without changing the TaskState enum; INPUT_REQUIRED maps
to a BLOCKED elicitation as SDK-level guidance, not a protocol requirement.

Also allow a client to reference an elicitation_id on SendMessageRequest as an
optional hint: servers may use it to resolve the request directly, may ignore
it and infer from context, and must not reject a message for omitting it.
…ADR-002)

Move the elicitation reference from SendMessageRequest onto Message and make
it repeated: a single message may answer several elicitations, and carrying it
on the message means the link between an input and the requests it satisfied
is retained in the task timeline instead of being lost with the request.
@herczyn

herczyn commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

agreed in TSC meeting this should rather be handled by an extension for now

@herczyn herczyn closed this Sep 22, 2026
tbickford added a commit to agentkourier/agent-kourier that referenced this pull request Oct 21, 2026
Agent Kourier reads tool approvals in kagent's HITL extension only, on
both dialects, and no framework's own format. The A2A explanation page
gains a section on why: A2A 1.0 defines no approval shape and its
maintainers left it to extensions; frameworks that serve A2A each put
approvals on the wire differently, undeclared, or not at all; kagent's
extension is declared in the card, carries what an approval needs, and
is not tied to one framework. An agent on another framework speaks it
through an adapter. The agent contract and the a2a how-to link to it.

Checked at the source: a2aproject/a2a-python#412 (maintainer comment of
2025-08-28), a2aproject/A2A#2149 (closed by the TSC on 2026-09-22), and
kagent's docs/architecture/human-in-the-loop.md at v1.0.0-alpha16 and its
LangGraph sample's card. The per-framework survey in D47 comes from
reading each framework's A2A server source on 2026-10-20; LangGraph's
server is closed source, so its shape comes from its docs and a
third-party capture.
tbickford added a commit to agentkourier/agent-kourier that referenced this pull request Oct 21, 2026
* fix(config): say toolApprovals does nothing on the a2a dialect

The generic a2a dialect never yields a tool approval, so on a Binding whose
AgentBackend uses it the load warning "any non-bot channel member may
decide" described approvals that are never posted. Such a Binding with
toolApprovals: true now gets a warning that the setting has no effect and
that approverGroups gate nothing, naming the Binding and its AgentBackend.
kagent-v1 Bindings keep the approver-group warning.

* feat(dialect): negotiate kagent's HITL extension on the a2a dialect

The a2a dialect sent no A2A extensions, so kagent paused for a tool
approval with ADK's prose hint alone, which nothing could approve. It now
offers https://kagent.dev/extensions/hitl/v1; a2a-go's activator sends
the header only for a card that lists the URI, so other agents see no
change. A pause whose status message names the extension and carries its
payload is parsed and answered as kagent-v1 does it; anything else is a
text question as before. BuildResponse routes on Interaction.TextReplies,
which only the text path has ever set.

IsTextQuestion now requires the TextReplies mark, so a typed thread reply
never answers a structured free-text question whose prompt invited none.

The config-load warning returns to main's: the approver-groups warning
applies to both dialects, since the card is not known at load.

Spec D46 records the decision and amends D45, 6.3, 7 and 8.4. Docs,
README and an upgrade section with a rollback note follow. A fast-tier
e2e scenario runs S19 over the a2a dialect.

Unverified: no run against real kagent on the a2a dialect (recorded
1.0.0-alpha5 fixtures and the stub agent only); kagent 0.9.x's card has
not been checked for the extension.

* fix(deps): bump certifi to 2026.10.19 for GHSA-6q48-6c7w-9gw2

pip-audit in the echo-agent check fails on certifi 2026.7.22. Recompiled
the echo-agent runtime and dev pins and the docs pins with uv, upgrading
certifi only; the hashes match PyPI's for 2026.10.19.

* fix(dialect): route a2a answers on the extension a pause was read through

Review of the a2a HITL change:

- dialect.Interaction gains Extension, the URI of the extension a pause
  was read through. The a2a dialect sets kagent's HITL extension and
  routes BuildResponse on it, instead of on TextReplies, which also means
  "a typed reply may answer". A later change to which questions take
  typed replies can no longer switch an answer's shape. Rows stored
  before the field have none and were text questions; the interaction ID
  and samePause key ignore the field.
- The upgrade page's rollback note said what the earlier release does
  wrongly. A press on an approval or a choice question is not taken and
  the task is cancelled at the timeout; a free-text answer goes as plain
  text, which kagent 1.0.0-alpha5 takes as an ordinary message.
- internal/dialect/dialecttest reads the kagent recordings for both
  dialects' tests, replacing two copies of the fixture reader, and fails
  on a recording that does not end in a task.
- The generic tests share one recorded-answer check, cannot panic on a
  nil parse, and pin that the answer follows Extension alone.
- The approver-warning test fails when a testdata edit finds nothing to
  replace, so no a2a case can quietly run as kagent-v1.

* fix(dialect): read a2a HITL pauses only from an agent whose card lists it

Two review findings left open on the a2a HITL change:

- A pause was read as kagent's HITL extension on the status message's
  word alone, even from an agent whose card never listed the extension.
  That agent was never asked for it, so its answer would go without the
  A2A-Extensions header. The generic dialect now records, per endpoint,
  whether the card the last Connect resolved lists the extension, and
  For(backend) gives each a2a Binding a view that reads HITL only then.
  The broker hands that view to the Binding's interactions. The shared
  Dialect, which knows no one card, reads text only.
- While an a2a session waited on a structured pause, every queued reply
  cost a GetTask and an interaction lookup to learn it was not an
  answer. The interaction module now returns TextReplyNoTextQuestion
  when the pause itself takes no typed answer (structured or unusable),
  and the runner reads no more of the queue for that pause; the reply
  stays queued and goes out as a turn when the pause ends, as before.

Spec D46, the a2a how-to, the agent contract and the glossary say so.

* fix(dialect): send A2A-Extensions on answers instead of tracking cards

Replaces 443b947, whose two mechanisms a second review found unsafe:

- The per-endpoint card record is gone. It was shared state on the one
  generic Dialect, keyed by URL, last write wins, never pruned, and
  correct only while Connect ran before every parse: several identities
  or a rollout on one endpoint could make it disagree with the client
  that fetched the task or sends the answer. The risk it addressed, an
  answer to a HITL pause sent without the header, is now handled per
  call: an interceptor on both dialects' clients adds A2A-Extensions for
  every offered extension a sent message names in its extensions,
  whatever the card lists. A pause is read as the extension's when its
  status message declares it and carries its payload, as before 443b947.
- The textNone reply-drain gate is gone. Skipping the GetTask also lost
  the only check that noticed, from a queued reply, a task that ended or
  resumed on the agent's side; repark kept the flag across a new pause,
  so a typed answer to a real text question could go unread; and an
  unusable pause could leave the runner parked with nothing to end it.
  Each queued reply again costs one GetTask during a structured pause.

Also: a HITL pause on a task with no ID is unusable at once, where it
used to be posted and then fail every answer until the timeout; and the
glossary says what an a2a pause is read as.

* docs: say what an A2A agent must send for structured pauses and approvals

The agent contract gains a section on kagent's HITL extension as the a2a
dialect speaks it: the card entry, the pause (status message extensions
and metadata), the tool-approval and ask-user request shapes and their
limits, nested pauses, and the answers Agent Kourier sends, with their
fixed rejection reasons. The a2a how-to links to it.

* fix(deps): build with Go 1.27.3 for GO-2026-6809

govulncheck fails every module on crypto/x509 in go1.27.2 (Distrust
compromised intermediate certificates), reachable through
x509.Certificate.Verify from internal/telemetry/http.go. CI reads the Go
version from each go.mod; the release and kind images already build on
golang:1.27.3. govulncheck reports nothing for the three modules on
1.27.3.

* docs: explain why approvals use one extension, and record it as D47

Agent Kourier reads tool approvals in kagent's HITL extension only, on
both dialects, and no framework's own format. The A2A explanation page
gains a section on why: A2A 1.0 defines no approval shape and its
maintainers left it to extensions; frameworks that serve A2A each put
approvals on the wire differently, undeclared, or not at all; kagent's
extension is declared in the card, carries what an approval needs, and
is not tied to one framework. An agent on another framework speaks it
through an adapter. The agent contract and the a2a how-to link to it.

Checked at the source: a2aproject/a2a-python#412 (maintainer comment of
2025-08-28), a2aproject/A2A#2149 (closed by the TSC on 2026-09-22), and
kagent's docs/architecture/human-in-the-loop.md at v1.0.0-alpha16 and its
LangGraph sample's card. The per-framework survey in D47 comes from
reading each framework's A2A server source on 2026-10-20; LangGraph's
server is closed source, so its shape comes from its docs and a
third-party capture.

* chore: leave the docs pins as main has them

* refactor(dialect): apply the quality review of the a2a HITL change

- kagent-v1's parser refuses a pause on a task with no ID, which fixes
  both dialects (such a pause was posted and then failed every answer),
  and stamps Interaction.Extension itself; the a2a dialect's HITL branch
  is now a plain hand-off, and the field means the same on both.
- session no longer names kagent or a dialect in IsTextQuestion's
  comment; the interceptor's comment says it relies on ServiceParams
  dropping a duplicate value.
- Tests: the two Connect tests are one table, the header test is renamed
  for what it checks, and a parse result is nil-checked before use.
- Docs: the glossary no longer says kagent-v1 always asks for the
  extension (both ask when the card lists it); the a2a how-to, glossary
  and troubleshooting page link the agent contract instead of
  restating it; two spacing slips in why-a2a.
- Spec: D46 says an undeclared payload is read as before (text, or
  unusable), the 6.3 row says the message gates reading and the card
  gets the agent asked, and D46 and the D47 appendix are shorter.

* test(e2e): approve and deny real kagent over the a2a dialect

The full tier gains an a2a AgentBackend at the front door, at the
approval agent's exact URL, and S19 and S20 Bindings on it, with
TestS19_FullApprovalRunsTheToolOverTheA2ADialect and
TestS20_FullDenialContinuesTheTurnOverTheA2ADialect. Against kagent
1.0.0-alpha5 both pass: the approval prompt is posted, the tool runs once
after an approval and not at all after a denial, and the decision is
audited, as on kagent-v1.

* test(e2e): approvals from an A2A agent written from the contract alone

test/hitlagent is an A2A agent on the a2a-go SDK, written from
docs/reference/agent-contract.md and nothing of kagent's or the stub's:
its card lists kagent's HITL extension, and it pauses for approval of one
tool call. It joins the test doubles (built into the doubles image,
deployed in every tier, never published), and the fast tier reaches it
through the a2a dialect for
TestS19_AContractOnlyAgentsApprovalRunsTheToolOverTheA2ADialect and
TestS20_AContractOnlyAgentsDenialContinuesTheTurnOverTheA2ADialect, which
pass.

Writing it found where the contract left an author guessing. The agent
contract now has notes for agent authors: the wire spellings of states
and roles, sending the payload whether or not the request asked,
text parts beside it, unique tool IDs and fresh IDs per pause, call_id and
hint, which tool names and arguments can be shown, reading decisions by
id, and what -32603 does.

The full tier's channel constants and the kindmanifests pins for both
tiers come with it.

---------

Co-authored-by: tbickford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants