chore: import upstream snapshot with attribution
Continuous Integration / Pre-commit Linter (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.10) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.11) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.12) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.10) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.11) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.12) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.14) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Waiting to run
Copybara PR Handler / close-imported-pr (push) Waiting to run
Continuous Integration / Pre-commit Linter (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.10) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.11) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.12) (push) Waiting to run
Continuous Integration / Mypy Check (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.10) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.11) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.12) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.13) (push) Waiting to run
Continuous Integration / Unit Tests (Python 3.14) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.10) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.11) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.12) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.13) (push) Waiting to run
Continuous Integration / A2A v0.3 Tests (Python 3.14) (push) Waiting to run
Copybara PR Handler / close-imported-pr (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
# ADK Workflow Sequence Sample
|
||||
|
||||
## Overview
|
||||
|
||||
This sample demonstrates how to create a simple sequential workflow with **ADK Workflows**.
|
||||
|
||||
It connects two LLM agents in a chain. The first agent (`generate_fruit_agent`) is instructed to return the name of a random fruit. The output of this agent becomes the input for the second agent (`generate_benefit_agent`), which then tells a health benefit about that specific fruit.
|
||||
|
||||
In a sequence, the execution flows unconditionally from one node to the next in the order they are defined.
|
||||
|
||||
## Sample Inputs
|
||||
|
||||
This sample does not require any input to run.
|
||||
|
||||
## Graph
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
START --> generate_fruit_agent
|
||||
generate_fruit_agent --> generate_benefit_agent
|
||||
```
|
||||
|
||||
## How To
|
||||
|
||||
1. Define the agents or functions that will make up the steps in your sequence.
|
||||
|
||||
```python
|
||||
generate_fruit_agent = Agent(...)
|
||||
generate_benefit_agent = Agent(...)
|
||||
```
|
||||
|
||||
1. Pass a tuple of three or more elements to `edges` to define an unconditional sequence starting from the first element and passing through each subsequent node in order.
|
||||
|
||||
```python
|
||||
Workflow(
|
||||
name="root_agent",
|
||||
edges=[("START", generate_fruit_agent, generate_benefit_agent)],
|
||||
)
|
||||
```
|
||||
@@ -0,0 +1,15 @@
|
||||
# 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 . import agent
|
||||
@@ -0,0 +1,35 @@
|
||||
# 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.
|
||||
|
||||
"""Sample workflow for simple sequential workflow with LLM agents."""
|
||||
|
||||
from google.adk import Agent
|
||||
from google.adk import Workflow
|
||||
|
||||
generate_fruit_agent = Agent(
|
||||
name="generate_fruit_agent",
|
||||
instruction="""Return the name of a random fruit.
|
||||
Return only the name, nothing else.""",
|
||||
)
|
||||
|
||||
generate_benefit_agent = Agent(
|
||||
name="generate_benefit_agent",
|
||||
instruction="""Tell me a health benefit about the specified fruit.""",
|
||||
)
|
||||
|
||||
|
||||
root_agent = Workflow(
|
||||
name="root_agent",
|
||||
edges=[("START", generate_fruit_agent, generate_benefit_agent)],
|
||||
)
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"appName": "sequence",
|
||||
"events": [
|
||||
{
|
||||
"author": "user",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "go"
|
||||
}
|
||||
],
|
||||
"role": "user"
|
||||
},
|
||||
"id": "e-1",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"path": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "generate_fruit_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "Apple"
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-2",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"messageAsOutput": true,
|
||||
"outputFor": [
|
||||
"root_agent@1/generate_fruit_agent@1"
|
||||
],
|
||||
"path": "root_agent@1/generate_fruit_agent@1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"author": "generate_benefit_agent",
|
||||
"content": {
|
||||
"parts": [
|
||||
{
|
||||
"text": "Apples are a good source of **dietary fiber**, particularly soluble fiber like pectin. This can help with digestion, promote a feeling of fullness (aiding in weight management), and may contribute to lowering cholesterol levels."
|
||||
}
|
||||
],
|
||||
"role": "model"
|
||||
},
|
||||
"finishReason": "STOP",
|
||||
"id": "e-3",
|
||||
"invocationId": "i-1",
|
||||
"nodeInfo": {
|
||||
"messageAsOutput": true,
|
||||
"outputFor": [
|
||||
"root_agent@1/generate_benefit_agent@1",
|
||||
"root_agent@1"
|
||||
],
|
||||
"path": "root_agent@1/generate_benefit_agent@1"
|
||||
}
|
||||
}
|
||||
],
|
||||
"id": "0e5ab646-61d6-49cd-b058-24fde0afebae",
|
||||
"state": {
|
||||
"__session_metadata__": {
|
||||
"displayName": "go"
|
||||
}
|
||||
},
|
||||
"userId": "user"
|
||||
}
|
||||
Reference in New Issue
Block a user