Skip to main content
POST
Start Conversation

Authorizations

X-Session-API-Key
string
header
required

Headers

X-OpenHands-Observability-Span-Name
string | null
X-OpenHands-Observability-Tags
string | null
X-OpenHands-Observability-Metadata
string | null
X-OpenHands-Observability-Parent-Span-Context
string | null

Query Parameters

include_skills
boolean
default:false

Body

application/json

Payload to create a new conversation.

Extends :class:ConversationConfig with the agent source: a stored Agent Profile (agent_profile_id), resolved agent settings (agent_settings), or an agent built in code. The server builds the conversation's agent from that source at launch; this model only validates it.

Note: the agent lives here on the request, deliberately not on ConversationConfig. The persisted record (StoredConversation) does not carry the agent — its single source of truth is ConversationState / base_state.json.

workspace
LocalWorkspace · object
required

Working directory for agent operations and tool execution.

agent
ACPAgent · object

Agent that delegates to an ACP-compatible subprocess server.

agent_definitions
AgentDefinition · object[]

Agent definitions from the client's registry. These are registered on the server so that task tools can see user-registered subagents.

agent_launch_additions
AgentLaunchAdditions · object | null

Deployment context applied after agent or Agent Profile resolution. The stored Agent Profile is not modified.

agent_profile_id
string<uuid> | null

Stored Agent Profile to launch. The server resolves it with its own stores. Mutually exclusive with agent and agent_settings.

agent_settings
Agent Settings · object | null

Reference-free agent settings, validated with the AgentSettingsBase agent_kind discriminator. The server builds the agent from them at launch. Ignored when agent is set.

autotitle
boolean
default:true

If true, automatically generate a title for the conversation from the first user message. Precedence: title_llm_profile (if set and loads) → agent.llm → message truncation.

client_tools
ClientToolSpec · object[]

Tools defined by the client via JSON spec. These tools have no server-side executor — when the agent calls them, an ActionEvent is emitted over the WebSocket and the client handles execution. The SDK returns an acknowledgment observation immediately.

confirmation_policy
AlwaysConfirm · object

Controls when the conversation will prompt the user before continuing. Defaults to never.

conversation_id
string<uuid> | null

Optional conversation ID. If not provided, a random UUID will be generated.

hook_config
HookConfig · object | null

Optional hook configuration for this conversation. Hooks are shell scripts that run at key lifecycle events (PreToolUse, PostToolUse, UserPromptSubmit, Stop, etc.). If both hook_config and plugins are provided, they are merged with explicit hooks running before plugin hooks.

initial_message
SendMessageRequest · object | null

Initial message to pass to the LLM

max_iterations
integer
default:500

If set, the max number of iterations the agent will run before stopping. This is useful to prevent infinite loops.

Required range: x >= 1
observability_metadata
Observability Metadata · object

Trace-level metadata to attach to observability backends. Values must be scalars or homogeneous scalar lists supported by OpenTelemetry.

observability_parent_span_context
string | null

Serialized parent span context used to attach this conversation to an upstream automation or integration trace.

observability_span_name
string
default:conversation

Optional named child span to emit under the conversation root. Use stable, low-cardinality names because observability backends may use span names for grouping or signal routing.

observability_tags
string[]

Tags to attach to the conversation root observability span.

parent_conversation_id
string<uuid> | null

Optional ID of an existing conversation that owns this one. The parent must already exist and share this conversation's workspace.

plugins
PluginSource · object[] | null

List of plugins to load for this conversation. Plugins are loaded and their skills/MCP config are merged into the agent. Hooks are extracted and stored for runtime execution.

secrets
Secrets · object

Secrets available in the conversation

secrets_encrypted
boolean
default:false

If true, indicates that secret values in the agent configuration are cipher-encrypted and should be decrypted by the server before use. This enables secure round-tripping of settings through untrusted clients (e.g., frontend) that received encrypted values via the X-Expose-Secrets header. Flow: client calls GET /api/settings with X-Expose-Secrets: encrypted to receive cipher-encrypted secrets, then passes them in the agent config with secrets_encrypted=True so the server can decrypt them.

security_analyzer
PatternSecurityAnalyzer · object

Optional security analyzer to evaluate action risks.

stuck_detection
boolean
default:true

If true, the conversation will use stuck detection to prevent infinite loops.

tags
Tags · object

Key-value tags for the conversation. Keys must be lowercase alphanumeric. Values are arbitrary strings up to 256 characters.

title_llm_profile
string | null

Optional LLM profile name for title generation. If set, the LLM is loaded from LLMProfileStore (~/.openhands/profiles/) and used for LLM-based title generation. This enables using a fast/cheap model for titles regardless of the agent's main model. If not set (or profile loading fails), title generation falls back to the agent's LLM.

tool_module_qualnames
Tool Module Qualnames · object

Mapping of tool names to their module qualnames from the client's registry. These modules will be dynamically imported on the server to register the tools for this conversation.

user_id
string | null

Optional user ID supplied by the hosting deployment, used to correlate this conversation with the identity that deployment already established. When set it is passed to Laminar.set_trace_user_id() so traces can be queried by user, and — where a host has enabled product analytics — it is reused verbatim as the analytics correlation id so events attach to the existing person rather than creating a duplicate identity. It is never generated by the SDK, and is omitted entirely when unset.

worktree
boolean
default:false

If true and the workspace is already inside a git repository, create a dedicated git worktree for this conversation under /tmp/conversation-worktrees/<conversation_id>/<project_name>.

Response

Successful Response

Information about a conversation running locally without a Runtime sandbox.

agent
ACPAgent · object
required

The agent running in the conversation.

id
string<uuid>
required

Unique conversation ID

workspace
LocalWorkspace · object
required

Workspace used by the agent to execute commands and read/write files. Not the process working directory.

activated_knowledge_skills
string[]

List of activated knowledge skills name

agent_state
Agent State · object

Dictionary for agent-specific runtime state that persists across iterations.

available_models
ACPModelInfo · object[]

Models the ACP server offers for this session, lifted off ACPAgent.available_models (the models.availableModels field on the ACP session response). Each entry carries a model_id plus an optional name/description. Surfaced verbatim so clients can render a model picker and resolve current_model_id to a display label themselves — the server does no name curation. Empty for ACP servers that don't surface the (UNSTABLE) capability and for native OpenHands agents. Client contract: current_model_id is NOT guaranteed to be a member — a forced acp_model override may name a model absent from the list — so treat a miss as 'show the raw id'. Some entries are opaque aliases whose human identity lives in description (e.g. claude-agent-acp's "default" -> "Opus 4.7 with 1M context · ...").

blocked_actions
Blocked Actions · object

Actions blocked by PreToolUse hooks, keyed by action ID

blocked_messages
Blocked Messages · object

Messages blocked by UserPromptSubmit hooks, keyed by message ID

client_tools
ClientToolSpec · object[]

Client-defined tool specs registered for this conversation. Surfaced so that a client re-attaching by conversation id can register the dynamic ClientAction_* action types before syncing persisted events, avoiding 'Unknown kind' deserialization errors.

confirmation_policy
AlwaysConfirm · object
created_at
string<date-time>
current_model_id
string | null

Model the agent is actually using for this session. For ACP agents, this is lifted off ACPAgent.current_model_id (populated from the models.currentModelId field on the ACP session response, or from acp_model when the caller forced an override). May be an opaque alias (e.g. claude-agent-acp's "default"); match it against available_models to get a display label. None for older ACP servers that don't surface the field, or while the agent is still initializing. Native OpenHands agents leave this None — consumers should read agent.llm.model for those.

execution_status
enum<string>
default:idle

Enum representing the current execution state of the conversation.

Available options:
idle,
running,
paused,
waiting_for_confirmation,
finished,
error,
stuck,
deleting
forked_from_conversation_id
string<uuid> | null

ID of the conversation this one was forked from. None for conversations created directly (not via fork).

forked_from_event_id
string | null

Event ID this conversation was forked at. None for non-forked conversations or whole-conversation forks.

hook_config
HookConfig · object | null

Hook configuration for this conversation. Includes definitions for PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, and Stop hooks.

invoked_skills
string[]

Names of progressive-disclosure skills explicitly invoked via the invoke_skill tool.

last_user_message_id
string | null

Most recent user MessageEvent id for hook block checks. Updated when user messages are emitted so Agent.step can pop blocked_messages without scanning the event log. If None, hook-blocked checks are skipped (legacy conversations).

launched_agent_profile
LaunchedAgentProfile · object | null

Provenance snapshot of the agent profile that launched this conversation. Set at creation when the conversation was started via agent_profile_id; None for conversations started directly with agent or agent_settings. Clients use this to identify which agent profile is current without fragile settings-comparison.

leaf_event_id
string | null

HEAD of the conversation tree: the parent of the next appended event. None means an empty tree (or, for pre-feature conversations, the linear tail). Moving it via navigate re-roots the active branch the agent runs on.

max_iterations
integer
default:500

Maximum number of iterations the agent can perform in a single run.

metrics
MetricsSnapshot · object | null

A snapshot of metrics at a point in time.

Does not include lists of individual costs, latencies, or token usages.

parent_conversation_id
string<uuid> | null

ID of the conversation that owns this one. None for top-level conversations.

persistence_dir
string | null
default:workspace/conversations

Directory for persisting conversation state and events. If None, conversation will not be persisted.

runtime_info
ConversationRuntimeInfo · object | null

Availability of the execution runtime. Catalog responses populate this when the hosting server manages runtime lifecycle.

secret_registry
SecretRegistry · object

Registry for handling secrets and sensitive data

security_analyzer
PatternSecurityAnalyzer · object

Optional security analyzer to evaluate action risks.

stats
object

Conversation statistics for tracking LLM metrics

stuck_detection
boolean
default:true

Whether to enable stuck detection for the agent.

sub_conversation_ids
string<uuid>[]

IDs of conversations naming this one as their parent. Derived from the server catalog; empty on webhook payloads. Name mirrors the Cloud API field.

supports_runtime_model_switch
boolean
default:false

Whether a live, mid-conversation model switch will be attempted for this conversation — tells the inline picker whether to offer a live-switch control. Mirrors the SDK's switch gate: True for known switch-capable providers; False for unknown/custom ACP servers because their generic config writes are not guaranteed live-switch primitives. False for native OpenHands agents, for a known provider that declares no support, and before the conversation has started a session.

tags
Tags · object

Key-value tags for the conversation. Keys must be lowercase alphanumeric. Values are arbitrary strings up to 256 characters.

title
string | null

User-defined title for the conversation

tool_module_qualnames
Tool Module Qualnames · object

Tool names mapped to importable module qualnames. SDK clients use this metadata to restore the registrations needed to deserialize the conversation's tool events when attaching.

updated_at
string<date-time>