00760f8455
- Enable resumability and add Human-in-the-Loop (HITL) step to `node_as_tool` sample workflow. - Update `node_as_tool` README to document the HITL multi-turn flow. - Fix `agent_test_runner.py` to preserve the `branch` field when replaying user events in tests. - Implement lazy rehydration of `resume_inputs` from `session.events` in `NodeRunner` for standalone nodes (e.g. nodes run as tools of an Agent). This allows standalone nodes to resume correctly. Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 948503030
212 lines
4.7 KiB
JSON
212 lines
4.7 KiB
JSON
{
|
|
"appName": "node_as_tool",
|
|
"id": "12345678-1234-1234-1234-123456789abc",
|
|
"userId": "user",
|
|
"events": [
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionCall": {
|
|
"id": "fc-3",
|
|
"args": {
|
|
"interruptId": "fc-3",
|
|
"payload": null,
|
|
"message": "Apply VIP discount for tier 'Verified VIP Member'?",
|
|
"response_schema": null
|
|
},
|
|
"name": "adk_request_input"
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"author": "calculate_discount",
|
|
"nodeInfo": {
|
|
"path": "calculate_discount@1"
|
|
},
|
|
"longRunningToolIds": [
|
|
"fc-3"
|
|
],
|
|
"branch": "calculate_discount@fc-2"
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"text": "Checking discount rules for tier 'Verified VIP Member'..."
|
|
}
|
|
],
|
|
"role": "user"
|
|
},
|
|
"author": "calculate_discount",
|
|
"nodeInfo": {
|
|
"path": "calculate_discount@1"
|
|
},
|
|
"branch": "calculate_discount@fc-2"
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"text": "Checking discount rules for tier 'Verified VIP Member'..."
|
|
}
|
|
],
|
|
"role": "user"
|
|
},
|
|
"author": "calculate_discount",
|
|
"nodeInfo": {
|
|
"path": "calculate_discount@1"
|
|
},
|
|
"branch": "calculate_discount@fc-2"
|
|
},
|
|
{
|
|
"author": "calculate_discount",
|
|
"output": "20% off",
|
|
"nodeInfo": {
|
|
"path": "calculate_discount@1",
|
|
"outputFor": [
|
|
"calculate_discount@1"
|
|
]
|
|
},
|
|
"branch": "calculate_discount@fc-2"
|
|
},
|
|
{
|
|
"author": "customer_lookup_workflow",
|
|
"output": {
|
|
"user_id": "c123",
|
|
"tier": "Verified VIP Member"
|
|
},
|
|
"nodeInfo": {
|
|
"path": "customer_lookup_workflow@1/lookup_customer_data@1",
|
|
"outputFor": [
|
|
"customer_lookup_workflow@1/lookup_customer_data@1",
|
|
"customer_lookup_workflow@1"
|
|
]
|
|
},
|
|
"branch": "customer_lookup_workflow@fc-1"
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionCall": {
|
|
"id": "fc-2",
|
|
"args": {
|
|
"tier": "Verified VIP Member"
|
|
},
|
|
"name": "calculate_discount"
|
|
}
|
|
}
|
|
],
|
|
"role": "model"
|
|
},
|
|
"author": "customer_service_agent",
|
|
"nodeInfo": {
|
|
"path": "customer_service_agent@1"
|
|
},
|
|
"longRunningToolIds": [
|
|
"fc-2"
|
|
]
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionCall": {
|
|
"id": "fc-1",
|
|
"args": {
|
|
"user_id": "c123"
|
|
},
|
|
"name": "customer_lookup_workflow"
|
|
}
|
|
}
|
|
],
|
|
"role": "model"
|
|
},
|
|
"author": "customer_service_agent",
|
|
"nodeInfo": {
|
|
"path": "customer_service_agent@1"
|
|
},
|
|
"longRunningToolIds": [
|
|
"fc-1"
|
|
]
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionResponse": {
|
|
"id": "fc-1",
|
|
"name": "customer_lookup_workflow",
|
|
"response": {
|
|
"user_id": "c123",
|
|
"tier": "Verified VIP Member"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"role": "user"
|
|
},
|
|
"author": "customer_service_agent",
|
|
"nodeInfo": {
|
|
"path": "customer_service_agent@1"
|
|
}
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionResponse": {
|
|
"id": "fc-2",
|
|
"name": "calculate_discount",
|
|
"response": {
|
|
"result": "20% off"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"role": "user"
|
|
},
|
|
"author": "customer_service_agent",
|
|
"nodeInfo": {
|
|
"path": "customer_service_agent@1"
|
|
}
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"text": "Customer c123 is a Verified VIP Member and gets a 20% discount."
|
|
}
|
|
],
|
|
"role": "model"
|
|
},
|
|
"author": "customer_service_agent",
|
|
"nodeInfo": {
|
|
"path": "customer_service_agent@1"
|
|
}
|
|
},
|
|
{
|
|
"content": {
|
|
"parts": [
|
|
{
|
|
"functionResponse": {
|
|
"id": "fc-3",
|
|
"name": "adk_request_input",
|
|
"response": {
|
|
"text": "yes"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"role": "user"
|
|
},
|
|
"author": "user",
|
|
"nodeInfo": {
|
|
"path": ""
|
|
},
|
|
"branch": "calculate_discount@fc-2"
|
|
}
|
|
]
|
|
}
|