AgentOperations
The agent.* operations.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”readonly agent: string;The agent's ID.
conversation
Section titled “conversation”readonly conversation: string | undefined;The conversation the methods act on. undefined for the agent's own history.
Methods
Section titled “Methods”read()
Section titled “read()”read(options?): Promise<AgentSnapshot>;Read an agent's current status.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSnapshot>
define()
Section titled “define()”define(input?, options?): Promise<AgentSnapshot>;Define an agent.
Creates the agent from this definition, or updates a running agent from its next turn. Each call replaces the whole definition. An unsupported key returns not_supported with the key's name.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input? |
AgentDefinition |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSnapshot>
forget()
Section titled “forget()”forget(options?): Promise<void>;Delete an agent.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<void>
ask(input, options?): Promise<{ id: string; cursor: string;}>;Send a message to an agent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
Ask |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<{
id: string;
cursor: string;
}>
decide()
Section titled “decide()”decide(input, options?): Promise<object[]>;Approve or reject pending tool calls.
All decisions are applied together and recorded under the caller. A rejection's reason is sent to the model instead of the tool's result. An approval's note is sent with the result.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
Decisions |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<object[]>
authorization()
Section titled “authorization()”authorization(interrupt, options?): Promise<Authorization>;Read the authorization URL for a pending call.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
interrupt |
string |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<Authorization>
cancel()
Section titled “cancel()”cancel(options?): Promise<void>;Cancel an agent's current turn.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<void>
events()
Section titled “events()”events(input?, options?): Promise<Events>;Read an agent's events.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input? |
{ types?: string[]; after?: string; before?: string; order?: "oldest" | "newest"; limit?: number; } |
- |
input.types? |
string[] |
The event types to return, for example wardrik.run.completed. List each type once. Defaults to all types. wardrik.events.dropped is always returned. |
input.after? |
string |
Return events after this cursor. Use the next value from the previous page, an event ID from a stream, or the cursor from agent.read, agent.timeline or agent.runs. |
input.before? |
string |
With order newest, return events before this cursor. Use the next value from the previous page. |
input.order? |
"oldest" | "newest" |
oldest returns the oldest events first, after the cursor; newest returns the newest first, before the cursor or from the end. Defaults to oldest. |
input.limit? |
number |
The maximum number to return. Defaults to 100. |
options? |
CallOptions |
- |
Returns
Section titled “Returns”Promise<Events>
streamEvents()
Section titled “streamEvents()”streamEvents(input?, options?): EventStream;Like events, then follows each new event as it's written. Starts after after, or at
the end of the log. See EventStream.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input? |
{ types?: string[]; after?: string; before?: string; order?: "oldest" | "newest"; } |
- |
input.types? |
string[] |
The event types to return, for example wardrik.run.completed. List each type once. Defaults to all types. wardrik.events.dropped is always returned. |
input.after? |
string |
Return events after this cursor. Use the next value from the previous page, an event ID from a stream, or the cursor from agent.read, agent.timeline or agent.runs. |
input.before? |
string |
With order newest, return events before this cursor. Use the next value from the previous page. |
input.order? |
"oldest" | "newest" |
oldest returns the oldest events first, after the cursor; newest returns the newest first, before the cursor or from the end. Defaults to oldest. |
options? |
StreamOptions |
- |
Returns
Section titled “Returns”timeline()
Section titled “timeline()”timeline(options?): Promise<Timeline>;Read an agent's conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<Timeline>
runs()
Section titled “runs()”runs(options?): Promise<Runs>;Read an agent's runs and their cost.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<Runs>
approve()
Section titled “approve()”approve( interrupt, input?, options?): Promise<object[]>;Approve a pending tool call.
Same as agent.decide with one approval. Recorded under the caller.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
interrupt |
string |
input? |
Approve |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<object[]>
deny()
Section titled “deny()”deny( interrupt, input?, options?): Promise<object[]>;Reject a pending tool call.
Same as agent.decide with one rejection. Recorded under the caller.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
interrupt |
string |
input? |
Deny |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<object[]>
definition()
Section titled “definition()”definition(options?): Promise<DefinitionRead>;Read an agent's definition.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<DefinitionRead>
spawn()
Section titled “spawn()”spawn(options?): Promise<AgentSummary>;Start an agent.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSummary>
stop()
Section titled “stop()”stop(options?): Promise<AgentSummary>;Stop an agent.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSummary>
clear()
Section titled “clear()”clear(options?): Promise<AgentSnapshot>;Clear an agent's history.
Deletes the agent's history. The agent, its definition and its other conversations are kept. Returns conflict while the agent is running a turn or waiting for an approval.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSnapshot>
calls()
Section titled “calls()”calls(options?): Promise<object[]>;List an agent's running tool calls.
Returns not_found while the agent is asleep.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<object[]>
runtime()
Section titled “runtime()”runtime(options?): Promise<AgentRuntime>;Read an agent's resource use.
Returns the memory, mailbox size and work of a running agent's processes. Returns not_found while the agent is asleep.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentRuntime>
resolved()
Section titled “resolved()”resolved(options?): Promise<AgentResolved>;Read what an agent gets.
Returns what the app gives the agent: who it works for, its policies, MCP servers and their tools, notify targets, channels and workspaces.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentResolved>
files()
Section titled “files()”files(input?, options?): Promise<AgentFile[]>;List an agent's files.
Returns the files in the agent's workspace, newest first, at most 500. Files shared with it from other workspaces aren't listed.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input? |
{ glob?: string; } |
- |
input.glob? |
string |
Return only the paths this glob matches: * within a folder, ? one character, ** across folders. Defaults to **. |
options? |
CallOptions |
- |
Returns
Section titled “Returns”Promise<AgentFile[]>
file()
Section titled “file()”file(input, options?): Promise<AgentFileContent>;Read an agent's file.
Returns a file in the agent's workspace, with its content and version. Returns not_found if there's no file at the path.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input |
{ path: string; } |
- |
input.path |
string |
The file's path in the workspace, such as notes/today.md. |
options? |
CallOptions |
- |
Returns
Section titled “Returns”Promise<AgentFileContent>
filePut()
Section titled “filePut()”filePut(input, options?): Promise<AgentFile>;Write an agent's file.
Writes a file in the agent's workspace. With version, writes only over that version and returns conflict if the file has changed. Without version, replaces any file at the path. The file carries no labels.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
AgentFilePut |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentFile>
fileDelete()
Section titled “fileDelete()”fileDelete(input, options?): Promise<void>;Delete an agent's file.
Deletes a file in the agent's workspace. Returns not_found if there's no file at the path.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input |
{ path: string; } |
- |
input.path |
string |
The file's path in the workspace, such as notes/today.md. |
options? |
CallOptions |
- |
Returns
Section titled “Returns”Promise<void>
kill()
Section titled “kill()”kill(call, options?): Promise<void>;Stop a tool call.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
call |
string |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<void>
triggerSet()
Section titled “triggerSet()”triggerSet( trigger, input?, options?): Promise<TriggerDefinition>;Create or update an agent's trigger.
Creates or updates one trigger and saves it in the agent's definition. Returns not_found if the agent has no definition. If every and timezone don't change, the next run time is kept.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
trigger |
string |
input? |
TriggerDefinition |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<TriggerDefinition>
triggerRemove()
Section titled “triggerRemove()”triggerRemove(trigger, options?): Promise<TriggerDefinition>;Remove an agent's trigger.
Acts on the agent, never a conversation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
trigger |
string |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<TriggerDefinition>
move()
Section titled “move()”move(input, options?): Promise<AgentSummary>;Move an agent to another node.
Restarts the agent on the given node, with its state. A turn in progress is stopped, and pending approvals are dropped. Send the request again after the move.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
Node |
options? |
CallOptions |
Returns
Section titled “Returns”Promise<AgentSummary>