1
Import your agents and tools
Ensure that the agents and tools you want to connect in a agentic workflow are already imported.
2
Define a Python function with the @flow decorator
Use the
@flow
decorator to define your agentic workflow. In the decorator, specify the agentic workflow’s name
, display_name
, description
, input_schema
, output_schema
, initiators
, schedulable
, llm_model
, and agent_conversation_memory_turns_limit
.- The function must take a single parameter of type
Flow
and return aFlow
object. - Construct the agentic workflow using a combination of
tool()
,agent()
, and edge-building functions likesequence()
oredge()
. - For
Branch
andLoop
nodes, use a Python expression in theevaluator
to define the branching or looping condition. For more information, see Agentic workflow expressions.
Example 1: Sequencing two toolsFor the full example and complete code, see hello_message_flow.
Python
3
Import the agentic workflow
Import the agentic workflow as a tool using the
orchestrate tools import
command in the CLI.BASH
4
Test the agentic workflow locally in the ADK
Test the agentic workflow you created using a Python script before adding it to an agent. For more information, see Testing flows.
5
Add the agentic workflow to one agent
After successfully testing the agentic workflow, add it to an agent’s specification and update the agent.