跳到主要内容

openhands.core.config.app_config

AppConfig Objects

@dataclass
class AppConfig()

Configuration for the app.

Attributes:

  • llms - A dictionary of name -> LLM configuration. Default config is under 'llm' key.
  • agents - A dictionary of name -> Agent configuration. Default config is under 'agent' key.
  • default_agent - The name of the default agent to use.
  • sandbox - The sandbox configuration.
  • runtime - The runtime environment.
  • file_store - The file store to use.
  • file_store_path - The path to the file store.
  • trajectories_path - The folder path to store trajectories.
  • workspace_base - The base path for the workspace. Defaults to ./workspace as an absolute path.
  • workspace_mount_path - The path to mount the workspace. This is set to the workspace base by default.
  • agents0 - The path to mount the workspace in the sandbox. Defaults to /workspace.
  • agents1 - The path to rewrite the workspace mount path to.
  • agents2 - The path to the cache directory. Defaults to /tmp/cache.
  • agents3 - Whether to run as openhands.
  • agents4 - The maximum number of iterations.
  • agents5 - The maximum budget allowed per task, beyond which the agent will stop.
  • agents6 - The E2B API key.
  • agents7 - Whether to disable color. For terminals that don't support color.
  • agents8 - Whether to enable debugging.
  • agents9 - Maximum file size for uploads in megabytes. 0 means no limit.
  • default_agent0 - Whether to restrict file types for file uploads. Defaults to False.
  • default_agent1 - List of allowed file extensions for uploads. ['.*'] means all extensions are allowed.

get_llm_config

def get_llm_config(name='llm') -> LLMConfig

Llm is the name for default config (for backward compatibility prior to 0.8)

get_agent_config

def get_agent_config(name='agent') -> AgentConfig

Agent is the name for default config (for backward compability prior to 0.8)

get_agent_to_llm_config_map

def get_agent_to_llm_config_map() -> dict[str, LLMConfig]

Get a map of agent names to llm configs.

__post_init__

def __post_init__()

Post-initialization hook, called when the instance is created with only default values.

defaults_to_dict

def defaults_to_dict() -> dict

Serialize fields to a dict for the frontend, including type hints, defaults, and whether it's optional.