Replies: 4 comments
-
In my implementation, I’m keeping a single contextId for the entire conversation and generating a new taskId for each turn. |
Beta Was this translation helpful? Give feedback.
-
I am doing the same. The reference cli in a2a-samples cli at https://github.com/a2aproject/a2a-samples/tree/main/samples/python/hosts/cli and a2a-js does it similarly. So contextId is like your session for the one conversation and should change if you are switching and ignore previous messages. taskId is for a message send and all responses for this. See https://github.com/a2aproject/a2a-samples/blob/main/samples/python/hosts/cli/__main__.py#L85 for reference:
Keep in mind that in a2a it's not possiblee to send all the history of a chat to a server but instead you just send a new message for the contextId - that's why it needs to stay to not lose context on the next message. |
Beta Was this translation helpful? Give feedback.
-
If a client can ask for a task task/get, it seems like it should be important for the client to also provide the contextid. It feels like without this random client agents could dream up the taskId to go on a fishing excursion to hunt for data that can leak from the remote agent. If the order of operations is client sends message, and server responds with task or message including contextid, in order to obtain the task again later on, that same client would need to keep track of the contextid in order to get the taskid in that context. This would support isolation of work better for the server to validate that the client should be able to see that task because not only does it know of the taskid but it also has knowledge of the contextid. This also provides servers the ability to when authentication comes into play to align the caller identity to the contextid so that if another caller attempts to fish for the task they must provide the contextid and the server can validate that the contextid (and the task) belong to the caller in question. |
Beta Was this translation helpful? Give feedback.
-
When clients interact with servers multiple messages and responses can be exchanged and the context identifier generated by the server is used to group these interactions. Multiple tasks can be completed during this interaction and each task has its own identifier also generated by the server. These identifiers should not be generated by the clients because there is great risk of collisions happening if the server does not have a namespace that can make it unique only for those authenticated clients. This mistake was identified in #925 and fixed in #926 You should wait for the server to give you the context id and task id during the interaction and then you can use those values in future interactions with that server. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
I've been reviewing the specifications and experimenting with some basic code. I noticed that when calling
client.sendMessage
, bothcontextId
andtaskId
can be included. I believe these are used to enable multi-turn conversations by resending messages with the original dialogue information. However, I'm curious about the difference between the two. Should a multi-turn conversation with an agent be considered a single context or a single task?Thank you for your guidance!
Beta Was this translation helpful? Give feedback.
All reactions