Class TaskSubAgentDemo

java.lang.Object
com.example.workflows.TaskSubAgentDemo

public final class TaskSubAgentDemo extends Object
A port of ADK Kotlin's task sub-agent sample, which ports adk-python's task_sub_agent: a food-delivery coordinator delegates to two task sub-agents, one that collects the order and one that collects the payment details. Each holds its own conversation with the user until it finishes its task with structured data, which answers the coordinator's call, and the coordinator then places the order with a tool.
  • Method Details

    • create

      public static Workflow create(String model)
      Builds a workflow with the coordinator as its only node, running every agent on model. A task sub-agent runs as a tool only when its parent runs as a workflow node.
    • main

      public static void main(String[] args)
      Runs a conversation in which the user orders food and then pays, printing each message and tool call and approving any tool call that asks. It calls Gemini, so it needs the credentials the README describes; the first argument, if any, overrides the model.