Ready ctx posts ns en api virtfoundry.io workloads 19/19

An AI agent built with YAML: a team of agents in Google ADK, at zero cost

An AI agent built with YAML: a team of agents in Google ADK, at zero cost

A single agent does not have to do everything. In the previous episode the agent answered in JSON; now there are several agents, and a coordinator decides who answers each message, still with no per-call cost. This is the fifth video of the series ADK, from beginner to advanced (in Portuguese), and the code is in the repository .

The team in Python

Three specialist agents, each with its own tool (saudar, registrar_pedido and despedir: greet, register an order, say goodbye), and the root_agent, which receives them all in sub_agents:

python
saudacao_agent = Agent(
    model=MODEL,
    name="saudacao_agent",
    description="Cuida de cumprimentos e saudações.",
    instruction="Use saudar com o nome do usuário e responda com o resultado da tool.",
    tools=[saudar],
)
# pedido_agent and despedida_agent follow the same pattern

root_agent = Agent(
    model=MODEL,
    name="coordenador",
    description="Coordenador que delega para os especialistas.",
    instruction="Delegue cumprimentos para saudacao_agent, pedidos para pedido_agent e despedidas para despedida_agent. Qualquer outra coisa, responda você mesmo.",
    sub_agents=[saudacao_agent, pedido_agent, despedida_agent],
)

Each agent’s description is what the coordinator reads to decide who to delegate to. The more specific the instruction, the more precise the answer, especially with a local model.

The model is Qwen 3.5 4B in LM Studio, with temperature=0 and extra_body={"reasoning_effort": "none"} to drop the reasoning from the conversation.

The same team in YAML

agent.py now declares only the root_agent, which reads root_agent.yaml:

yaml
agent_class: LlmAgent
name: coordenador
model_code:
  name: yaml_code_team.models.local_model
description: Coordenador que delega para os especialistas.
instruction: |
  Delegue cumprimentos para saudacao_agent, pedidos para pedido_agent e despedidas para despedida_agent.
sub_agents:
  - config_path: agents/saudacao_agent.yaml
  - config_path: agents/pedido_agent.yaml
  - config_path: agents/despedida_agent.yaml

Each agent has its own YAML in the agents/ folder, and the tools stay in tools.py, referenced by name.

YAML only, no agent.py

In the third form the folder has no agent.py at all: just root_agent.yaml, models.py and tools.py. adk web enters the folder, looks for root_agent.yaml and loads the team. The code gets simpler and the configuration is separate from the implementation.

Running

bash
uv sync
uv run adk web

Pick team_agent, yaml_code_team or yaml_team (the graph is the same: the coordinator and three agents, each with its own tool) and try:

  • “Hi, my name is Matheus” (in Portuguese): the coordinator delegates to saudacao_agent and gets “Olá, Matheus!” back.
  • “I want a pizza and a Coke”: goes to pedido_agent, which uses registrar_pedido.
  • “Ok, thanks, bye”: goes to despedida_agent.

The events tab shows each transfer_to_agent, so you can see who the message was delegated to.

Caveats

  • Small local models may delegate to the wrong agent. Clear descriptions help.
  • Each agent can have its own model: local for the simple ones, a bigger model for the hard ones.
  • The YAML format is an ADK configuration; check the documentation for what your version accepts.

Next steps

Here the model decides who works. In the next episode the flow changes: agents in sequence and in parallel. Which form would you use in your project, Python or YAML? Tell me in the video comments.

kubectl get events