import { createSchema, sendUXSuggestion, createFunctionAgent, createFunctionTool, createLLMAgent } from "@arcgis/ai-components/agent-utils/index.js";Functions
createSchema
- 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 optionalenum)numberbooleanarraywith primitive or nested item definitionsobjectwith nestedfields
- Signature
-
createSchema <const TDefinition extends SchemaDefinition>(definition: TDefinition): Promise<ZodObjectSchema<SchemaDefinitionData<TDefinition>>>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| 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
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| suggestion | | | |
| config | RunnableConfig | | |
createFunctionAgent
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | FunctionAgentConstructProperties<TInput, TOutput> | | |
- Returns
- Promise<FunctionAgent<TInput, TOutput>>
createFunctionTool
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | FunctionToolConstructProperties<TInput, TOutput> | | |
- Returns
- Promise<FunctionTool<TInput, TOutput>>
createLLMAgent
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | LLMAgentConstructProperties<TInput, TOutput> | | |
createWorkflowAgent
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<WorkflowAgent
>
createConditionalWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<ConditionalWorkflow
>
createLoopWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<LoopWorkflow
>
createParallelWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<ParallelWorkflow
>
createRouterWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<RouterWorkflow
>
createSequentialWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<SequentialWorkflow
>
createSwitchWorkflow
- 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
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
- Returns
- Promise<SwitchWorkflow
>