chore: import upstream snapshot with attribution
Continuous Integration / Pre-commit Linter (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.10) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.11) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.12) (push) Has been cancelled
Continuous Integration / Mypy Check (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.12) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / Unit Tests (Python 3.14) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Has been cancelled
Copybara PR Handler / close-imported-pr (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Has been cancelled
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:25:13 +08:00
commit ec2b666284
2231 changed files with 491535 additions and 0 deletions
@@ -0,0 +1,83 @@
# Agents In Workflow
This sample demonstrates how to use both `task` mode and `single_turn` mode Agents as nodes within a `Workflow`.
## Overview
The workflow represents a medical lab intake process:
1. **`intake_agent`**: A `task` mode Agent that chats with the user to collect their `name` and `phone_number`. It handles a multi-turn conversation until its `PatientIdentity` output schema is fulfilled.
1. **`check_identity`**: A regular Python function node that receives the `PatientIdentity`. It mocks checking the database.
- If the name is anything other than "Jane Doe", it yields a `retry` route, sending the user back to the `intake_agent`.
- If the name is "Jane Doe", it routes to the `generate_instruction` agent.
1. **`generate_instruction`**: A `single_turn` mode Agent that uses the `find_orders` tool to look up orders. It requires tool confirmation before execution.
## Sample Inputs
- `Hi, I am Jane Doe, my phone number is 555-1234.`
*The system will process this and return the mock lab orders along with AI-generated instructions on how to prepare.*
- `I'm here for my blood work.`
*The system will ask for your name and phone number.*
- `My name is John Doe, and my number is 123-456-7890.`
*The system will fail to find John's orders and route back to the intake agent.*
## Graph
```text
[ START ]
|
v
[ intake_agent ] <----.
| |
v |
[ check_identity ] --- retry
|
| (DEFAULT_ROUTE)
v
[ generate_instruction ]
```
## How To
Within an ADK workflow, you can embed LLM agents directly as nodes. The ADK runner handles them according to their `mode`:
### 1. Task Mode Agents
A `task` agent (`mode="task"`) handles a multi-turn conversation on its own before passing control to the next node. It will continually interact with the user until its specified task is completed.
```python
class PatientIdentity(BaseModel):
name: str
phone_number: str
intake_agent = Agent(
name="intake_agent",
mode="task", # Stops and chats with the user until the schema is populated
output_schema=PatientIdentity,
instruction="...",
)
```
The parsed `output_schema` object is automatically forwarded as the `node_input` to the next node in the graph.
### 2. Single Turn Mode Agents
A `single_turn` agent (the default mode if omitted) executes a single LLM call. It is typically used for inline text generation, summarization, or classification without chatting with the user.
```python
generate_instruction = Agent(
name="generate_instruction",
tools=[FunctionTool(find_orders, require_confirmation=True)],
instruction="""
Use the find_orders tool to get the patient's orders.
List the orders found, and then generate a concise instruction about how to prepare based on those orders.
""",
)
```
In this sample, the `generate_instruction` agent uses the `find_orders` tool to retrieve the orders. It also demonstrates **tool confirmation**, requiring the user to approve the tool call before it executes.
@@ -0,0 +1,87 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from google.adk import Agent
from google.adk import Event
from google.adk import Workflow
from google.adk.tools.function_tool import FunctionTool
from google.adk.workflow import DEFAULT_ROUTE
from pydantic import BaseModel
from pydantic import Field
class PatientIdentity(BaseModel):
"""Output schema for the intake agent."""
name: str = Field(description="The patient's full name.")
phone_number: str = Field(description="The patient's phone number.")
intake_agent = Agent(
name="intake_agent",
mode="task",
output_schema=PatientIdentity,
instruction="""\
You are a medical lab intake assistant. Your job is to chat with
the user to get their full name and phone number. Do not make up
information. Once you have both, finish your task.
If identity check failed, ask for another name.
""",
)
def check_identity(node_input: PatientIdentity):
"""Mocks checking the database for the patient.
Routes back to intake_agent if the name is not Jane Doe.
"""
if node_input.name.lower() != "jane doe":
yield Event(
message=(
f"Could not find matching records for {node_input.name}. Let's"
" try again."
),
route="retry",
)
else:
yield Event(
message=f"""Hello {node_input.name}! Let me look up your orders."""
)
def find_orders() -> list[str]:
"""Finds orders for the patient."""
return ["CBC (Complete Blood Count)", "Lipid Panel"]
generate_instruction = Agent(
name="generate_instruction",
tools=[FunctionTool(find_orders, require_confirmation=True)],
instruction="""
Use the find_orders tool to get the patient's orders.
List the orders found, and then generate a concise instruction about how to prepare based on those orders.
""",
)
root_agent = Workflow(
name="task_in_workflow",
edges=[
("START", intake_agent, check_identity),
(
check_identity,
{"retry": intake_agent, DEFAULT_ROUTE: generate_instruction},
),
],
)
@@ -0,0 +1,282 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "go"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Hello! I'm your medical lab intake assistant. To start, may I please have your full name?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Jane Doe"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Thank you, Jane Doe. May I please have your phone number now?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "555-1234"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {
"originalFunctionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-3"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-2": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "adk_request_confirmation",
"response": {
"confirmed": true,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"result": [
"CBC (Complete Blood Count)",
"Lipid Panel"
]
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "The patient has the following orders: CBC (Complete Blood Count) and Lipid Panel. Please fast for 8-12 hours prior to your appointment for the Lipid Panel."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}
@@ -0,0 +1,279 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "go"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Hello! I'm here to help you with your lab intake. Could I please get your full name and phone number?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Jane Doe"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Thanks, Jane. Could I please get your phone number?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "555-1234"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {
"originalFunctionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-3"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-2": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "adk_request_confirmation",
"response": {
"confirmed": false,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call is rejected."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "I'm sorry, but I was unable to retrieve the patient's orders. The tool call was rejected."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}
@@ -0,0 +1,253 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "Hi, my name is Jane Doe"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Hi Jane, what is your phone number?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "555-1234"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {
"originalFunctionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-3"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-2": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "adk_request_confirmation",
"response": {
"confirmed": true,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"result": [
"CBC (Complete Blood Count)",
"Lipid Panel"
]
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "Here are the orders found: CBC (Complete Blood Count) and Lipid Panel.\n\nPlease fast for 9-12 hours before your appointment for the Lipid Panel. You may drink water during this time."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}
@@ -0,0 +1,224 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "I am Jane Doe, my phone number is 555-1234"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {
"originalFunctionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-3"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-2": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "adk_request_confirmation",
"response": {
"confirmed": true,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"result": [
"CBC (Complete Blood Count)",
"Lipid Panel"
]
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "The patient has orders for a CBC (Complete Blood Count) and a Lipid Panel. Please fast for 9-12 hours prior to the tests."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}
@@ -0,0 +1,253 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "My phone number is 555-1234"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Thanks! What is your full name?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Jane Doe"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {
"originalFunctionCall": {
"id": "fc-2",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-3"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-2": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "adk_request_confirmation",
"response": {
"confirmed": true,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "find_orders",
"response": {
"result": [
"CBC (Complete Blood Count)",
"Lipid Panel"
]
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "The patient has the following orders: CBC (Complete Blood Count) and Lipid Panel.\n\nPlease fast for 8-12 hours before your appointment for the Lipid Panel. You may drink water."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}
@@ -0,0 +1,349 @@
{
"events": [
{
"author": "user",
"content": {
"parts": [
{
"text": "My name is John Doe"
}
],
"role": "user"
},
"id": "e-1",
"invocationId": "i-1",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"text": "Thanks, John. What's your phone number?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "555-1234"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-1",
"args": {
"name": "John Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1"
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-1",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "John Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@1",
"outputFor": [
"task_in_workflow@1/intake_agent@1"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@1"
},
{
"content": {
"parts": [
{
"text": "Could not find matching records for John Doe. Let's try again."
}
],
"role": "user"
},
"author": "task_in_workflow",
"actions": {
"route": "retry"
},
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@1"
}
},
{
"content": {
"parts": [
{
"text": "Could not find matching records for John Doe. Let's try again. What other name can I use?"
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@2"
},
"isolationScope": "task_in_workflow@1/intake_agent@2"
},
{
"content": {
"parts": [
{
"text": "Jane Doe, 555-1234"
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-2",
"args": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"name": "finish_task"
}
}
],
"role": "model"
},
"author": "intake_agent",
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@2"
},
"isolationScope": "task_in_workflow@1/intake_agent@2"
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-2",
"name": "finish_task",
"response": {
"result": "Task completed."
}
}
}
],
"role": "user"
},
"author": "intake_agent",
"output": {
"name": "Jane Doe",
"phone_number": "555-1234"
},
"nodeInfo": {
"path": "task_in_workflow@1/intake_agent@2",
"outputFor": [
"task_in_workflow@1/intake_agent@2"
]
},
"isolationScope": "task_in_workflow@1/intake_agent@2"
},
{
"content": {
"parts": [
{
"text": "Hello Jane Doe! Let me look up your orders."
}
],
"role": "user"
},
"author": "task_in_workflow",
"nodeInfo": {
"path": "task_in_workflow@1/check_identity@2"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-3",
"args": {},
"name": "find_orders"
}
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionCall": {
"id": "fc-4",
"args": {
"originalFunctionCall": {
"id": "fc-3",
"args": {},
"name": "find_orders"
},
"toolConfirmation": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
},
"name": "adk_request_confirmation"
}
}
]
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
},
"longRunningToolIds": [
"fc-4"
]
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "find_orders",
"response": {
"error": "This tool call requires confirmation, please approve or reject."
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"actions": {
"skipSummarization": true,
"requestedToolConfirmations": {
"fc-3": {
"hint": "Please approve or reject the tool call find_orders() by responding with a FunctionResponse with an expected ToolConfirmation payload.",
"confirmed": false
}
}
},
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-4",
"name": "adk_request_confirmation",
"response": {
"confirmed": true,
"payload": {}
}
}
}
],
"role": "user"
},
"author": "user",
"nodeInfo": {
"path": ""
}
},
{
"content": {
"parts": [
{
"functionResponse": {
"id": "fc-3",
"name": "find_orders",
"response": {
"result": [
"CBC (Complete Blood Count)",
"Lipid Panel"
]
}
}
}
],
"role": "user"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1"
}
},
{
"content": {
"parts": [
{
"text": "Here are your orders:\n* CBC (Complete Blood Count)\n* Lipid Panel\n\nTo prepare for these orders, you will need to fast for 9-12 hours prior to your appointment. You may drink water during this time."
}
],
"role": "model"
},
"author": "generate_instruction",
"nodeInfo": {
"path": "task_in_workflow@1/generate_instruction@1",
"outputFor": [
"task_in_workflow@1/generate_instruction@1",
"task_in_workflow@1"
],
"messageAsOutput": true
}
}
]
}