Skip to main content

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.
Key Responsibilities:
  • Message handling and event orchestration
  • Agent execution loop management
  • Security policy enforcement
  • Event persistence and state management
Learn more →

2. ConversationState

Purpose: Single source of truth derived from immutable event log.
Key Features:
  • Event-sourced state management
  • Automatic persistence to disk
  • Perfect reproducibility
  • Time-travel debugging via replay
Learn more →

3. Agent

Purpose: Stateless decision-making logic that converts events to actions.
Key Features:
  • Fully stateless and immutable
  • Support for sub-agents and delegation
  • Natural pause/resume support
  • Observable via callbacks
Learn more →

4. LLM

Purpose: Unified interface to 100+ language model providers.
Key Features:
  • 100+ providers via LiteLLM
  • Native support for non-function-calling models
  • Built-in cost and token tracking
  • Multi-LLM routing
Learn more →

5. Tools

Purpose: Type-safe, extensible action execution framework.
Key Features:
  • Type-safe actions and observations
  • Native MCP support
  • Built-in production tools
  • Simple extension interface
Learn more →

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

Next Steps