# 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 Summary

  Constructors
  Constructor
  Description
  `PlanningContext(InvocationContext invocationContext, com.google.common.collect.ImmutableList<BaseAgent> availableAgents)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `com.google.common.collect.ImmutableList<BaseAgent>`
  `availableAgents()`
  Returns the sub-agents available for the planner to select from.
  `List<Event>`
  `events()`
  Returns all events in the current session.
  `BaseAgent`
  `findAgent(String name)`
  Finds an available agent by name.
  `InvocationContext`
  `invocationContext()`
  Returns the full `InvocationContext` for advanced use cases.
  `Map<String,Object>`
  `state()`
  Returns the session state — the shared "world state" that agents read and write.
  `Optional<com.google.genai.types.Content>`
  `userContent()`
  Returns the user content that initiated this invocation, if any.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.