Aller directement au contenu principal

openhands.core.config.agent_config

AgentConfig Objects

class AgentConfig(BaseModel)

Configuration for the agent.

Attributes:

  • function_calling - Whether function calling is enabled. Default is True.
  • codeact_enable_browsing - Whether browsing delegate is enabled in the action space. Default is False. Only works with function calling.
  • codeact_enable_llm_editor - Whether LLM editor is enabled in the action space. Default is False. Only works with function calling.
  • codeact_enable_jupyter - Whether Jupyter is enabled in the action space. Default is False.
  • memory_enabled - Whether long-term memory (embeddings) is enabled.
  • memory_max_threads - The maximum number of threads indexing at the same time for embeddings. (deprecated)
  • llm_config - The name of the llm config to use. If specified, this will override global llm config.
  • enable_prompt_extensions - Whether to use prompt extensions (e.g., microagents, inject runtime info). Default is True.
  • disabled_microagents - A list of microagents to disable (by name, without .py extension, e.g. ["github", "lint"]). Default is None.
  • condenser - Configuration for the memory condenser. Default is NoOpCondenserConfig.
  • codeact_enable_browsing0 - Whether history should be truncated to continue the session when hitting LLM context length limit.
  • codeact_enable_browsing1 - Whether to enable SoM (Set of Marks) visual browsing. Default is False.

from_toml_section

@classmethod
def from_toml_section(cls, data: dict) -> dict[str, AgentConfig]

Create a mapping of AgentConfig instances from a toml dictionary representing the [agent] section.

The default configuration is built from all non-dict keys in data. Then, each key with a dict value is treated as a custom agent configuration, and its values override the default configuration.

Example:

Apply generic agent config with custom agent overrides, e.g. [agent] memory_enabled = false enable_prompt_extensions = true [agent.BrowsingAgent] memory_enabled = true results in memory_enabled being true for BrowsingAgent but false for others.

Returns:

dict[str, AgentConfig]: A mapping where the key "agent" corresponds to the default configuration and additional keys represent custom configurations.