π OpenHands: AI-Driven Development
Document changes for Micro-Agents and some formatting changes (#6155)
mamoodi63133c0ba9fe
diff --git a/docs/modules/usage/configuration-options.md b/docs/modules/usage/configuration-options.mdindex 29c9b67595..cfebdec25a 100644--- a/docs/modules/usage/configuration-options.md+++ b/docs/modules/usage/configuration-options.md@@ -7,53 +7,11 @@ If you are running in [GUI Mode](https://docs.all-hands.dev/modules/usage/how-totake precedence.:::------# Table of Contents--- [Core Configuration](#core-configuration)- - [API Keys](#api-keys)- - [Workspace](#workspace)- - [Debugging and Logging](#debugging-and-logging)- - [Session Management](#session-management)- - [Trajectories](#trajectories)- - [File Store](#file-store)- - [Task Management](#task-management)- - [Sandbox Configuration](#sandbox-configuration)- - [Miscellaneous](#miscellaneous)-- [LLM Configuration](#llm-configuration)- - [AWS Credentials](#aws-credentials)- - [API Configuration](#api-configuration)- - [Custom LLM Provider](#custom-llm-provider)- - [Embeddings](#embeddings)- - [Message Handling](#message-handling)- - [Model Selection](#model-selection)- - [Retrying](#retrying)- - [Advanced Options](#advanced-options)-- [Agent Configuration](#agent-configuration)- - [Microagent Configuration](#microagent-configuration)- - [Memory Configuration](#memory-configuration)- - [LLM Configuration](#llm-configuration-2)- - [ActionSpace Configuration](#actionspace-configuration)- - [Microagent Usage](#microagent-usage)-- [Sandbox Configuration](#sandbox-configuration)- - [Execution](#execution)- - [Container Image](#container-image)- - [Networking](#networking)- - [Linting and Plugins](#linting-and-plugins)- - [Dependencies and Environment](#dependencies-and-environment)- - [Evaluation](#evaluation)-- [Security Configuration](#security-configuration)- - [Confirmation Mode](#confirmation-mode)- - [Security Analyzer](#security-analyzer)------## Core ConfigurationThe core configuration options are defined in the `[core]` section of the `config.toml` file.-**API Keys**+### API Keys- `e2b_api_key`- Type: `str`- Default: `""`@@ -69,7 +27,7 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `""`- Description: API token secret for Modal-**Workspace**+### Workspace- `workspace_base`- Type: `str`- Default: `"./workspace"`@@ -80,7 +38,7 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `"/tmp/cache"`- Description: Cache directory path-**Debugging and Logging**+### Debugging and Logging- `debug`- Type: `bool`- Default: `false`@@ -91,13 +49,13 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `false`- Description: Disable color in terminal output-**Trajectories**+### Trajectories- `trajectories_path`- Type: `str`- Default: `"./trajectories"`- Description: Path to store trajectories (can be a folder or a file). If it's a folder, the trajectories will be saved in a file named with the session id name and .json extension, in that folder.-**File Store**+### File Store- `file_store_path`- Type: `str`- Default: `"/tmp/file_store"`@@ -128,7 +86,7 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `[".*"]`- Description: List of allowed file extensions for uploads-**Task Management**+### Task Management- `max_budget_per_task`- Type: `float`- Default: `0.0`@@ -139,7 +97,7 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `100`- Description: Maximum number of iterations-**Sandbox Configuration**+### Sandbox Configuration- `workspace_mount_path_in_sandbox`- Type: `str`- Default: `"/workspace"`@@ -155,7 +113,7 @@ The core configuration options are defined in the `[core]` section of the `confi- Default: `""`- Description: Path to rewrite the workspace mount path to. You can usually ignore this, it refers to special cases of running inside another container.-**Miscellaneous**+### Miscellaneous- `run_as_openhands`- Type: `bool`- Default: `true`@@ -182,7 +140,7 @@ The LLM (Large Language Model) configuration options are defined in the `[llm]`To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LLM_NUM_RETRIES`.-**AWS Credentials**+### AWS Credentials- `aws_access_key_id`- Type: `str`- Default: `""`@@ -198,7 +156,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL- Default: `""`- Description: AWS secret access key-**API Configuration**+### API Configuration- `api_key`- Type: `str`- Default: `None`@@ -224,13 +182,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL- Default: `0.0`- Description: Cost per output token-**Custom LLM Provider**+### Custom LLM Provider- `custom_llm_provider`- Type: `str`- Default: `""`- Description: Custom LLM provider-**Embeddings**+### Embeddings- `embedding_base_url`- Type: `str`- Default: `""`@@ -246,7 +204,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL- Default: `"local"`- Description: Embedding model to use-**Message Handling**+### Message Handling- `max_message_chars`- Type: `int`- Default: `30000`@@ -262,13 +220,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL- Default: `0`- Description: Maximum number of output tokens-**Model Selection**+### Model Selection- `model`- Type: `str`- Default: `"claude-3-5-sonnet-20241022"`- Description: Model to use-**Retrying**+### Retrying- `num_retries`- Type: `int`- Default: `8`@@ -289,7 +247,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL- Default: `2.0`- Description: Multiplier for exponential backoff calculation-**Advanced Options**+### Advanced Options- `drop_params`- Type: `bool`- Default: `false`@@ -329,13 +287,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LLThe agent configuration options are defined in the `[agent]` and `[agent.<agent_name>]` sections of the `config.toml` file.-**Microagent Configuration**+### Microagent Configuration- `micro_agent_name`- Type: `str`- Default: `""`- Description: Name of the micro agent to use for this agent-**Memory Configuration**+### Memory Configuration- `memory_enabled`- Type: `bool`- Default: `false`@@ -346,13 +304,13 @@ The agent configuration options are defined in the `[agent]` and `[agent.<agent_- Default: `3`- Description: The maximum number of threads indexing at the same time for embeddings-**LLM Configuration**+### LLM Configuration- `llm_config`- Type: `str`- Default: `'your-llm-config-group'`- Description: The name of the LLM config to use-**ActionSpace Configuration**+### ActionSpace Configuration- `function_calling`- Type: `bool`- Default: `true`@@ -373,7 +331,7 @@ The agent configuration options are defined in the `[agent]` and `[agent.<agent_- Default: `false`- Description: Whether Jupyter is enabled in the action space-**Microagent Usage**+### Microagent Usage- `use_microagents`- Type: `bool`- Default: `true`@@ -390,7 +348,7 @@ The sandbox configuration options are defined in the `[sandbox]` section of theTo use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-e SANDBOX_TIMEOUT`.-**Execution**+### Execution- `timeout`- Type: `int`- Default: `120`@@ -401,19 +359,19 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-- Default: `1000`- Description: Sandbox user ID-**Container Image**+### Container Image- `base_container_image`- Type: `str`- Default: `"nikolaik/python-nodejs:python3.12-nodejs22"`- Description: Container image to use for the sandbox-**Networking**+### Networking- `use_host_network`- Type: `bool`- Default: `false`- Description: Use host network-**Linting and Plugins**+### Linting and Plugins- `enable_auto_lint`- Type: `bool`- Default: `false`@@ -424,7 +382,7 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-- Default: `true`- Description: Whether to initialize plugins-**Dependencies and Environment**+### Dependencies and Environment- `runtime_extra_deps`- Type: `str`- Default: `""`@@ -435,7 +393,7 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-- Default: `{}`- Description: Environment variables to set at the launch of the runtime-**Evaluation**+### Evaluation- `browsergym_eval_env`- Type: `str`- Default: `""`@@ -447,13 +405,13 @@ The security configuration options are defined in the `[security]` section of thTo use these with the docker command, pass in `-e SECURITY_<option>`. Example: `-e SECURITY_CONFIRMATION_MODE`.-**Confirmation Mode**+### Confirmation Mode- `confirmation_mode`- Type: `bool`- Default: `false`- Description: Enable confirmation mode-**Security Analyzer**+### Security Analyzer- `security_analyzer`- Type: `str`- Default: `""`diff --git a/docs/modules/usage/how-to/cli-mode.md b/docs/modules/usage/how-to/cli-mode.mdindex 0bb888c4ff..eec616a8ed 100644--- a/docs/modules/usage/how-to/cli-mode.md+++ b/docs/modules/usage/how-to/cli-mode.md@@ -58,7 +58,7 @@ Here are some examples of CLI commands and their expected outputs:### Example 1: Simple Task```bash-How can I help? >> Write a Python script that prints "Hello, World!"+>> Write a Python script that prints "Hello, World!"```Expected Output:@@ -72,7 +72,7 @@ Expected Output:### Example 2: Bash Command```bash-How can I help? >> Create a directory named "test_dir"+>> Create a directory named "test_dir"```Expected Output:@@ -86,7 +86,7 @@ Expected Output:### Example 3: Error Handling```bash-How can I help? >> Delete a non-existent file+>> Delete a non-existent file```Expected Output:diff --git a/docs/modules/usage/how-to/gui-mode.md b/docs/modules/usage/how-to/gui-mode.mdindex 11feafb760..483f8869e9 100644--- a/docs/modules/usage/how-to/gui-mode.md+++ b/docs/modules/usage/how-to/gui-mode.md@@ -76,18 +76,18 @@ When using OpenHands in online mode, the GitHub OAuth flow:Common issues and solutions:-1. **Token Not Recognized**:+- **Token Not Recognized**:- Ensure the token is properly saved in settings.- Check that the token hasn't expired.- Verify the token has the required scopes.- Try regenerating the token.-2. **Organization Access Denied**:+- **Organization Access Denied**:- Check if SSO is required but not enabled.- Verify organization membership.- Contact organization admin if token policies are blocking access.-3. **Verifying Token Works**:+- **Verifying Token Works**:- The app will show a green checkmark if the token is valid.- Try accessing a repository to confirm permissions.- Check the browser console for any error messages.diff --git a/docs/modules/usage/how-to/persist-session-data.md b/docs/modules/usage/how-to/persist-session-data.mddeleted file mode 100644index fcdfab504c..0000000000--- a/docs/modules/usage/how-to/persist-session-data.md+++ /dev/null@@ -1,16 +0,0 @@-# Persisting Session Data--Using the standard Development Workflow, the session data is stored in memory. Currently, if OpenHands' service is restarted,-previous sessions become invalid (a new secret is generated) and thus not recoverable.--## How to Persist Session Data--### Development Workflow-In the `config.toml` file, specify the following:-```-[core]-...-file_store="local"-file_store_path="/absolute/path/to/openhands/cache/directory"-jwt_secret="secretpass"-```diff --git a/docs/modules/usage/prompting/microagents-overview.md b/docs/modules/usage/prompting/microagents-overview.mdnew file mode 100644index 0000000000..acfe4a1ed7--- /dev/null+++ b/docs/modules/usage/prompting/microagents-overview.md@@ -0,0 +1,36 @@+# Microagents Overview++Microagents are specialized prompts that enhance OpenHands with domain-specific knowledge, repository-specific context+and task-specific workflows. They help by providing expert guidance, automating common tasks, and ensuring+consistent practices across projects.++## Microagent Types++Currently OpenHands supports the following types of microagents:++* [Repository Microagents](./microagents-repo): Repository-specific context and guidelines for OpenHands.+* [Public Microagents](./microagents-public): General guidelines triggered by keywords for all OpenHands users.++When OpenHands works with a repository, it:++1. Loads repository-specific instructions from `.openhands/microagents/` if present in the repository.+2. Loads general guidelines triggered by keywords in conversations.+See current [Public Microagents](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge).++## Microagent Format++All microagents use markdown files with YAML frontmatter that have special instructions to help OpenHands accomplish+tasks:+```+---+name: <Name of the microagent>+type: <MicroAgent type>+version: <MicroAgent version>+agent: <The agent type (Typically CodeActAgent)>+triggers:+- <Optional keywords triggering the microagent. If triggers are removed, it will always be included>+---++<Markdown with any special guidelines, instructions, and prompts that OpenHands should follow.+Check out the specific documentation for each microagent on best practices for more information.>+```diff --git a/docs/modules/usage/prompting/microagents-public.md b/docs/modules/usage/prompting/microagents-public.mdindex f966977bf2..0902ab4433 100644--- a/docs/modules/usage/prompting/microagents-public.md+++ b/docs/modules/usage/prompting/microagents-public.md@@ -1,31 +1,21 @@-# Public Micro-Agents--OpenHands uses specialized micro-agents to handle specific tasks and contexts efficiently. These micro-agents are small,-focused components that provide specialized behavior and knowledge for particular scenarios.+# Public Microagents## Overview-Public micro-agents are defined in markdown files under the+Public microagents are specialized guidelines triggered by keywords for all OpenHands users.+They are defined in markdown files under the[`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge) directory.-Each micro-agent is configured with:--- A unique name.-- The agent type (typically CodeActAgent).-- Trigger keywords that activate the agent.-- Specific instructions and capabilities.-### Integration--Public micro-agents are automatically integrated into OpenHands' workflow. They:+Public microagents:- Monitor incoming commands for their trigger words.- Activate when relevant triggers are detected.- Apply their specialized knowledge and capabilities.- Follow their specific guidelines and restrictions.-## Available Public Micro-Agents+## Current Public Microagents-For more information about specific micro-agents, refer to their individual documentation files in-the [`micro-agents`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents) directory.+For more information about specific microagents, refer to their individual documentation files in+the [`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/) directory.### GitHub Agent**File**: `github.md`@@ -66,105 +56,54 @@ Usage Example:yes | npm install package-name```-### Custom Public Micro-Agents+## Contributing a Public Microagent-You can create your own public micro-agents by adding new markdown files to the `microagents/knowledge/` directory.-Each file should follow this structure:+You can create your own public microagents by adding new markdown files to the+[`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/) directory.-```markdown-----name: agent_name-agent: CodeActAgent-triggers:-- trigger_word1-- trigger_word2----+### Public Microagents Best Practices-Instructions and capabilities for the micro-agent...-```--## Working With Public Micro-Agents--When working with public micro-agents:-- **Use Appropriate Triggers**: Ensure your commands include the relevant trigger words to activate the correct micro-agent.-- **Follow Agent Guidelines**: Each agent has specific instructions and limitations. Respect these for optimal results.-- **API-First Approach**: When available, use API endpoints rather than web interfaces.-- **Automation Friendly**: Design commands that work well in non-interactive environments.--## Contributing a Public Micro-Agent--Best practices for creating public micro-agents:--- **Clear Scope**: Keep the micro-agent focused on a specific domain or task.+- **Clear Scope**: Keep the microagent focused on a specific domain or task.- **Explicit Instructions**: Provide clear, unambiguous guidelines.- **Useful Examples**: Include practical examples of common use cases.- **Safety First**: Include necessary warnings and constraints.-- **Integration Awareness**: Consider how the micro-agent interacts with other components.+- **Integration Awareness**: Consider how the microagent interacts with other components.-To contribute a new micro-agent to OpenHands:+### Steps to Contribute a Public Microagent-### 1. Plan the Public Micro-Agent+#### 1. Plan the Public Microagent-Before creating a public micro-agent, consider:+Before creating a public microagent, consider:- What specific problem or use case will it address?- What unique capabilities or knowledge should it have?- What trigger words make sense for activating it?- What constraints or guidelines should it follow?-### 2. File Structure--Create a new markdown file in `microagents/knowledge/` with a descriptive name (e.g., `docker.md` for a Docker-focused agent).+#### 2. Create File-### 3. Required Components+Create a new markdown file in [`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/)+with a descriptive name (e.g., `docker.md` for a Docker-focused agent).-The micro-agent file must include:--- **Front Matter**: YAML metadata at the start of the file:-```markdown-----name: your_agent_name-agent: CodeActAgent-triggers:-- trigger_word1-- trigger_word2-----```--- **Instructions**: Clear, specific guidelines for the agent's behavior:-```markdown-You are responsible for [specific task/domain].--Key responsibilities:-1. [Responsibility 1]-2. [Responsibility 2]--Guidelines:-- [Guideline 1]-- [Guideline 2]--Examples of usage:-[Example 1]-[Example 2]-```+Update the file with the required frontmatter [according to the required format](./microagents-overview#microagent-format)+and the required specialized guidelines while following the [best practices above](#public-microagents-best-practices).-### 4. Testing the Public Micro-Agent+#### 3. Testing the Public Microagent-Before submitting:- Test the agent with various prompts.- Verify trigger words activate the agent correctly.- Ensure instructions are clear and comprehensive.- Check for potential conflicts with existing agents.-### 5. Submission Process+#### 4. Submission ProcessSubmit a pull request with:-- The new micro-agent file.+- The new microagent file.- Updated documentation if needed.- Description of the agent's purpose and capabilities.-### Example Public Micro-Agent Implementation+### Example Public Microagent Implementation-Here's a template for a new micro-agent:+Here's a template for a new microagent:```markdown---@@ -210,5 +149,5 @@ Remember to:- Optimize for build time and image size```-Remember that micro-agents are a powerful way to extend OpenHands' capabilities in specific domains. Well-designed-agents can significantly improve the system's ability to handle specialized tasks.+See the [current public micro-agents](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge) for+more examples.diff --git a/docs/modules/usage/prompting/microagents-repo.md b/docs/modules/usage/prompting/microagents-repo.mdindex 3d294f22d4..0eecee7618 100644--- a/docs/modules/usage/prompting/microagents-repo.md+++ b/docs/modules/usage/prompting/microagents-repo.md@@ -1,25 +1,51 @@-# Repository Micro-Agents+# Repository Microagents++## OverviewOpenHands can be customized to work more effectively with specific repositories by providing repository-specific contextand guidelines. This section explains how to optimize OpenHands for your project.-## Repository Configuration+## Creating a Repository Micro-AgentYou can customize OpenHands' behavior for your repository by creating a `.openhands/microagents/` directory in your repository's root.-At minimum, it should contain the file+At minimum it should contain the file`.openhands/microagents/repo.md`, which includes instructions that willbe given to the agent every time it works with this repository.-We suggest including the following information:+### Repository Microagents Best Practices++- **Keep Instructions Updated**: Regularly update your `.openhands/microagents/` directory as your project evolves.+- **Be Specific**: Include specific paths, patterns, and requirements unique to your project.+- **Document Dependencies**: List all tools and dependencies required for development.+- **Include Examples**: Provide examples of good code patterns from your project.+- **Specify Conventions**: Document naming conventions, file organization, and code style preferences.++### Steps to Create a Repository Microagent++#### 1. Plan the Repository Microagent+When creating a repository-specific micro-agent, we suggest including the following information:- **Repository Overview**: A brief description of your project's purpose and architecture.- **Directory Structure**: Key directories and their purposes.- **Development Guidelines**: Project-specific coding standards and practices.- **Testing Requirements**: How to run tests and what types of tests are required.- **Setup Instructions**: Steps needed to build and run the project.-### Example Repository Configuration-Example `.openhands/microagents/repo.md` file:+#### 2. Create File++Create a file in your repository under `.openhands/microagents/` (Example: `.openhands/microagents/repo.md`)++Update the file with the required frontmatter [according to the required format](./microagents-overview#microagent-format)+and the required specialized guidelines for your repository.++### Example Repository Microagent+```+---+name: repo+type: repo+agent: CodeActAgent+---+Repository: MyProjectDescription: A web application for task management@@ -37,30 +63,6 @@ Guidelines:- Follow ESLint configuration- Write tests for all new features- Use TypeScript for new code-```--### Customizing Prompts--You may also add customized prompts to the `.openhands/microagents/repo.md` file when working with a repository.-These could:--- **Reference Project Standards**: Mention specific coding standards or patterns used in your project.-- **Include Context**: Reference relevant documentation or existing implementations.-- **Specify Testing Requirements**: Include project-specific testing requirements in your prompts.-Example customized prompt:+If adding a new component in src/components, always add appropriate unit tests in tests/components/.```-Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.-Include unit tests in tests/components/ and update the documentation in docs/features/.-The component should use our shared styling from src/styles/components.-```--### Best Practices for Repository Customization--- **Keep Instructions Updated**: Regularly update your `.openhands/microagents/` directory as your project evolves.-- **Be Specific**: Include specific paths, patterns, and requirements unique to your project.-- **Document Dependencies**: List all tools and dependencies required for development.-- **Include Examples**: Provide examples of good code patterns from your project.-- **Specify Conventions**: Document naming conventions, file organization, and code style preferences.--By customizing OpenHands for your repository, you'll get more accurate and consistent results that align with your project's standards and requirements.diff --git a/docs/sidebars.ts b/docs/sidebars.tsindex 12911c3172..b7def32dd6 100644--- a/docs/sidebars.ts+++ b/docs/sidebars.ts@@ -24,18 +24,23 @@ const sidebars: SidebarsConfig = {},{type: 'category',- label: 'Micro-Agents',+ label: 'Microagents',items: [{type: 'doc',- label: 'Public',- id: 'usage/prompting/microagents-public',+ label: 'Overview',+ id: 'usage/prompting/microagents-overview',},{type: 'doc',label: 'Repository',id: 'usage/prompting/microagents-repo',},+ {+ type: 'doc',+ label: 'Public',+ id: 'usage/prompting/microagents-public',+ },],}],@@ -132,11 +137,6 @@ const sidebars: SidebarsConfig = {label: 'Custom Sandbox',id: 'usage/how-to/custom-sandbox-guide',},- {- type: 'doc',- label: 'Persist Session Data',- id: 'usage/how-to/persist-session-data',- },],},{