The Secret Registry provides a secure way to handle sensitive data in your agent’s workspace.
It automatically detects secret references in bash commands, injects them as environment variables when needed,
and masks secret values in command outputs to prevent accidental exposure.
Use the update_secrets() method to add secrets to your conversation.Secrets can be provided as static strings or as callable functions that dynamically retrieve values, enabling integration with external secret stores and credential management systems:
from openhands.sdk.conversation.secret_source import SecretSource# Static secretconversation.update_secrets({"SECRET_TOKEN": "my-secret-token-value"})# Dynamic secret using SecretSourceclass MySecretSource(SecretSource): def get_value(self) -> str: return "callable-based-secret"conversation.update_secrets({"SECRET_FUNCTION_TOKEN": MySecretSource()})
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.