ec2b666284
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
1.4 KiB
1.4 KiB
Node as Tool
Overview
Demonstrates wrapping both a regular ADK Node (using the @node decorator) and a Workflow as tools that can be automatically called by a parent Agent.
In this sample:
- The parent agent receives an inquiry about a customer's discount.
- It invokes
customer_lookup_workflow(aWorkflowwrapped as a tool) to retrieve customer status. - It then invokes
calculate_discount(a regularNodewrapped as a tool) using the retrieved status.
Sample Inputs
-
What discount does customer c123 get?The parent agent first invokes
customer_lookup_workflowto verify status, then invokescalculate_discountto determine the discount percentage, and summarizes the results.
Agent Topology Graph
graph TD
customer_service_agent[customer_service_agent] -->|calls| customer_lookup_workflow(customer_lookup_workflow)
customer_service_agent -->|calls| calculate_discount(calculate_discount)
How To
To expose an existing Node or Workflow as a tool callable by an Agent:
- Define your
Node(or@node) orWorkflowand assign both aninput_schemaand adescription. - Pass the node/workflow directly into your parent agent's
toolslist:Agent(..., tools=[my_node, my_workflow]).
Related Guides
- Workflows - Explains building complex multi-step graphs.