ESM
import { LLMAgent } from "@arcgis/ai-components/agent-utils/LLMAgent.js";
Inheritance
LLMAgent→BaseAgent<AgentCustomState<TInput, TOutput>>
Since
ArcGIS Maps SDK for JavaScript 5.1

Uses a language model, a prompt template, and optional tools to perform a task. Use LLMAgent when a model needs to interpret a request, choose tools, or generate a response. It supports optional input and output schemas and middleware, and can run independently or as a step in a workflow.

Add the agent to an arcgis-assistant-agent component to make it available to the arcgis-assistant.

Constructors

Constructor

Constructor

Parameters

ParameterTypeDescriptionRequired
properties
LLMAgentConstructProperties<TInput, TOutput>

Properties

createGraph

inherited Property
Type
AgentCreateGraph
Inherited from: BaseAgent
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

inherited Property
Type
string
Inherited from: BaseAgent

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
""

id

autocast inherited Property
Type
string
Inherited from: BaseAgent

The unique identifier for the agent. When not provided, it is derived from the name property. This ID is used for registration and invocation purposes.

inputSchema

Property
Type
ZodObjectSchema | undefined

Describes the input data available to the agent. Use createSchema to create one from a supported schema definition, or provide a Zod object directly.

middlewares

Property
Type
AgentMiddleware<AgentCustomState<TInput, TOutput>>[]

Middleware that can modify agent execution. LLMAgent supports before/after agent and model hooks, plus model-call and tool-call wrappers. See AgentMiddleware.

modelTier

Property
Type
ChatModelTier

The model tier to use for the agent. Defaults to "default". See ChatModelTier for tier capabilities, current model mappings, and model-change considerations.

Default value
"default"

name

inherited Property
Type
string
Inherited from: BaseAgent

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

Property
Type
ZodObjectSchema | undefined

Describes the structured output expected from the agent. Use createSchema to create one from a supported schema definition, or provide a Zod object directly. When provided, LLMAgent requests structured output and validates the result against this schema. If omitted, LLMAgent returns the final response as text in outputMessage.

prompt

Property
Type
string

The prompt template used to generate the agent's response. Reference values from the agent's state with {variableName} placeholders.

Example
// `location` and `weather` are variables extracted from the agent's state.
"Generate a weather report for {location} based on the current {weather} conditions."

registration

readonlyinherited Property
Type
AgentRegistration
Inherited from: BaseAgent

Provides the metadata and execution definition used to register this agent with the orchestrator.

tools

Property
Type
LLMAgentTool[] | undefined

Optional tools the model can call during execution, such as a FunctionTool.

See also

workspace

inherited Property
Type
AgentStateAnnotation
Inherited from: BaseAgent
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

MethodSignatureClass
generate(): void
run
inherited
run(state?: Partial<AgentGraphState<TCustomState>>, config?: AgentExecutionConfig): Promise<AgentGraphState<TCustomState>>

generate

Method
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

inherited Method
Signature
run (state?: Partial<AgentGraphState<TCustomState>>, config?: AgentExecutionConfig): Promise<AgentGraphState<TCustomState>>
Inherited from: BaseAgent

Executes the agent using the provided state and configuration, then returns the resulting state.

Parameters

ParameterTypeDescriptionRequired
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

LLMAgentTool

Type definition

A tool accepted by LLMAgent's tools property. This is composed of either:

Type
FunctionToolLike | StructuredToolInterface

LLMAgentConstructProperties

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

Properties for constructing an LLMAgent. name and prompt are required.

Supertypes
Partial<Pick<LLMAgent<TInput, TOutput>, "description" | "id" | "inputSchema" | "middlewares" | "modelTier" | "outputSchema" | "tools">> ‚  Pick<LLMAgent<TInput, TOutput>‚ "name" | "prompt">