Skip to main content
The Settings and Secrets API provides server-side configuration management for agent-server deployments. This enables centralized LLM configuration, secure secret storage, and workspace-level retrieval of settings.

Overview

When running agent-server in production, you often need to:
  • Store LLM configuration (model, API keys) on the server
  • Manage custom secrets securely (encrypted at rest)
  • Retrieve settings from within a workspace
The Settings API provides REST endpoints for these operations:
  • GET/PATCH /api/settings - Read/update LLM and MCP configuration
  • PUT/GET/DELETE /api/settings/secrets - CRUD operations for custom secrets

1) Settings and Secrets API

A ready-to-run example is available here!

Key Concepts

Storing LLM Configuration

Store LLM settings via the Settings API. The API key is encrypted at rest when OH_SECRET_KEY is configured:

Storing Custom Secrets

Store secrets via the Secrets API. Secrets are encrypted at rest and can be referenced in conversations via LookupSecret:

Using LookupSecret References

Reference stored secrets in conversations via LookupSecret URLs. The agent-server resolves these lazily at runtime:
The agent can then access the secret as an environment variable $MY_PROJECT_TOKEN.

Ready-to-run Example Settings API

This example demonstrates the full workflow: storing LLM settings, creating secrets, using LookupSecret references, and cleaning up:
examples/02_remote_agent_server/12_settings_and_secrets_api.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.

2) Workspace Settings Methods

A ready-to-run example is available here!
RemoteWorkspace provides methods to retrieve settings from the agent-server, enabling workspaces to use centrally-configured LLM settings and secrets.

Key Concepts

API Key Authentication

When the agent-server is configured with SESSION_API_KEY, all requests must include the key. RemoteWorkspace.api_key automatically adds the X-Session-API-Key header:

workspace.get_llm()

Retrieve the configured LLM from agent-server settings:
The method calls GET /api/settings with X-Expose-Secrets: plaintext to retrieve the actual API key value.

workspace.get_secrets()

Retrieve LookupSecret references for stored secrets:
The returned LookupSecret objects include authentication headers so they can be resolved by the agent-server.

workspace.get_mcp_config()

Retrieve MCP (Model Context Protocol) server configuration:

Ready-to-run Example Workspace Settings

This example is available on GitHub: examples/02_remote_agent_server/13_workspace_get_llm.py
This example demonstrates secure workspace settings retrieval with API key authentication:
examples/02_remote_agent_server/13_workspace_get_llm.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.

Security Considerations

Encryption at Rest

Enable encrypted storage by setting OH_SECRET_KEY:
When set, all secrets (including LLM API keys) are encrypted before storage.

Session API Keys

Secure the agent-server with SESSION_API_KEY:
When set, all API requests must include the X-Session-API-Key header.

LookupSecret Headers

When using workspace.get_secrets(), the returned LookupSecret objects automatically include authentication headers, ensuring secrets can be resolved even when the agent-server requires authentication.

Next Steps