Skip to main content

AgentContext

AgentContext is a small dataclass describing the currently executing agent loop:
  • agent_id
  • agent_type
  • agent_run_id
  • iteration
It is stored in a context variable so nested steps (like llm_step) can attach agent metadata to events without explicit parameter passing.

Context helpers

Helpers:
  • set_agent_context(ctx)
  • get_agent_context() -> AgentContext | None
  • clear_agent_context()

Next steps