Heuristic:A2aproject A2a java Warning Deprecated AgentEmitter isFinal Parameter
| Knowledge Sources | |
|---|---|
| Domains | Deprecation, Server, Event_Streaming |
| Last Updated | 2026-10-30 00:00 GMT |
Overview
Deprecated `AgentEmitter` method variants with the `isFinal` parameter — use the parameterless equivalents instead.
Description
Four method overloads on `AgentEmitter` carry a `boolean isFinal` parameter: `requiresInput(boolean)`, `requiresInput(Message, boolean)`, `requiresAuth(boolean)`, and `requiresAuth(Message, boolean)`. These are marked `@Deprecated(forRemoval = true)` because the `isFinal` parameter has no effect — interrupted states (INPUT_REQUIRED, AUTH_REQUIRED) are not terminal per the A2A specification.
= Usage
Use this warning when reviewing code that calls `AgentEmitter.requiresInput` or `requiresAuth` with a boolean argument. Replace those calls with the parameterless equivalents.
The Insight (Rule of Thumb)
- Action: Replace `emitter.requiresInput(isFinal)` with `emitter.requiresInput()`, and `emitter.requiresInput(message, isFinal)` with `emitter.requiresInput(message)`.
- Value: The `isFinal` parameter is ignored at runtime — the method delegates directly to the parameterless version.
- Trade-off: None. The replacement methods are semantically identical.
- Compatibility: The deprecated methods will be removed in a future release. New code must use the parameterless variants.
Reasoning
The A2A protocol defines INPUT_REQUIRED and AUTH_REQUIRED as non-terminal task states. A task in these states can resume (e.g., after providing input or authentication). The `isFinal` parameter was originally intended to mark these as final, but the A2A specification clarifies that only COMPLETED, FAILED, CANCELED, and REJECTED are terminal. The `AgentEmitter` enforces terminal state safety via an `AtomicBoolean`, and these interrupted states do not consume that guard.