Skip to content

State Types

Complete reference for all state types in the Agent Host Protocol.

JSON Schema: state.schema.json

Root State

RootState 📄

Global state shared with every client subscribed to agenthost:/root.

FieldTypeRequiredDescription
agentsAgentInfo[]YesAvailable agent backends and their models
activeSessionsnumberNoNumber of active (non-disposed) sessions on the server
terminalsTerminalInfo[]NoKnown terminals on the server. Subscribe to individual terminal URIs for full state.
configRootConfigStateNoAgent host configuration schema and current values

AgentInfo 📄

FieldTypeRequiredDescription
providerstringYesAgent provider ID (e.g. 'copilot')
displayNamestringYesHuman-readable name
descriptionstringYesDescription string
modelsSessionModelInfo[]YesAvailable models for this agent
protectedResourcesProtectedResourceMetadata[]NoProtected resources this agent requires authentication for.

Each entry describes an OAuth 2.0 protected resource using RFC 9728 semantics. Clients should obtain tokens from the declared authorization_servers and push them via the authenticate command before creating sessions with this agent. | | customizations | CustomizationRef[] | No | Customizations (Open Plugins) associated with this agent.

Each entry is a reference to an Open Plugins plugin that the agent host can activate for sessions using this agent. |

SessionModelInfo 📄

FieldTypeRequiredDescription
idstringYesModel identifier
providerstringYesProvider this model belongs to
namestringYesHuman-readable model name
maxContextWindownumberNoMaximum context window size
supportsVisionbooleanNoWhether the model supports vision
policyStatePolicyStateNoPolicy configuration state
configSchemaConfigSchemaNoConfiguration schema describing model-specific options (e.g. thinking
level). Clients present this as a form and pass the resolved values in
{@link ModelSelection.config} when creating or changing sessions.
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this model.

Clients MAY look for well-known keys here to provide enhanced UI. For example, a pricing key may carry model pricing metadata. |

Session State

SessionState 📄

Full state for a single session, loaded when a client subscribes to the session's URI.

FieldTypeRequiredDescription
summarySessionSummaryYesLightweight session metadata
lifecycleSessionLifecycleYesSession initialization state
creationErrorErrorInfoNoError details if creation failed
serverToolsToolDefinition[]NoTools provided by the server (agent host) for this session
activeClientSessionActiveClientNoThe client currently providing tools and interactive capabilities to this session
turnsTurn[]YesCompleted turns
activeTurnActiveTurnNoCurrently in-progress turn
steeringMessagePendingMessageNoMessage to inject into the current turn at a convenient point
queuedMessagesPendingMessage[]NoMessages to send automatically as new turns after the current turn finishes
inputRequestsSessionInputRequest[]NoRequests for user input that are currently blocking or informing session progress
configSessionConfigStateNoSession configuration schema and current values
customizationsSessionCustomization[]NoServer-provided customizations active in this session.

Client-provided customizations are available on {@link SessionActiveClient.customizations | activeClient.customizations}. | | _meta | Record<string, unknown> | No | Additional provider-specific metadata for this session.

Clients MAY look for well-known keys here to provide enhanced UI. For example, a git key may provide extra git metadata about the session's workingDirectory. |

SessionSummary 📄

FieldTypeRequiredDescription
resourceURIYesSession URI
providerstringYesAgent provider ID
titlestringYesSession title
statusSessionStatusYesCurrent session status
activitystringNoHuman-readable description of what the session is currently doing
createdAtnumberYesCreation timestamp
modifiedAtnumberYesLast modification timestamp
projectProjectInfoNoServer-owned project for this session
modelModelSelectionNoCurrently selected model
workingDirectoryURINoThe working directory URI for this session
diffsFileEdit[]NoFiles changed during this session with diff statistics

Turn Types

Turn 📄

A completed request/response cycle.

FieldTypeRequiredDescription
idstringYesTurn identifier
userMessageUserMessageYesThe user's input
responsePartsResponsePart[]YesAll response content in stream order: text, tool calls, reasoning, and content refs.

Consumers should derive display text by concatenating markdown parts, and find tool calls by filtering for ToolCall parts. | | usage | UsageInfo \| undefined | Yes | Token usage info | | state | TurnState | Yes | How the turn ended | | error | ErrorInfo | No | Error details if state is 'error' |

ActiveTurn 📄

An in-progress turn — the assistant is actively streaming.

FieldTypeDescription
idstringTurn identifier
userMessageUserMessageThe user's input
responsePartsResponsePart[]All response content in stream order: text, tool calls, reasoning, and content refs.

Tool call parts include pendingPermissions when permissions are awaiting user approval. | | usage | UsageInfo \| undefined | Token usage info |

UserMessage 📄

A user message and its associated attachments.

Attachments MAY be referenced inside {@link UserMessage.text} via their {@link MessageAttachmentBase.range} field. Attachments without a range are still associated with the message but do not correspond to a specific span in the text.

FieldTypeRequiredDescription
textstringYesMessage text
attachmentsMessageAttachment[]NoFile/selection attachments

MessageAttachmentBase 📄

Common fields shared by all {@link MessageAttachment} variants.

FieldTypeRequiredDescription
labelstringYesA human-readable label for the attachment (e.g. the filename of a file
attachment). Used for display in UI.
rangeTextRangeNoIf defined, the range in {@link UserMessage.text} that references this
attachment. This is a text range, not a byte range.
displayKindstringNoAdvisory display hint for clients rendering this attachment. Recognized
values include:
  • 'image': the attachment is an image
  • 'document': the attachment is a textual document
  • 'symbol': the attachment is a code symbol (e.g. a function or class)
  • 'directory': the attachment is a folder
  • 'selection': the attachment is a selection within a document

Implementations MAY provide additional values; clients SHOULD fall back to a reasonable default when an unknown value is encountered. | | _meta | Record<string, unknown> | No | Additional implementation-defined metadata for the attachment.

If the attachment was produced by the completions command, the client MUST preserve every property of _meta originally returned by the agent host when sending the user message containing the accepted completion. |

SimpleMessageAttachment 📄

A simple, opaque attachment whose model representation is described by the producer.

FieldTypeRequiredDescription
typeMessageAttachmentKind.SimpleYesDiscriminant
modelRepresentationstringNoRepresentation of the attachment as it should be shown to the model.

If the attachment was produced by the client, this property MUST be defined so the agent host can correctly interpret the attachment. This property MAY be omitted when the attachment originated from a completions response. |

MessageEmbeddedResourceAttachment 📄

An attachment whose data is embedded inline as a base64 string.

Use this for small binary payloads (e.g. a pasted image) that should be delivered with the user message itself rather than fetched separately.

FieldTypeRequiredDescription
typeMessageAttachmentKind.EmbeddedResourceYesDiscriminant
datastringYesBase64-encoded binary data
contentTypestringYesContent MIME type (e.g. "image/png", "application/pdf")
selectionTextSelectionNoOptional selection within the attached textual resource.

Only meaningful for textual resources. |

MessageResourceAttachment 📄

An attachment that references a resource by URI. The content is not delivered inline; consumers can fetch it via resourceRead when needed.

FieldTypeRequiredDescription
typeMessageAttachmentKind.ResourceYesDiscriminant
selectionTextSelectionNoOptional selection within the referenced textual resource.

Only meaningful for textual resources. |

MessageAttachment 📄

An attachment associated with a {@link UserMessage}.

| SimpleMessageAttachment | MessageEmbeddedResourceAttachment | MessageResourceAttachment

Response Parts

MarkdownResponsePart 📄

FieldTypeDescription
kindResponsePartKind.MarkdownDiscriminant
idstringPart identifier, used by session/delta to target this part for content appends
contentstringMarkdown content

ContentRef 📄

A reference to large content stored outside the state tree.

FieldTypeRequiredDescription
uriURIYesContent URI
sizeHintnumberNoApproximate size in bytes
contentTypestringNoContent MIME type

ResponsePart 📄

| MarkdownResponsePart | ResourceReponsePart | ToolCallResponsePart | ReasoningResponsePart | SystemNotificationResponsePart

Tool Call Types

ToolCallState 📄

Discriminated union of all tool call lifecycle states.

See the state model guide for the full state machine diagram.

| ToolCallStreamingState | ToolCallPendingConfirmationState | ToolCallRunningState | ToolCallPendingResultConfirmationState | ToolCallCompletedState | ToolCallCancelledState

ToolCallResult 📄

Tool execution result details, available after execution completes.

FieldTypeRequiredDescription
successbooleanYesWhether the tool succeeded
pastTenseMessageStringOrMarkdownYesPast-tense description of what the tool did
contentToolResultContent[]NoUnstructured result content blocks.

This mirrors the content field of MCP CallToolResult. | | structuredContent | Record<string, unknown> | No | Optional structured result object.

This mirrors the structuredContent field of MCP CallToolResult. | | error | { message: string; code?: string } | No | Error details if the tool failed |

ToolCallStreamingState 📄

LM is streaming the tool call parameters.

FieldTypeRequiredDescription
statusToolCallStatus.StreamingYes
partialInputstringNoPartial parameters accumulated so far
invocationMessageStringOrMarkdownNoProgress message shown while parameters are streaming

ToolCallPendingConfirmationState 📄

Parameters are complete, or a running tool requires re-confirmation (e.g. a mid-execution permission check).

FieldTypeRequiredDescription
statusToolCallStatus.PendingConfirmationYes
confirmationTitleStringOrMarkdownNoShort title for the confirmation prompt (e.g. "Run in terminal", "Write file")
edits{ items: FileEdit[] }NoFile edits that this tool call will perform, for preview before confirmation
editablebooleanNoWhether the agent host allows the client to edit the tool's input parameters before confirming
optionsConfirmationOption[]NoOptions the server offers for this confirmation. When present, the client
SHOULD render these instead of a plain approve/deny UI. Each option
belongs to a {@link ConfirmationOptionGroup} so the client can still
categorise the choices.

ToolCallRunningState 📄

Tool is actively executing.

FieldTypeRequiredDescription
statusToolCallStatus.RunningYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided
contentToolResultContent[]NoPartial content produced while the tool is still executing.

For example, a terminal content block lets clients subscribe to live output before the tool completes. |

ToolCallPendingResultConfirmationState 📄

Tool finished executing, waiting for client to approve the result.

FieldTypeRequiredDescription
statusToolCallStatus.PendingResultConfirmationYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolCallCompletedState 📄

Tool completed successfully or with an error.

FieldTypeRequiredDescription
statusToolCallStatus.CompletedYes
confirmedToolCallConfirmationReasonYesHow the tool was confirmed for execution
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolCallCancelledState 📄

Tool call was cancelled before execution.

FieldTypeRequiredDescription
statusToolCallStatus.CancelledYes
reasonToolCallCancellationReasonYesWhy the tool was cancelled
reasonMessageStringOrMarkdownNoOptional message explaining the cancellation
userSuggestionUserMessageNoWhat the user suggested doing instead
selectedOptionConfirmationOptionNoThe confirmation option the user selected, if confirmation options were provided

ToolResultSubagentContent 📄

A reference to a subagent session spawned by a tool.

Clients can subscribe to the subagent's session URI to stream its progress in real time, including inner tool calls and responses.

FieldTypeRequiredDescription
typeToolResultContentType.SubagentYes
resourceURIYesSubagent session URI (subscribable for full session state)
titlestringYesDisplay title for the subagent
agentNamestringNoInternal agent name
descriptionstringNoHuman-readable description of the subagent's task

Common Types

UsageInfo 📄

FieldTypeRequiredDescription
inputTokensnumberNoInput tokens consumed
outputTokensnumberNoOutput tokens generated
modelstringNoModel used
cacheReadTokensnumberNoTokens read from cache
_metaRecord<string, unknown>NoAdditional provider-specific metadata for this usage report.
Clients MAY look for well-known optional keys here to provide enhanced UI.

ErrorInfo 📄

FieldTypeRequiredDescription
errorTypestringYesError type identifier
messagestringYesHuman-readable error message
stackstringNoStack trace

Snapshot 📄

A point-in-time snapshot of a subscribed resource's state, returned by initialize, reconnect, and subscribe.

FieldTypeDescription
resourceURIThe subscribed resource URI (e.g. agenthost:/root or copilot:/&lt;uuid&gt;)
stateRootState | SessionState | TerminalStateThe current state of the resource
fromSeqnumberThe serverSeq at which this snapshot was taken. Subsequent actions will have serverSeq &gt; fromSeq.

Released under the MIT License.