Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comprehensive documentation summaries #8

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions openhands/agenthub/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Agent Hub Directory

The `agenthub` directory contains various specialized agent implementations for different tasks and capabilities.

## Agent Types

### Browsing Agent (`browsing_agent/`)
- Main agent for web browsing interactions
- Includes response parsing and utility functions
- Handles web navigation and content extraction

### CodeAct Agent (`codeact_agent/`)
- Specialized for code-related actions
- Implements function calling capabilities
- Handles code analysis and modifications

### Delegator Agent (`delegator_agent/`)
- Manages task delegation between agents
- Coordinates complex multi-agent operations
- Handles agent selection and task distribution

### Visual Browsing Agent (`visualbrowsing_agent/`)
- Enhanced browsing agent with visual capabilities
- Handles visual element interaction
- Supports screenshot analysis and visual navigation

### Micro Agents (`micro/`)
- Lightweight agent implementation
- Registry for micro-agent management
- Handles simple, focused tasks

### Dummy Agent (`dummy_agent/`)
- Test implementation for agent interface
- Used for development and testing
- Provides basic agent functionality examples

## Key Features
- Modular agent design allowing easy extension
- Specialized agents for specific task types
- Common utilities and shared functionality
- Clear separation of concerns between agent types

## Implementation Details
Each agent type follows a consistent pattern:
- Clear interface definition
- Task-specific implementations
- Utility functions for common operations
- Error handling and logging

## Usage
Agents can be used individually or composed together for complex tasks. The delegator agent can coordinate between different agent types when needed.
57 changes: 57 additions & 0 deletions openhands/controller/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Controller Directory

The `controller` directory manages agent execution and task control, serving as the orchestration layer for the OpenHands framework.

## Core Components

### Agent Controller (`agent_controller.py`)
- Main controller for agent execution
- Manages agent lifecycle and state
- Handles task progression and control flow

### Action Parser (`action_parser.py`)
- Parses and validates agent actions
- Converts raw actions to structured formats
- Handles action validation and normalization

### State Management (`state/`)
- `state.py`: Manages agent and task state
- `task.py`: Task definition and management
- Handles state transitions and persistence

### Replay System (`replay.py`)
- Implements action replay capabilities
- Useful for debugging and testing
- Supports step-by-step replay of agent actions

### Stuck Detection (`stuck.py`)
- Detects when agents are stuck or in loops
- Implements recovery strategies
- Monitors agent progress and performance

## Key Features
- Centralized control of agent execution
- Robust state management system
- Action validation and parsing
- Replay capabilities for debugging
- Stuck detection and recovery

## Implementation Details
The controller system:
- Maintains agent state throughout execution
- Validates and processes agent actions
- Handles error conditions and recovery
- Provides debugging and monitoring tools

## Usage
The controller is the central coordination point for agent operations:
1. Initialize controller with agent configuration
2. Submit tasks for execution
3. Monitor and manage task progression
4. Handle completion and error states

## Integration Points
- Works with the event system for action/observation flow
- Integrates with runtime for execution environment
- Connects with memory system for state persistence
- Interfaces with security for action validation
77 changes: 77 additions & 0 deletions openhands/core/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Core Directory

The `core` directory contains the fundamental components and infrastructure of the OpenHands framework.

## Key Components

### Configuration (`config/`)
- `app_config.py`: Main application configuration
- `agent_config.py`: Agent-specific settings
- `llm_config.py`: Language model configuration
- `sandbox_config.py`: Sandbox environment settings
- `security_config.py`: Security policy configuration
- `extended_config.py`: Extended configuration options
- Configuration utilities and helpers

### Schema (`schema/`)
- `action.py`: Action data structures
- `agent.py`: Agent interface definitions
- `observation.py`: Observation data models
- Type definitions and validation

### Main Components
- `main.py`: Application entry point
- `loop.py`: Main event loop implementation
- `cli.py`: Command-line interface
- `setup.py`: Framework initialization

### Messaging System
- `message.py`: Message data structures
- `message_utils.py`: Message handling utilities
- Event and message routing

### Utilities
- `logger.py`: Logging infrastructure
- `download.py`: Resource downloading
- `exceptions.py`: Framework exceptions

## Key Features
- Centralized configuration management
- Type-safe schema definitions
- Robust logging system
- Exception handling framework
- Resource management

## Implementation Details

### Configuration System
- Hierarchical configuration structure
- Environment-aware settings
- Validation and type checking
- Extension points for custom config

### Schema System
- Strong type definitions
- Validation rules
- Serialization support
- Extensible data models

### Event Loop
- Asynchronous operation support
- Event handling and routing
- Resource management
- Error handling and recovery

## Usage
The core components provide the foundation for:
1. Application configuration
2. Type safety and validation
3. Event handling and messaging
4. Resource management
5. Logging and monitoring

## Integration Points
- Used by all other framework components
- Provides base classes and interfaces
- Manages framework lifecycle
- Handles cross-cutting concerns
78 changes: 78 additions & 0 deletions openhands/events/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Events Directory

The `events` directory implements the event system that handles actions, observations, and their serialization in the OpenHands framework.

## Core Components

### Action Events (`action/`)
- `action.py`: Base action event definitions
- `agent.py`: Agent-specific actions
- `browse.py`: Web browsing actions
- `commands.py`: Command execution actions
- `files.py`: File operation actions
- `message.py`: Message handling actions
- `empty.py`: Empty action handling

### Observation Events (`observation/`)
- `observation.py`: Base observation types
- `agent.py`: Agent observations
- `browse.py`: Browser operation results
- `commands.py`: Command execution results
- `delegate.py`: Delegation results
- `error.py`: Error observations
- `files.py`: File operation results
- `reject.py`: Action rejection events
- `success.py`: Success event handling

### Serialization (`serialization/`)
- `action.py`: Action serialization
- `event.py`: Event serialization base
- `observation.py`: Observation serialization
- `utils.py`: Serialization utilities

### Event Management
- `stream.py`: Event streaming
- `tool.py`: Tool event handling
- `utils.py`: Event utilities
- `event.py`: Base event definitions

## Key Features
- Comprehensive event type system
- Bidirectional event flow (actions/observations)
- Serialization support for all events
- Stream-based event processing
- Error handling and recovery

## Implementation Details

### Event Types
- Actions: Commands from agents
- Observations: Results and feedback
- Tools: Tool-specific events
- System: Framework events

### Event Flow
1. Actions generated by agents
2. Actions processed by handlers
3. Observations generated from results
4. Observations routed to agents

### Serialization
- JSON-based serialization
- Type preservation
- Validation on serialization/deserialization
- Stream support

## Usage
The event system is used for:
1. Agent-system communication
2. Action processing and routing
3. Result observation handling
4. Tool integration
5. System state management

## Integration Points
- Used by controller for action handling
- Integrated with runtime for execution
- Connected to memory for event storage
- Used by agents for communication
79 changes: 79 additions & 0 deletions openhands/llm/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# LLM (Language Model) Directory

The `llm` directory contains components for interacting with Large Language Models, providing abstractions and utilities for model integration.

## Core Components

### Base Implementations
- `llm.py`: Base LLM interface and implementation
- `async_llm.py`: Asynchronous LLM operations
- `streaming_llm.py`: Streaming response handling
- `bedrock.py`: AWS Bedrock integration

### Function Calling
- `fn_call_converter.py`: Function call parsing and conversion
- Handles structured function calls from LLM responses
- Converts between different function calling formats

### Mixins
- `debug_mixin.py`: Debugging capabilities
- `retry_mixin.py`: Retry logic for failed calls
- Enhances base LLM functionality

### Metrics
- `metrics.py`: Performance and usage metrics
- Tracks token usage, latency, and costs
- Provides monitoring capabilities

## Key Features
- Unified LLM interface
- Async and streaming support
- Function calling capabilities
- Retry and error handling
- Performance monitoring
- Multiple model support

## Implementation Details

### LLM Interface
- Common interface for all models
- Support for different model providers
- Configurable parameters
- Response validation

### Async Operations
- Non-blocking API calls
- Concurrent request handling
- Stream processing
- Resource management

### Function Calling
- Structured output parsing
- Function definition handling
- Type validation
- Error recovery

### Monitoring
- Token counting
- Cost tracking
- Latency monitoring
- Usage statistics

## Usage
The LLM components are used for:
1. Model interaction
2. Function calling
3. Response streaming
4. Error handling
5. Performance monitoring

## Integration Points
- Used by agents for decision making
- Integrated with memory system
- Connected to security for validation
- Used by controller for task processing

## Supported Models
- OpenAI GPT models
- AWS Bedrock models
- Extensible for other providers
Loading
Loading