Skip to content

AgentOperations

The agent.* operations.

readonly agent: string;

The agent's ID.


readonly conversation: string | undefined;

The conversation the methods act on. undefined for the agent's own history.

read(options?): Promise<AgentSnapshot>;

Read an agent's current status.

Parameter Type
options? CallOptions

Promise<AgentSnapshot>


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.

Parameter Type
input? AgentDefinition
options? CallOptions

Promise<AgentSnapshot>


forget(options?): Promise<void>;

Delete an agent.

Acts on the agent, never a conversation.

Parameter Type
options? CallOptions

Promise<void>


ask(input, options?): Promise<{
id: string;
cursor: string;
}>;

Send a message to an agent.

Parameter Type
input Ask
options? CallOptions

Promise<{ id: string; cursor: string; }>


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.

Parameter Type
input Decisions
options? CallOptions

Promise<object[]>


authorization(interrupt, options?): Promise<Authorization>;

Read the authorization URL for a pending call.

Parameter Type
interrupt string
options? CallOptions

Promise<Authorization>


cancel(options?): Promise<void>;

Cancel an agent's current turn.

Parameter Type
options? CallOptions

Promise<void>


events(input?, options?): Promise<Events>;

Read an agent's events.

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 -

Promise<Events>


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.

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 -

EventStream


timeline(options?): Promise<Timeline>;

Read an agent's conversation.

Parameter Type
options? CallOptions

Promise<Timeline>


runs(options?): Promise<Runs>;

Read an agent's runs and their cost.

Parameter Type
options? CallOptions

Promise<Runs>


approve(
interrupt,
input?,
options?
): Promise<object[]>;

Approve a pending tool call.

Same as agent.decide with one approval. Recorded under the caller.

Parameter Type
interrupt string
input? Approve
options? CallOptions

Promise<object[]>


deny(
interrupt,
input?,
options?
): Promise<object[]>;

Reject a pending tool call.

Same as agent.decide with one rejection. Recorded under the caller.

Parameter Type
interrupt string
input? Deny
options? CallOptions

Promise<object[]>


definition(options?): Promise<DefinitionRead>;

Read an agent's definition.

Acts on the agent, never a conversation.

Parameter Type
options? CallOptions

Promise<DefinitionRead>


spawn(options?): Promise<AgentSummary>;

Start an agent.

Acts on the agent, never a conversation.

Parameter Type
options? CallOptions

Promise<AgentSummary>


stop(options?): Promise<AgentSummary>;

Stop an agent.

Parameter Type
options? CallOptions

Promise<AgentSummary>


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.

Parameter Type
options? CallOptions

Promise<AgentSnapshot>


calls(options?): Promise<object[]>;

List an agent's running tool calls.

Returns not_found while the agent is asleep.

Parameter Type
options? CallOptions

Promise<object[]>


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.

Parameter Type
options? CallOptions

Promise<AgentRuntime>


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.

Parameter Type
options? CallOptions

Promise<AgentResolved>


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.

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 -

Promise<AgentFile[]>


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.

Parameter Type Description
input { path: string; } -
input.path string The file's path in the workspace, such as notes/today.md.
options? CallOptions -

Promise<AgentFileContent>


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.

Parameter Type
input AgentFilePut
options? CallOptions

Promise<AgentFile>


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.

Parameter Type Description
input { path: string; } -
input.path string The file's path in the workspace, such as notes/today.md.
options? CallOptions -

Promise<void>


kill(call, options?): Promise<void>;

Stop a tool call.

Parameter Type
call string
options? CallOptions

Promise<void>


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.

Parameter Type
trigger string
input? TriggerDefinition
options? CallOptions

Promise<TriggerDefinition>


triggerRemove(trigger, options?): Promise<TriggerDefinition>;

Remove an agent's trigger.

Acts on the agent, never a conversation.

Parameter Type
trigger string
options? CallOptions

Promise<TriggerDefinition>


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.

Parameter Type
input Node
options? CallOptions

Promise<AgentSummary>