Core Components
The OpenHands SDK consists of five core components that work together to provide a robust, production-ready agent framework. This section provides detailed documentation for each component.Component Interaction
Components Overview
1. Conversation
Purpose: Orchestrates the agent execution loop and provides the main API.- Message handling and event orchestration
- Agent execution loop management
- Security policy enforcement
- Event persistence and state management
2. ConversationState
Purpose: Single source of truth derived from immutable event log.- Event-sourced state management
- Automatic persistence to disk
- Perfect reproducibility
- Time-travel debugging via replay
3. Agent
Purpose: Stateless decision-making logic that converts events to actions.- Fully stateless and immutable
- Support for sub-agents and delegation
- Natural pause/resume support
- Observable via callbacks
4. LLM
Purpose: Unified interface to 100+ language model providers.- 100+ providers via LiteLLM
- Native support for non-function-calling models
- Built-in cost and token tracking
- Multi-LLM routing
5. Tools
Purpose: Type-safe, extensible action execution framework.- Type-safe actions and observations
- Native MCP support
- Built-in production tools
- Simple extension interface
Event Flow
The components interact through events in a simple action-observation loop:State Management
All state is derived from the event log, ensuring perfect reproducibility:Configuration Pattern
All components use immutable, type-safe configuration:Persistence and Replay
Events automatically persist and can be replayed for debugging:Component Documentation
- Conversation - Orchestration and API
- ConversationState - Event-sourced state management
- Agent - Stateless decision logic
- LLM - Model abstraction and routing
- Tools - Action execution framework
Next Steps
- Architecture Overview - High-level system design
- Advanced Features - Context management, workflows
- Security - Defense in depth
- Production - Deploy at scale

