-
Notifications
You must be signed in to change notification settings - Fork 898
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I have been trying to implement a chat just using HttpAgent on React and I'm currently stuck on a problem that pending_tool_calls persists and don't get resolved.
I would like to confirm if I am implementing wrong or there is a bug that ADK Middleware doesn't clean pending tools properly. Here is my code.
As we can see below, there is in Messages State a message with the result of render_ItemsList tool. But when we look to the session registered on ADK Session DB, we cannot see the render_ItemsList tool result event. So, pending_tool_calls remains with the toolCallId.
HttpAgent Messages State:
[
{
"id": "user-1760622214456",
"role": "user",
"content": "Hi\n"
},
{
"id": "76f84e95-595f-4a9a-971b-5d2b05ef1680",
"role": "assistant",
"content": "Hello Joe Doe! How can I help you today?"
},
{
"id": "user-1760622234346",
"role": "user",
"content": "I would like to see the available items\n"
},
{
"id": "adk-5ad444ed-0610-49ae-bf14-c89273b38d6f",
"role": "assistant",
"toolCalls": [
{
"id": "adk-5ad444ed-0610-49ae-bf14-c89273b38d6f",
"type": "function",
"function": {
"name": "get_items",
"arguments": ""
}
}
]
},
{
"id": "ffa2d8c9-f1e8-4aed-97aa-56ee440c8404",
"toolCallId": "adk-5ad444ed-0610-49ae-bf14-c89273b38d6f",
"role": "tool",
"content": "{\"result\": [\"Item 1\", \"Item 2\", \"Item 3\", \"Item 4\", \"Item 5\"]}"
},
{
"id": "adk-8ccd7b09-4c51-4352-be35-da49bc10a571", // render_ItemsList tool call
"role": "assistant",
"toolCalls": [
{
"id": "adk-8ccd7b09-4c51-4352-be35-da49bc10a571",
"type": "function",
"function": {
"name": "render_ItemsList",
"arguments": "{\"items\": [\"Item 1\", \"Item 2\", \"Item 3\", \"Item 4\", \"Item 5\"]}"
}
}
]
},
{
"id": "tool-result-1760622239565", // render_ItemsList tool result sent by client
"role": "tool",
"content": "{\"status\":\"success\",\"message\":\"Items were rendered successfully.\",\"itemsCount\":5}",
"toolCallId": "adk-8ccd7b09-4c51-4352-be35-da49bc10a571"
},
{
"id": "user-1760622531664",
"role": "user",
"content": "Cool"
}
]
Session registered on ADK db:
{
"id": "ca4a6c6c-a554-442e-8b89-31a715f97d3c",
"appName": "agent",
"userId": "user-123",
"state": {
"user_id": "user-123",
"user_name": "Joe Doe",
"pending_tool_calls": [
"adk-8ccd7b09-4c51-4352-be35-da49bc10a571" // toolCallId persists, we cannot see an event with this tool result
]
},
"events": [
{
"invocationId": "state_update_1760622214",
"author": "system",
"actions": {
"stateDelta": {
"user_id": "user-123",
"user_name": "Joe Doe"
},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "5eecf8ef-7866-4fa7-ac90-f06474c5f8ec",
"timestamp": 1760622214.65949
},
{
"content": {
"parts": [
{
"text": "Hi\n"
}
],
"role": "user"
},
"invocationId": "e-7a649858-9b89-4878-9665-4f3d7ef583b3",
"author": "user",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "ea6dab00-b584-4588-868d-953b2a8c8c76",
"timestamp": 1760622214.672113
},
{
"content": {
"parts": [
{
"text": "Hello Joe Doe! How can I help you today?"
}
],
"role": "model"
},
"invocationId": "e-7a649858-9b89-4878-9665-4f3d7ef583b3",
"author": "GenericAgent",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "18185c89-31ed-43e2-96c3-f11b9280bd5d",
"timestamp": 1760622216.554769
},
{
"invocationId": "state_update_1760622234",
"author": "system",
"actions": {
"stateDelta": {
"user_id": "user-123",
"user_name": "Joe Doe"
},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "421d663f-ee43-4d52-aa57-8f0dcdd3e9a2",
"timestamp": 1760622234.422587
},
{
"content": {
"parts": [
{
"text": "I would like to see the available items\n"
}
],
"role": "user"
},
"invocationId": "e-a1a8bf33-e77f-4e5a-b1a4-5f9c0170670b",
"author": "user",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "e2e37bf4-52da-474c-83e1-4e6f36648f00",
"timestamp": 1760622234.443018
},
{
"content": {
"parts": [
{
"thoughtSignature": "CikB0e2Kb0uzhedBITTDSdgQBX5okPM0bvKzDyVod2Cqc2A35hSpAy7GWwpkAdHtim9hELttZxq0fa7xctgyoMlQ9i0UOYHFfOWa_smKArp83DZGf1bF1Wyd-NEnCeJyc0IWmkOu2m22IxJIxuYnUGQMdKV7gN6oBtqJlbQhPc5gn61nj-rD0zi_b068y3or3wqdAQHR7Ypvz_op3P7LsqKLbqW9wW-IK14Wc6_Hk6c2nHmweHExvfjcdnSvCoZHMix33OMvn0s_j31omwWN-p2pamrautmnFvMAyJEZ-7p2ECMZUmx977JgBgQ4hJ1yxkKfsKF2L1fBPknLRlvl3mGVBJ7d0eRJkSfSE0BESpYV1AOB76ua0v1VlO-Ogiwtappg0bqXvwZ5ADxvQUEO7pM=",
"functionCall": {
"id": "adk-5ad444ed-0610-49ae-bf14-c89273b38d6f",
"args": {},
"name": "get_items"
}
}
],
"role": "model"
},
"invocationId": "e-a1a8bf33-e77f-4e5a-b1a4-5f9c0170670b",
"author": "GenericAgent",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "c4a7cd78-1216-4943-9f6f-fe201567b86d",
"timestamp": 1760622234.448923
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "adk-5ad444ed-0610-49ae-bf14-c89273b38d6f",
"name": "get_items",
"response": {
"result": [
"Item 1",
"Item 2",
"Item 3",
"Item 4",
"Item 5"
]
}
}
}
],
"role": "user"
},
"invocationId": "e-a1a8bf33-e77f-4e5a-b1a4-5f9c0170670b",
"author": "GenericAgent",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "5b0c0c96-02c8-4da2-8b21-34ea9eb7d545",
"timestamp": 1760622236.385817
},
{
"content": {
"parts": [
{
"thoughtSignature": "CikB0e2Kb2NfqEJgBm9vvOQ5Ja09Q3ngf4ssQeF_jLykEOPIRahc6wcqVgpyAdHtim_r4n6-OVwJNul_fhd-oLoHyQT-x8v8Ge9JA2bk57ppk7b-2hmhIUg0lh4JkjWmZM61ldzyVIaQbut6UIz1K7t1oECAQHWpstCSVqpfiQuYxKUR45uE2aAoFJ50XRABk5J8P2xQbo2Sa1RsHhV2CqwBAdHtim96LzYVdxKGt_WJze89VrAkexAUL5YYaBIFHISfQf_T2kTgriMWgTbd2FBT1hrwxxgp7cLgwObJOHDS7cUYaalXineZyo0KnC1-yRSjeMgHY_QeZeDZT3jS-Wj7iN_-8QakEYIoh4XTbKTyaAKI0baeNgA2f_TY1mw2e1meqNsscOruNXst0g5RM4CM4IK14m6IWl7WZf68S3wFqWIF55NnfTCHjdOK4wolAdHtim-kjIOFEqpE2V0rkHlOpRZtGNNMv8MR77FmlLJbFy-h3A==",
"functionCall": {
"id": "adk-8ccd7b09-4c51-4352-be35-da49bc10a571",
"args": {
"items": [
"Item 1",
"Item 2",
"Item 3",
"Item 4",
"Item 5"
]
},
"name": "render_ItemsList"
}
}
],
"role": "model"
},
"invocationId": "e-a1a8bf33-e77f-4e5a-b1a4-5f9c0170670b",
"author": "GenericAgent",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [
"adk-8ccd7b09-4c51-4352-be35-da49bc10a571"
],
"id": "5718940c-2c2e-4a1c-95d5-60ed239a11c8",
"timestamp": 1760622236.392789
},
{
"invocationId": "state_update_1760622240",
"author": "system",
"actions": {
"stateDelta": {
"pending_tool_calls": [
"adk-8ccd7b09-4c51-4352-be35-da49bc10a571"
]
},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "330711d9-a910-475a-ba45-457b593ac1a7",
"timestamp": 1760622240.565043
},
{
"invocationId": "state_update_1760622531",
"author": "system",
"actions": {
"stateDelta": {
"user_id": "user-123",
"user_name": "Joe Doe"
},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "14ff9f88-f93c-4fcb-9c9a-374771417a9d",
"timestamp": 1760622531.760833
},
{
"content": {
"parts": [
{
"text": "Cool"
}
],
"role": "user"
},
"invocationId": "e-7d2cfd01-dc2f-4b76-a344-522f61243311",
"author": "user",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "8b7217c4-5a76-49e4-a76b-03f47ac310b5",
"timestamp": 1760622531.776152
},
{
"content": {
"parts": [
{
"text": "Here are the available items for you to choose from. Is there anything else I can help you with?"
}
],
"role": "model"
},
"invocationId": "e-7d2cfd01-dc2f-4b76-a344-522f61243311",
"author": "GenericAgent",
"actions": {
"stateDelta": {},
"artifactDelta": {},
"requestedAuthConfigs": {},
"requestedToolConfirmations": {}
},
"longRunningToolIds": [],
"id": "718bea92-5902-42e1-9728-c9abcf2d5a34",
"timestamp": 1760622534.456543
}
],
"lastUpdateTime": 1760622531.0
}

Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working