Skip to main content

openhands.controller.state.state

State Objects

@dataclass
class State()

Represents the running state of an agent in the OpenHands system, saving data of its operation and memory.

  • Multi-agent/delegate state:

    • store the task (conversation between the agent and the user)
    • the subtask (conversation between an agent and the user or another agent)
    • global and local iterations
    • delegate levels for multi-agent interactions
    • almost stuck state
  • Running state of an agent:

    • current agent state (e.g., LOADING, RUNNING, PAUSED)
    • traffic control state for rate limiting
    • confirmation mode
    • the last error encountered
  • Data for saving and restoring the agent:

    • save to and restore from a session
    • serialize with pickle and base64
  • Save / restore data about message history

    • start and end IDs for events in agent's history
    • summaries and delegate summaries
  • Metrics:

    • global metrics for the current task
    • local metrics for the current subtask
  • Extra data:

    • additional task-specific data

get_current_user_intent

def get_current_user_intent() -> tuple[str | None, list[str] | None]

Returns the latest user message and image(if provided) that appears after a FinishAction, or the first (the task) if nothing was finished yet.