▾
import type { AgentData, EmptyAgentData, SchemaFieldDefinition, SchemaDefinition, AgentRuntimeState } from "@arcgis/ai-components/agent-utils/types.js";Type definitions
SchemaFieldDefinition
Defines a field in an object schema accepted by createSchema.
properties
- Type
- Readonly<Record<string, SchemaFieldDefinition>> | undefined
Field definitions for an object field, keyed by field name.
SchemaDefinition
Defines an object schema accepted by createSchema.
properties
- Type
- Readonly<Record<string, SchemaFieldDefinition>>
Field definitions keyed by property name.
AgentRuntimeState
Runtime-managed fields included in every agent graph state.
outputMessage
- Type
- string
The outputMessage is a string representing the output of an agent execution.
summary
- Type
- string
The summary is a string providing a brief overview of the agent execution.
status
- Type
- AgentStatus | undefined
The status field represents the current status of the agent execution, which can be used to indicate success, failure, or other relevant states.
sharedResourceAdditions
- Type
- readonly SharedResourceInput[] | undefined
Resources provided by the agent for the orchestrator to add to the conversation's shared resources.
AgentGraphState
- Type parameters
- <TState extends AgentData = EmptyAgentData>
Full state passed through an agent graph, combining runtime-managed fields with agent-specific custom fields.
- Type
- AgentRuntimeState & Omit<TState, keyof AgentRuntimeState>
BaseAgentLike
- Type parameters
- <TCustomState extends AgentData = EmptyAgentData>
Defines the properties and methods shared by agent implementations, including registration and execution.
id
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Stable ID provided by the user or derived from the agent name, used for graph node and registration identity.
inputSchema
- Type
- ZodObjectSchema<object> | undefined
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Optional schema used to validate and shape agent input state.
name
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Human-readable name shown in registration metadata and tooling.
outputSchema
- Type
- ZodObjectSchema<object> | undefined
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Optional schema used to validate structured agent output.
registration
- Type
- AgentRegistration
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Registration payload consumed by the orchestrator.
generate
- Type
- () => void
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Regenerates workspace and graph wiring for this agent.
run
- Signature
-
run (state?: Partial<AgentGraphState<TCustomState>>, config?: AgentExecutionConfig): Promise<AgentGraphState<TCustomState>>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Executes the compiled graph for this agent.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| state | Optional partial state used as graph input. | | |
| config | Optional runtime execution configuration. | |
- Returns
- Promise<AgentGraphState
>
AgentExecutionConfig
AgentExecutionConfig defines the shape of the configuration object that can be passed to agent execution methods to influence their behavior at runtime.
configurable
- Since
- ArcGIS Maps SDK for JavaScript 5.1
The configurable field allows passing arbitrary key-value pairs that can be used by agents during execution to modify their behavior or provide additional context. This can include flags, parameters, or any other relevant information that an agent might need to access at runtime.
signal
- Type
- AbortSignal | undefined
- Since
- ArcGIS Maps SDK for JavaScript 5.1
The signal property is an optional AbortSignal that can be used to cancel the execution of an agent. Agents should listen for the abort signal and gracefully handle cancellation when it is triggered.
AgentCustomState
Custom state for a FunctionAgent or LLMAgent, combining input fields with optional output fields and excluding runtime-managed fields.
- Supertypes
- Omit<TInput‚ keyof AgentRuntimeState> ‚ Partial<Omit<TOutput, keyof AgentRuntimeState>>
AgentNodeState
Full state passed to a FunctionAgent or LLMAgent node, combining runtime-managed fields with the agent's input fields and optional output fields.
- Supertypes
- AgentGraphState<AgentCustomState<TInput, TOutput>>
AgentNodeUpdate
Partial state update returned by a FunctionAgent or LLMAgent node.
- Supertypes
- Partial<AgentNodeState<TInput, TOutput>>
AgentStateAnnotation
- Type parameters
- <TState extends AgentData>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Defines the state fields used by agent and workflow graphs, including runtime-managed and custom fields.
- Supertypes
- AnnotationRoot<{ [K in keyof TState]: BinaryOperatorAggregate<TState[K] | undefined, TState[K] | undefined>; } & { agentExecutionContext: BaseChannel<AgentExecutionContext, unknown, unknown>; outputMessage: BaseChannel<string, unknown, unknown>; summary: BaseChannel<string, unknown, unknown>; status: BaseChannel<AgentStatus | undefined, unknown, unknown>; sharedResourceAdditions: BaseChannel<readonly SharedResourceInput[] | undefined, unknown, unknown>; }>
RunnableUpdate
- Type parameters
- <TState extends AgentData>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
State update shape produced by graph nodes.
TypedStateGraph
- Type parameters
- <TState extends AgentData>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Represents the graph used to run an agent.
- Supertypes
- StateGraph<StateDefinitionInit‚ AgentGraphState
‚ RunnableUpdate<AgentGraphState > ‚ string>
AgentCreateGraph
- Type parameters
- <TState extends AgentData>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
The shape of the createGraph function used by agents to generate their internal graph representation.
This function is responsible for defining the nodes and edges of the graph, as well as any associated state and middleware.
- Returns
- TypedStateGraph
ZodObjectSchema
ZodObjectSchema is a simplified type representing Zod object schemas used for input and output validation in agents.
- Supertypes
- Pick<z.ZodType
‚ "safeParse"> ‚ default
GraphNodes
- Supertypes
- Record<string‚ (state: S, config?: AgentExecutionConfig) => Promise<S | TUpdate> | S | TUpdate>