Class AgentInWorkflow

java.lang.Object
com.example.workflows.AgentInWorkflow

public final class AgentInWorkflow extends Object
A port of ADK Kotlin's agent-in-workflow sample, which ports adk-python's agent_in_workflow workflow sample, a medical lab intake. A task agent chats with the patient until it has their name and phone number, and a function node checks them and sends the patient back to the agent when it finds no records. A single-turn agent then looks up the patient's orders with a tool that waits for the user to approve the call.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A mock lab system that looks up a patient's orders.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Workflow
    create(String model)
    Builds the workflow, with both agents on model.
    static void
    main(String[] args)
    Runs the workflow in two sessions and prints each message and tool call: in one, a patient gives an unknown name, then Jane Doe's details, and approves the orders lookup; in the other, Jane Doe declines it.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static Workflow create(String model)
      Builds the workflow, with both agents on model.
    • main

      public static void main(String[] args)
      Runs the workflow in two sessions and prints each message and tool call: in one, a patient gives an unknown name, then Jane Doe's details, and approves the orders lookup; in the other, Jane Doe declines it. It calls Gemini, so it needs the credentials the README describes; the first argument, if any, overrides the model.