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
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:
@@ -0,0 +1,56 @@
|
||||
# ADK Single-turn Agent as Sub-agent Sample
|
||||
|
||||
## Overview
|
||||
|
||||
This sample demonstrates how a "single_turn" mode agent can act as an autonomous sub-agent to an LLM agent, utilizing schemas and tools without ever interacting with the user.
|
||||
|
||||
**Note**: This is the recommended mechanism to replace the older `AgentTool` pattern. Unlike `AgentTool`, using a `single_turn` sub-agent preserves the sub-agent's internal interactions (like tool calls) in the session history.
|
||||
|
||||
Single-turn agents are designed to execute their function fully in one prompt-response cycle. In this sample:
|
||||
|
||||
1. `phone_recommender`: A single-turn agent that receives structured input (`UserPreferences`), uses a mocked tool (`check_phone_price`), and returns structured output (`PhoneRecommendation`).
|
||||
1. `root_agent`: The main agent that interacts with the user, translates their natural language request into the structured `UserPreferences`, and delegates to `phone_recommender`.
|
||||
|
||||
## Sample Inputs
|
||||
|
||||
- `I need a phone mostly for gaming. I have about $1000 to spend.`
|
||||
|
||||
- `What is a good cheap phone from Google for basic tasks?`
|
||||
|
||||
- `I love photography but prefer smaller phones. My budget is $600.`
|
||||
|
||||
## Graph
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
root_agent --> phone_recommender
|
||||
phone_recommender -.->|uses| check_phone_price[check_phone_price tool]
|
||||
```
|
||||
|
||||
## How To
|
||||
|
||||
1. Define a sub-agent with `mode="single_turn"`, `input_schema`, `output_schema`:
|
||||
|
||||
```python
|
||||
phone_recommender = Agent(
|
||||
name="phone_recommender",
|
||||
mode="single_turn",
|
||||
input_schema=UserPreferences,
|
||||
output_schema=PhoneRecommendation,
|
||||
tools=[check_phone_price],
|
||||
...
|
||||
)
|
||||
```
|
||||
|
||||
1. Assign it to a parent agent:
|
||||
|
||||
```python
|
||||
root_agent = Agent(
|
||||
sub_agents=[phone_recommender],
|
||||
...
|
||||
)
|
||||
```
|
||||
|
||||
## Related Guides
|
||||
|
||||
- [LlmAgent Single-Turn Mode](../../../../docs/guides/agents/llm_agent/single_turn.md) - Guide explaining the behavior and configuration of single-turn agents.
|
||||
@@ -0,0 +1,81 @@
|
||||
# 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 pydantic import BaseModel
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class UserPreferences(BaseModel):
|
||||
budget: int = Field(description="The user's maximum budget in USD")
|
||||
primary_use: str = Field(
|
||||
description=(
|
||||
"What the user primarily uses their phone for (e.g., photography,"
|
||||
" gaming, basics)"
|
||||
)
|
||||
)
|
||||
preferred_size: str = Field(
|
||||
description="Preferred phone size (e.g., small, large, any)"
|
||||
)
|
||||
|
||||
|
||||
class PhoneRecommendation(BaseModel):
|
||||
"""Output schema for the phone recommendation."""
|
||||
|
||||
model_name: str
|
||||
price: float
|
||||
reason: str
|
||||
|
||||
|
||||
def check_phone_price(model_name: str) -> float:
|
||||
"""Mock tool to check the current price of a Pixel phone model."""
|
||||
prices = {
|
||||
"Pixel 10a": 499.0,
|
||||
"Pixel 10": 799.0,
|
||||
"Pixel 10 Pro": 999.0,
|
||||
"Pixel 10 Pro XL": 1199.0,
|
||||
"Pixel 10 Pro Fold": 1799.0,
|
||||
}
|
||||
# Simple mock logic, defaulting to 799 if not found exactly
|
||||
for key, value in prices.items():
|
||||
if key.lower() in model_name.lower():
|
||||
return value
|
||||
return 799.0
|
||||
|
||||
|
||||
phone_recommender = Agent(
|
||||
name="phone_recommender",
|
||||
mode="single_turn",
|
||||
input_schema=UserPreferences,
|
||||
output_schema=PhoneRecommendation,
|
||||
tools=[check_phone_price],
|
||||
instruction=("""\
|
||||
You are an expert Google Pixel hardware recommender.
|
||||
Based on the provided UserPreferences, recommend exactly one Pixel phone model.
|
||||
You must use the `check_phone_price` tool to find the exact current price of the model you are recommending before you finish your task.
|
||||
Only recommend these phones: Pixel 10a, Pixel 10, Pixel 10 Pro, Pixel 10 Pro XL, Pixel 10 Pro Fold.
|
||||
"""),
|
||||
description="Recommends a Pixel phone based on preferences.",
|
||||
)
|
||||
|
||||
|
||||
root_agent = Agent(
|
||||
name="root_agent",
|
||||
sub_agents=[phone_recommender],
|
||||
instruction=("""\
|
||||
You are a helpful phone sales associate.
|
||||
If the user is asking for a phone recommendation, use the `phone_recommender` to get a structured recommendation.
|
||||
Once the recommender finishes, present the model, price, and reason to the user in a friendly way.
|
||||
"""),
|
||||
)
|
||||
@@ -0,0 +1,440 @@
|
||||
{
|
||||
"events": [
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "gaming, $1000"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-1",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "That sounds like a great budget for a gaming phone! To give you the best recommendation, could you tell me what size phone you prefer? Do you like something **small**, **large**, or is **any** size okay with you?"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-2",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "large"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-3",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"budget": 1000,
|
||||
"preferred_size": "large",
|
||||
"primary_use": "gaming"
|
||||
},
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-4",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL"
|
||||
},
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-5",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-6",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro Fold"
|
||||
},
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-7",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-8",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro"
|
||||
},
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-9",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-10",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10"
|
||||
},
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-11",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-12",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10a"
|
||||
},
|
||||
"id": "fc-6",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-13",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-6",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 499.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-14",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799,
|
||||
"reason": "The Pixel 10 Pro XL is the best fit for your gaming needs and preference for a large screen. At $799, it is well within your $1000 budget and provides the high performance and large display area required for an optimal gaming experience."
|
||||
},
|
||||
"id": "fc-7",
|
||||
"name": "set_model_response"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-15",
|
||||
"invocationId": "i-2",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"actions": {
|
||||
"setModelResponse": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best fit for your gaming needs and preference for a large screen. At $799, it is well within your $1000 budget and provides the high performance and large display area required for an optimal gaming experience."
|
||||
}
|
||||
},
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-7",
|
||||
"name": "set_model_response",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best fit for your gaming needs and preference for a large screen. At $799, it is well within your $1000 budget and provides the high performance and large display area required for an optimal gaming experience."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-16",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "{\"model_name\": \"Pixel 10 Pro XL\", \"price\": 799.0, \"reason\": \"The Pixel 10 Pro XL is the best fit for your gaming needs and preference for a large screen. At $799, it is well within your $1000 budget and provides the high performance and large display area required for an optimal gaming experience.\"}"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"id": "e-17",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"messageAsOutput": true,
|
||||
"outputFor": [
|
||||
"root_agent@1/phone_recommender@1"
|
||||
],
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best fit for your gaming needs and preference for a large screen. At $799, it is well within your $1000 budget and provides the high performance and large display area required for an optimal gaming experience."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-18",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "OK! Based on what you're looking for, I recommend the **Pixel 10 Pro XL**.\n\n* **Price:** $799\n* **Why it's for you:** It\u2019s the perfect fit for your gaming needs and preference for a large screen. Since it's $799, it's well under your $1,000 budget while providing the high performance and large display area you need for the best gaming experience."
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-19",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
{
|
||||
"events": [
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "gaming, $1000, large"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-1",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"budget": 1000,
|
||||
"preferred_size": "large",
|
||||
"primary_use": "gaming"
|
||||
},
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-2",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL"
|
||||
},
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-3",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-4",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro"
|
||||
},
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-5",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-6",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro Fold"
|
||||
},
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-7",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-8",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10"
|
||||
},
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-9",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-10",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799,
|
||||
"reason": "The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device."
|
||||
},
|
||||
"id": "fc-6",
|
||||
"name": "set_model_response"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-11",
|
||||
"invocationId": "i-1",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"actions": {
|
||||
"setModelResponse": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device."
|
||||
}
|
||||
},
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-6",
|
||||
"name": "set_model_response",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-12",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "{\"model_name\": \"Pixel 10 Pro XL\", \"price\": 799.0, \"reason\": \"The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device.\"}"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"id": "e-13",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"messageAsOutput": true,
|
||||
"outputFor": [
|
||||
"root_agent@1/phone_recommender@1"
|
||||
],
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-14",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "OK! Based on your preferences, I recommend the **Pixel 10 Pro XL**.\n\n* **Model:** Pixel 10 Pro XL\n* **Price:** $799\n* **Why it's for you:** The Pixel 10 Pro XL is the best choice for gaming due to its large screen and high performance. It fits perfectly within your $1000 budget and satisfies your preference for a large device."
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-15",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,383 @@
|
||||
{
|
||||
"events": [
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "go"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-1",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "Hello! I'm here to help you find the perfect Pixel phone. \n\nTo get started, could you tell me a bit about what you're looking for? Specifically:\n\n1. **What is your maximum budget?**\n2. **What size phone do you prefer?** (e.g., small, large, or doesn't matter)\n3. **What will be your primary use for the phone?** (e.g., photography, gaming, just the basics)\n\nOnce I have those details, I can give you a great recommendation!"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-2",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "$1000, gaming"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-3",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "That sounds like a great budget for a gaming-focused phone! To make sure I get the recommendation just right, **what size phone do you prefer?** (e.g., small, large, or any size)."
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-4",
|
||||
"invocationId": "i-2",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "large"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-5",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"budget": 1000,
|
||||
"preferred_size": "large",
|
||||
"primary_use": "gaming"
|
||||
},
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-6",
|
||||
"invocationId": "i-3",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL"
|
||||
},
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro Fold"
|
||||
},
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-7",
|
||||
"invocationId": "i-3",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-2",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-3",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-8",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10a"
|
||||
},
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10"
|
||||
},
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro"
|
||||
},
|
||||
"id": "fc-6",
|
||||
"name": "check_phone_price"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-9",
|
||||
"invocationId": "i-3",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-4",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 499.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-5",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-6",
|
||||
"name": "check_phone_price",
|
||||
"response": {
|
||||
"result": 799.0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-10",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionCall": {
|
||||
"args": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799,
|
||||
"reason": "The Pixel 10 Pro XL fits your budget of $1000 and matches your preference for a large screen, which is ideal for gaming. At $799, it offers the best balance of performance and display size within your requirements."
|
||||
},
|
||||
"id": "fc-7",
|
||||
"name": "set_model_response"
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-11",
|
||||
"invocationId": "i-3",
|
||||
"longRunningToolIds": [],
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"actions": {
|
||||
"setModelResponse": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL fits your budget of $1000 and matches your preference for a large screen, which is ideal for gaming. At $799, it offers the best balance of performance and display size within your requirements."
|
||||
}
|
||||
},
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-7",
|
||||
"name": "set_model_response",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL fits your budget of $1000 and matches your preference for a large screen, which is ideal for gaming. At $799, it offers the best balance of performance and display size within your requirements."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-12",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "phone_recommender",
|
||||
"branch": "phone_recommender@fc-1",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "{\"model_name\": \"Pixel 10 Pro XL\", \"price\": 799.0, \"reason\": \"The Pixel 10 Pro XL fits your budget of $1000 and matches your preference for a large screen, which is ideal for gaming. At $799, it offers the best balance of performance and display size within your requirements.\"}"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"id": "e-13",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"messageAsOutput": true,
|
||||
"outputFor": [
|
||||
"root_agent@1/phone_recommender@1"
|
||||
],
|
||||
"path": "root_agent@1/phone_recommender@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"functionResponse": {
|
||||
"id": "fc-1",
|
||||
"name": "phone_recommender",
|
||||
"response": {
|
||||
"model_name": "Pixel 10 Pro XL",
|
||||
"price": 799.0,
|
||||
"reason": "The Pixel 10 Pro XL fits your budget of $1000 and matches your preference for a large screen, which is ideal for gaming. At $799, it offers the best balance of performance and display size within your requirements."
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-14",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "root_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "Based on what you're looking for, I highly recommend the **Pixel 10 Pro XL**.\n\n* **Model:** Pixel 10 Pro XL\n* **Price:** $799\n* **Why it's perfect for you:** It fits perfectly within your $1000 budget and features the large display you prefer, which is fantastic for an immersive gaming experience. It offers a great balance of top-tier performance and screen real estate!\n\nHow does that sound to you?"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-15",
|
||||
"invocationId": "i-3",
|
||||
"nodeInfo": {
|
||||
"path": "root_agent@1"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user