ESM
import { createAgentRuntimeState } from "@arcgis/ai-components/orchestrator/state/runtime.js";

Creates custom agent graph state.

Functions

createAgentRuntimeState

Function
Type parameters
<TState extends Record<string, unknown> = Record<string, unknown>>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates the standard state definition for a graph-based custom agent registered with the assistant. It includes fields for execution context, output, summary, status, shared-state updates, and shared-resource additions, so add only the fields specific to your agent. The function returns definitions, not initialized values.

Signature
createAgentRuntimeState <TState extends Record<string, unknown> = Record<string, unknown>>(): AgentBaseState<TState>
Returns
AgentBaseState

Type definitions

AgentBaseState

Type definition
Type parameters
<TState extends Record<string, unknown> = Record<string, unknown>>

Standard state fields provided by createAgentRuntimeState for a graph-based custom agent.

agentExecutionContext

Property
Type
BaseChannel<AgentExecutionContext<SharedState>, unknown, unknown>

Context available to graph nodes during a run, including the request, assigned task, message history, prior steps, and shared state and resources.

outputMessage

Property
Type
BaseChannel<string, unknown, unknown>

User-facing message produced by the graph. String updates are accumulated, ignoring empty or duplicate updates.

summary

Property
Type
BaseChannel<string, unknown, unknown>

Brief outcome summary returned by the graph and used by the assistant when reporting the agent result.

status

Property
Type
BaseChannel<AgentStatus | undefined, unknown, unknown>

Execution status returned by the graph: success, failed, or unknown. Missing or invalid values are treated as unknown by the assistant.

sharedStatePatch

Property
Type
BaseChannel<SharedStatePatch | undefined, unknown, unknown>

Partial shared-state update returned by the graph. The assistant applies valid entries and records the agent and update time.

sharedResourceAdditions

Property
Type
BaseChannel<readonly SharedResourceInput[] | undefined, unknown, unknown>

Resources returned by the graph for sharing with subsequent agents. The assistant validates additions and assigns each resource its identity and creation metadata.