Skip to content

feat: Add optional referenceTaskIds for task followups#608

Merged
swapydapy merged 2 commits into
mainfrom
swapydapy/referenceTasks
May 20, 2025
Merged

feat: Add optional referenceTaskIds for task followups#608
swapydapy merged 2 commits into
mainfrom
swapydapy/referenceTasks

Conversation

@swapydapy

Copy link
Copy Markdown
Contributor

Problem

Clients need to follow up or refine previously created tasks by agents.

Proposal

Option 1: Restartable Tasks

Agents allow tasks to restart processing from terminal states (Completed, Failed and Cancelled).

This option focuses on reusing existing tasks by restarting them when a follow-up or refinement is requested. This simplifies agent development by maintaining local context and referencing previous tasks directly. However, it introduces complexities with parallel follow-ups, task immutability, and bookkeeping. It can also lead to inconsistencies between the client and agent's view of task history and requires the agent to manage refined artifacts and inputs.

Option 2: New Task in same contextId (Preferred)

Context can be thought of as a larger goal from a client perspective. Clients can use the same contextId from the previous task and send a message for refinement or followup. Agents should spawn up new tasks. Tasks cannot restart processing from terminal states (Completed, Failed and Cancelled).

This approach favors creating new tasks for each follow-up or refinement while using the same contextId. This simplifies implementation for agents, enables parallel processing, and maintains task immutability. Clients can keep references to tasks with their state, artifacts, and messages. However, agents need to implement a strategy to infer previous tasks based on the contextId and handle potential ambiguities.

Other Aspects

Task Referencing

  • App-to-Agent: Agents infer the previous task based on the contextId. They may use strategies like RAG (Retrieval-Augmented Generation) to retrieve relevant tasks, messages, and artifacts.
  • Agent-to-Agent: Clients can optionally provide referenceTaskIds in the Message object to explicitly reference previous tasks. This acts as a hint to the serving agent.

Artifact Referencing

  • Agents are expected to infer the relevant artifacts based on the referred tasks. Since agents possess a deeper understanding of the tasks they have created, they are better positioned to identify the appropriate artifact for a given user message.
  • In case of ambiguity about which artifact should be used for the follow-up or refinement, the agent will ask for input using input-required. Clients can then pass on the artifact inputs as Parts in the message.
  • To preserve explicit linkage between inputs and previously generated artifacts, clients can optionally populate referenceArtifactId in the part's metadata.

Artifact Mutation Tracking

  • A follow-up or refinement task may lead to the modification of older artifacts and the generation of new ones. While tracking all mutations of an artifact might be useful, the client is best suited to determine what constitutes the "latest" or intended artifact to be refined. The client ultimately decides what the result is and can reject the mutation.
  • Therefore, the serving agent can choose their methodology to maintain consistency in artifact identification. Eg. it can keep the same artifact-name when generating a refinement on the original artifact.
  • In case of ambiguity or if the context is not sufficient, the agent will utilize input-required to explicitly request the client to specify which artifact to work with.

Proposed API Change

  • Addition of optional referenceTaskIds field in the Message object.
  • Optional addition of referenceArtifactId in part metadata of Message object.

@swapydapy swapydapy merged commit 5368e77 into main May 20, 2025
4 of 5 checks passed
@swapydapy swapydapy deleted the swapydapy/referenceTasks branch May 20, 2025 19:51
holtskinner added a commit that referenced this pull request May 27, 2025
🤖 I have created a release *beep* *boop*
---


## [0.2.1](v0.2.0...v0.2.1)
(2025-05-27)


### Features

* Add a new boolean for supporting authenticated extended cards
([#618](#618))
([e0a3070](e0a3070))
* Add optional referenceTaskIds for task followups
([#608](#608))
([5368e77](5368e77))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Holt Skinner <holtskinner@google.com>
debug313 pushed a commit to debug313/agent-to-agent that referenced this pull request Apr 12, 2026
🤖 I have created a release *beep* *boop*
---


## [0.2.1](a2aproject/A2A@v0.2.0...v0.2.1)
(2025-05-27)


### Features

* Add a new boolean for supporting authenticated extended cards
([#618](a2aproject/A2A#618))
([a00a1f7](a2aproject/A2A@a00a1f7))
* Add optional referenceTaskIds for task followups
([#608](a2aproject/A2A#608))
([4cc9e48](a2aproject/A2A@4cc9e48))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Holt Skinner <holtskinner@google.com>
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