Class PlanningContext

java.lang.Object
com.google.adk.agents.PlanningContext

public class PlanningContext extends Object
Context provided to a Planner during the planning loop.

Wraps an InvocationContext to expose the session state (world state), events, and available sub-agents. Planners use this to inspect the current state and decide which agent(s) to run next.

  • Constructor Details

    • PlanningContext

      public PlanningContext(InvocationContext invocationContext, com.google.common.collect.ImmutableList<BaseAgent> availableAgents)
  • Method Details

    • state

      public Map<String,Object> state()
      Returns the session state — the shared "world state" that agents read and write.
    • events

      public List<Event> events()
      Returns all events in the current session.
    • availableAgents

      public com.google.common.collect.ImmutableList<BaseAgent> availableAgents()
      Returns the sub-agents available for the planner to select from.
    • userContent

      public Optional<com.google.genai.types.Content> userContent()
      Returns the user content that initiated this invocation, if any.
    • findAgent

      public BaseAgent findAgent(String name)
      Finds an available agent by name.
      Throws:
      IllegalArgumentException - if no agent with the given name is found.
    • invocationContext

      public InvocationContext invocationContext()
      Returns the full InvocationContext for advanced use cases.