▾
import { WorkflowAgent } from "@arcgis/ai-components/agent-utils/WorkflowAgent.js";- Inheritance
- WorkflowAgent→
BaseAgent<TState>
- Since
- ArcGIS Maps SDK for JavaScript 5.1
Wraps a workflow as a single agent. Use WorkflowAgent when you want to coordinate agents using a supported workflow: SequentialWorkflow, ConditionalWorkflow, LoopWorkflow, ParallelWorkflow, RouterWorkflow, or SwitchWorkflow. The workflow defines how its agents are connected and executed.
Add the agent to an arcgis-assistant-agent component to make it available to the arcgis-assistant.
Constructors
Properties
| Property | Type | Class |
|---|---|---|
| inherited | ||
| inherited | ||
| inherited | ||
| | ||
| | ||
| inherited | ||
| | ||
| readonly inherited | ||
| | ||
| inherited |
createGraph
- Type
- AgentCreateGraph
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Creates the execution graph used to run this agent. FunctionAgent, LLMAgent, WorkflowAgent, and SkillAgent generate this function from their configuration. Configure the agent through its concrete utility rather than defining this graph directly.
description
- Type
- string
A description of what the agent does and when the assistant should invoke it. This can be used in registration metadata to provide context about the agent's functionality. A good description is clear and concise. Use bullet points to describe tasks the agent can accomplish. Provide examples of user questions or prompts that could be answered by the agent.
- Default value
- ""
inputSchema
- Type
- ZodObjectSchema<object> | undefined
Describes the input fields available to the workflow. The workflow uses only the schema's field names to initialize shared state.
middlewares
- Type
- AgentLifecycleMiddleware
[]
Before/after execution hooks, including approval, around the entire workflow. Model and tool-call hooks are not supported.
name
- Type
- string
A human-readable name that describes the agent's purpose. This name is used in the registration metadata and can be displayed in tooling. It should be unique across agents to avoid registration conflicts. A good agent name clearly indicates the scope and purpose of the agent. For example, "WeatherAgent" or "CustomerSupportAgent" are descriptive names that convey the agent's functionality as opposed to generic names like "Agent1" or "MyAgent".
The name is also used to generate the agent's id.
outputSchema
- Type
- ZodObjectSchema<object> | undefined
Describes the output fields available to the workflow. The workflow uses only the schema's field names to initialize shared state.
registration
- Type
- AgentRegistration
Provides the metadata and execution definition used to register this agent with the orchestrator.
workspace
- Type
- AgentStateAnnotation
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Defines the state channels used by the agent's execution graph. FunctionAgent, LLMAgent, WorkflowAgent, and SkillAgent configure them internally. Configure the agent through its concrete utility rather than setting these channels directly.
Methods
generate
- Signature
-
generate (): void
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Rebuilds the agent's internal execution setup from its current configuration. Concrete agent constructors call this after assigning their configuration. Call it again after changing configuration properties used to build the execution setup.
- Returns
- void
run
- Signature
-
run (state?: Partial<AgentGraphState<TCustomState>>, config?: AgentExecutionConfig): Promise<AgentGraphState<TCustomState>>
Executes the agent using the provided state and configuration, then returns the resulting state.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| state | Optional initial state for the agent. This can include any custom fields defined by the agent. | | |
| config | Optional execution configuration that can influence the agent's behavior during invocation. | |
- Returns
- Promise<AgentGraphState
> A promise that resolves to the agent state after execution.
Type definitions
WorkflowAgentConstructProperties
Properties for constructing a WorkflowAgent. name and workflow are required.
- Supertypes
- Partial<Pick<WorkflowAgent
, "description" | "id" | "inputSchema" | "middlewares" | "outputSchema"> > ‚ Pick<WorkflowAgent‚ "name" | "workflow">