Skip to main content
A ready-to-run example is available here!
OpenHandsAgentSettings gives you a structured, serializable way to define an agent’s model, tools, and optional subsystems like the condenser. Use it when you want to store agent configuration in JSON, send it over an API, or rebuild agents from validated settings later.

Why Use Agent Settings

  • Keep agent configuration as data instead of wiring everything together imperatively.
  • Validate settings with Pydantic before creating an agent.
  • Serialize and deserialize settings for storage, transport, or UI-driven configuration.
  • Create different agent variants by changing only the settings payload.

Build Settings

Create an OpenHandsAgentSettings object with the same ingredients you would normally pass to an Agent.

Serialize and Restore Settings

Because OpenHandsAgentSettings is a Pydantic model, you can dump it to JSON-compatible data and restore it later.
This is useful when:
  • Saving agent configuration in a database
  • Sending settings through an API
  • Letting users edit agent configuration in a form-based UI
  • Rehydrating the same agent setup in another process

Create an Agent from Settings

Once validated, create a working agent directly from the settings object.
You can then pass that agent into a Conversation, or derive another agent by changing the settings payload. For example, the full example below also shows how removing FileEditorTool and disabling the condenser produces a different agent configuration without rewriting the rest of the setup.

Ready-to-run Example

This example is available on GitHub: examples/01_standalone_sdk/46_agent_settings.py
examples/01_standalone_sdk/46_agent_settings.py
You can run the example code as-is.
The model name should follow the LiteLLM convention: provider/model_name (e.g., anthropic/claude-sonnet-4-5-20250929, openai/gpt-4o). The LLM_API_KEY should be the API key for your chosen provider.
ChatGPT Plus/Pro subscribers: You can use LLM.subscription_login() to authenticate with your ChatGPT account and access Codex models without consuming API credits. See the LLM Subscriptions guide for details.

Next Steps