Repository navigation
fix(a2a): use the final streamed answer as RemoteA2aAgent node output - #7671
Open
llalitkumarrr wants to merge 1 commit into
Open
llalitkumarrr wants to merge 1 commit into
llalitkumarrr wants to merge 1 commit into
Conversation
When RemoteA2aAgent runs as a Workflow node with streaming, the remote executor streams the answer as artifact updates while the task is `working`, then closes with a `completed` status update that has no content. Nothing could become the node output on a2a-sdk 0.3, so it was None. On a2a-sdk 1.x, the protobuf state names (`TASK_STATE_WORKING`, etc.) were not recognized as non-final, so the first intermediate text became the output. Recognize the A2A 1.x task-state names. Remember the last answer text seen while the task is submitted/working, and set it as the node output after the stream ends, but only if the task reached `completed`. Turns that pause for input/auth, fail, are canceled or rejected, or are still running keep producing no output. Fixes google#7589
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to Issue or Description of Change
Problem:
When
RemoteA2aAgentruns as a Workflow node with streaming, the remote executor streams the answer as artifact updates while the task isworking, then closes with acompletedstatus update that has no content. As a result:JoinNodevalue) wasNone.TASK_STATE_WORKING, ...). These weren't in_NON_FINAL_TASK_STATES, so the first intermediate text (e.g. a "Let me look that up." preamble) became the node output.Solution:
_NON_FINAL_TASK_STATES. Add_IN_PROGRESS_TASK_STATES(submitted/working) and_COMPLETED_TASK_STATES._run_impl, track the latest task state and remember the last non-thought answer text from this node seen while the task is in progress.completed, set the remembered text onctx.output. The framework then emits it as the node output.workingwhen the stream ends keep producing no output, the same as before. The fallback is also skipped if the context has pending interrupts or an output is already set._get_task_statehandles both plain strings and the a2a-sdk 0.3TaskStatestr-enum stored in event metadata.Testing Plan
Unit Tests:
Additional context
The change is limited to
RemoteA2aAgent._run_impland two new private helpers (_get_task_state,_get_answer_text); there are no public API changes.AgentMode.TASKbehavior is unchanged.