Types
import type { AgentData, EmptyAgentData, SchemaFieldDefinition, SchemaDefinition, AgentRuntimeState } from "@arcgis/ai-components/agent-utils/types.js";

Type definitions

AgentData

Type definition

Base object type used for agent data and custom state.

Supertypes
Record<string‚ unknown>

EmptyAgentData

Type definition

Empty object type used when agent state has no custom fields.

Supertypes
Record<never‚ never>

SchemaFieldDefinition

Type definition

Defines a field in an object schema accepted by createSchema.

description

Property
Type
string | undefined

Description applied to the generated Zod field.

enum

Property
Type
readonly string[] | undefined

Allowed values for a string field.

items

Property
Type
SchemaFieldDefinition | undefined

Definition of items in an array field.

properties

Property
Type
Readonly<Record<string, SchemaFieldDefinition>> | undefined

Field definitions for an object field, keyed by field name.

required

Property
Type
readonly string[] | undefined

Names of properties that must be present in an object field.

type

Property
Type
"array" | "boolean" | "number" | "object" | "string"

Value type of the field.

SchemaDefinition

Type definition

Defines an object schema accepted by createSchema.

properties

Property
Type
Readonly<Record<string, SchemaFieldDefinition>>

Field definitions keyed by property name.

required

Property
Type
readonly string[] | undefined

Names of properties that must be present in the object.

type

Property
Type
"object"

Root value type. Must be object.

AgentRuntimeState

Type definition

Runtime-managed fields included in every agent graph state.

agentExecutionContext

Property
Type
AgentExecutionContext

Execution context provided by the orchestrator for the current run.

outputMessage

Property
Type
string

The outputMessage is a string representing the output of an agent execution.

summary

Property
Type
string

The summary is a string providing a brief overview of the agent execution.

status

Property
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

Property
Type
readonly SharedResourceInput[] | undefined

Resources provided by the agent for the orchestrator to add to the conversation's shared resources.

AgentGraphState

Type definition
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 definition
Type parameters
<TCustomState extends AgentData = EmptyAgentData>

Defines the properties and methods shared by agent implementations, including registration and execution.

id

Property
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

Property
Type
ZodObjectSchema<object> | undefined
Since
ArcGIS Maps SDK for JavaScript 5.1

Optional schema used to validate and shape agent input state.

name

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 5.1

Human-readable name shown in registration metadata and tooling.

outputSchema

Property
Type
ZodObjectSchema<object> | undefined
Since
ArcGIS Maps SDK for JavaScript 5.1

Optional schema used to validate structured agent output.

registration

Property
Type
AgentRegistration
Since
ArcGIS Maps SDK for JavaScript 5.1

Registration payload consumed by the orchestrator.

generate

Property
Type
() => void
Since
ArcGIS Maps SDK for JavaScript 5.2

Regenerates workspace and graph wiring for this agent.

run

Method
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

ParameterTypeDescriptionRequired
state

Optional partial state used as graph input.

config

Optional runtime execution configuration.

Returns
Promise<AgentGraphState>

AgentExecutionConfig

Type definition

AgentExecutionConfig defines the shape of the configuration object that can be passed to agent execution methods to influence their behavior at runtime.

configurable

Property
Type
Record<string, unknown> | undefined
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.

metadata

Property
Type
Record<string, unknown> | undefined

Metadata for this call and any sub-calls. Keys must be strings and values must be JSON-serializable.

recursionLimit

Property
Type
number | undefined

Maximum number of times a call can recurse. Defaults to 25 if omitted.

runName

Property
Type
string | undefined

Name for the tracer run. Defaults to the name of the class.

signal

Property
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.

tags

Property
Type
string[] | undefined

Tags for this call and any sub-calls. Use them to filter calls.

AgentCustomState

Type definition
Type parameters
<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>

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

Type definition
Type parameters
<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>

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

Type definition
Type parameters
<TInput extends AgentData, TOutput extends AgentData>

Partial state update returned by a FunctionAgent or LLMAgent node.

Supertypes
Partial<AgentNodeState<TInput, TOutput>>

AgentStateAnnotation

Type definition
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 definition
Type parameters
<TState extends AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

State update shape produced by graph nodes.

Type
Partial extends object ? Partial & Record<string, any> : Partial

TypedStateGraph

Type definition
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 definition
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

Type definition
Type parameters
<T extends object = AgentData>

ZodObjectSchema is a simplified type representing Zod object schemas used for input and output validation in agents.

Supertypes
Pick<z.ZodType‚ "safeParse"> ‚  default

GraphNodes

Type definition
Type parameters
<S extends AgentData, TUpdate = Partial>
Supertypes
Record<string‚ (state: S, config?: AgentExecutionConfig) => Promise<S | TUpdate> | S | TUpdate>

GraphEdge

Type definition
Type parameters
<S extends AgentData>
Type
{ from: string; decide: (state: S, config?: AgentExecutionConfig) => Promise<string | undefined> | string | undefined; } | { from: string; to: string; }