Class SingleTurnSubAgentDemo

java.lang.Object
com.example.workflows.SingleTurnSubAgentDemo

public final class SingleTurnSubAgentDemo extends Object
A port of ADK Kotlin's single-turn sub-agent sample, which ports adk-python's single_turn_sub_agent. A phone sales assistant turns the user's request into structured preferences and calls a single-turn sub-agent, which checks prices with a tool and returns a structured recommendation without talking to the user. Unlike an AgentTool, the sub-agent's tool calls stay in the session history.
  • Method Details

    • create

      public static Workflow create(String model)
      Builds a workflow with the sales assistant as its only node, running both agents on model. A single-turn sub-agent runs as a tool only when its parent runs as a workflow node.
    • main

      public static void main(String[] args)
      Runs one recommendation request and prints each message and tool call. It calls Gemini and requires the credentials described in the README; the first argument, if any, overrides the model.