ESM
import { createSchema, sendUXSuggestion, createFunctionAgent, createFunctionTool, createLLMAgent } from "@arcgis/ai-components/agent-utils/index.js";

Functions

createSchema

Function
Type parameters
<const TDefinition extends SchemaDefinition>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a Zod schema from a plain object schema definition.

Supports all schema field variants:

  • string (with optional enum)
  • number
  • boolean
  • array with primitive or nested item definitions
  • object with nested fields
Signature
createSchema <const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>

Parameters

ParameterTypeDescriptionRequired
definition
TDefinition
Returns
Promise<ZodObjectSchema<SchemaDefinitionData>>
Examples
const primitiveSchema = await createSchema({
name: { type: "string", description: "Search location name", required: true },
radius: { type: "number", description: "Search radius in miles" },
active: { type: "boolean", description: "Whether the search is enabled" },
});
const nestedObjectSchema = await createSchema({
query: { type: "string", description: "User search text", required: true },
options: {
type: "object",
description: "Search options",
required: true,
fields: {
center: {
type: "object",
description: "Map center point",
fields: {
latitude: { type: "number", description: "Center latitude", required: true },
longitude: { type: "number", description: "Center longitude", required: true },
},
},
categories: { type: "array", description: "Selected categories", itemType: "string" },
},
},
});
const arrayOfObjectsSchema = await createSchema({
constraints: {
type: "array",
description: "Constraint rules",
itemType: {
type: "object",
description: "Single constraint rule",
fields: {
key: { type: "string", description: "Constraint key", required: true },
enabled: { type: "boolean", description: "Whether this rule is active" },
values: { type: "array", description: "Rule values", itemType: "string" },
},
},
},
});

sendUXSuggestion

Function
Since
ArcGIS Maps SDK for JavaScript 5.1

Sends an optional UX suggestion from an agent run to the host application. Use this for non-blocking hints (for example, recommended next actions or UI prompts) that the app may choose to display.

Signature
sendUXSuggestion (suggestion: UXSuggestion, config?: RunnableConfig): Promise<void>

Parameters

ParameterTypeDescriptionRequired
suggestion
config
RunnableConfig
Returns
Promise<void>

createFunctionAgent

Function
Type parameters
<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a FunctionAgent instance from the existing agent implementation.

Signature
createFunctionAgent <TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: FunctionAgentConstructProperties<TInput, TOutput>): Promise<FunctionAgent<TInput, TOutput>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<FunctionAgent<TInput, TOutput>>

createFunctionTool

Function
Type parameters
<TInput extends AgentData, TOutput = unknown>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a FunctionTool instance from the existing tool implementation.

Signature
createFunctionTool <TInput extends AgentData, TOutput = unknown>(properties: FunctionToolConstructProperties<TInput, TOutput>): Promise<FunctionTool<TInput, TOutput>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<FunctionTool<TInput, TOutput>>

createLLMAgent

Function
Type parameters
<TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates an LLMAgent instance from the existing agent implementation.

Signature
createLLMAgent <TInput extends AgentData = AgentData, TOutput extends AgentData = AgentData>(properties: LLMAgentConstructProperties<TInput, TOutput>): Promise<LLMAgent<TInput, TOutput>>

Parameters

ParameterTypeDescriptionRequired
properties
LLMAgentConstructProperties<TInput, TOutput>
Returns
Promise<LLMAgent<TInput, TOutput>>

createWorkflowAgent

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a WorkflowAgent instance from the existing workflow agent implementation.

Signature
createWorkflowAgent <TState extends AgentData = AgentData>(properties: WorkflowAgentConstructProperties<TState>): Promise<WorkflowAgent<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<WorkflowAgent>

createConditionalWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a ConditionalWorkflow instance from the existing workflow implementation.

Signature
createConditionalWorkflow <TState extends AgentData = AgentData>(properties: ConditionalWorkflowConstructProperties<TState>): Promise<ConditionalWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<ConditionalWorkflow>

createLoopWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a LoopWorkflow instance from the existing workflow implementation.

Signature
createLoopWorkflow <TState extends AgentData = AgentData>(properties: LoopWorkflowConstructProperties<TState>): Promise<LoopWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<LoopWorkflow>

createParallelWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a ParallelWorkflow instance from the existing workflow implementation.

Signature
createParallelWorkflow <TState extends AgentData = AgentData>(properties: ParallelWorkflowConstructProperties<TState>): Promise<ParallelWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<ParallelWorkflow>

createRouterWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a RouterWorkflow instance from the existing workflow implementation.

Signature
createRouterWorkflow <TState extends AgentData = AgentData>(properties: RouterWorkflowConstructProperties<TState>): Promise<RouterWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<RouterWorkflow>

createSequentialWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a SequentialWorkflow instance from the existing workflow implementation.

Signature
createSequentialWorkflow <TState extends AgentData = AgentData>(properties: SequentialWorkflowConstructProperties<TState>): Promise<SequentialWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<SequentialWorkflow>

createSwitchWorkflow

Function
Type parameters
<TState extends AgentData = AgentData>
Since
ArcGIS Maps SDK for JavaScript 5.1

Creates a SwitchWorkflow instance from the existing workflow implementation.

Signature
createSwitchWorkflow <TState extends AgentData = AgentData>(properties: SwitchWorkflowConstructProperties<TState>): Promise<SwitchWorkflow<TState>>

Parameters

ParameterTypeDescriptionRequired
properties
Returns
Promise<SwitchWorkflow>

Type definitions

UXSuggestion

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.1

The suggestions emitted by the agent to the user interface.

type

Property
Type
string

The type of suggestion being made.

data

Property
Type
Record<string, unknown> | undefined

Optional additional data associated with the suggestion.