Skip to content

Handle Agent RPC by ID

client.agents.rpc(stringagentID, AgentRpcParams { method, params, id, jsonrpc } body, RequestOptionsoptions?): AgentRpcResponse { result, id, error, jsonrpc }
POST/agents/{agent_id}/rpc

Handle JSON-RPC requests for an agent by its unique ID.

ParametersExpand Collapse
agentID: string
body: AgentRpcParams { method, params, id, jsonrpc }
method: "event/send" | "task/create" | "message/send" | 2 more
One of the following:
"event/send"
"task/create"
"message/send"
"task/cancel"
"task/interrupt"
params: CreateTaskRequest { name, params, task_metadata } | CancelTaskRequest { task_id, task_name } | InterruptTaskRequest { task_id, task_name } | 2 more

The parameters for the agent RPC request

One of the following:
CreateTaskRequest { name, params, task_metadata }
name?: string | null

Optional human-readable name for the task. When set it must be globally unique. task/create is get-or-create by name: reusing an existing name returns the existing task (with its prior history) instead of creating a new one, so omit name (or make it unique, e.g. by appending a UUID) whenever each call should produce a fresh task.

params?: Record<string, unknown> | null

The parameters for the task. On a get-or-create by name, providing params overwrites the existing task’s params (it is not a pure read).

task_metadata?: Record<string, unknown> | null

Caller-provided metadata to persist on the task row. Only applied at task creation; ignored if a task with this name already exists. Forwarded to the agent inside the ACP payload for backward compatibility.

CancelTaskRequest { task_id, task_name }
task_id?: string | null

The ID of the task to cancel. Either this or task_name must be provided.

task_name?: string | null

The name of the task to cancel. Either this or task_id must be provided.

InterruptTaskRequest { task_id, task_name }
task_id?: string | null

The ID of the task to interrupt. Either this or task_name must be provided.

task_name?: string | null

The name of the task to interrupt. Either this or task_id must be provided.

SendMessageRequest { content, stream, task_id, 2 more }

The message that was sent to the agent

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

stream?: boolean

Whether to stream the response message back to the client

task_id?: string | null

The ID of the task that the message was sent to

task_name?: string | null

The name of the task that the message was sent to

task_params?: Record<string, unknown> | null

The parameters for the task (only used when creating new tasks)

SendEventRequest { content, task_id, task_name }
content?: TaskMessageContent | null

The content to send to the event

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id?: string | null

The ID of the task that the event was sent to

task_name?: string | null

The name of the task that the event was sent to

id?: number | string | null
One of the following:
number
string
jsonrpc?: "2.0"
ReturnsExpand Collapse
AgentRpcResponse { result, id, error, jsonrpc }
result: AgentRpcResult | null

The result of the agent RPC request

One of the following:
Array<TaskMessage { content, task_id, id, 3 more } >

The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id: string

ID of the task this message belongs to

id?: string | null

The task message’s unique id

created_at?: string | null

The timestamp when the message was created

formatdate-time
streaming_status?: "IN_PROGRESS" | "DONE" | null
One of the following:
"IN_PROGRESS"
"DONE"
updated_at?: string | null

The timestamp when the message was last updated

formatdate-time
StreamTaskMessageStart { content, index, parent_task_message, type }

Event for starting a streaming message

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

index?: number | null
parent_task_message?: TaskMessage { content, task_id, id, 3 more } | null

Represents a message in the agent system.

This entity is used to store messages in MongoDB, with each message associated with a specific task.

The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id: string

ID of the task this message belongs to

id?: string | null

The task message’s unique id

created_at?: string | null

The timestamp when the message was created

formatdate-time
streaming_status?: "IN_PROGRESS" | "DONE" | null
One of the following:
"IN_PROGRESS"
"DONE"
updated_at?: string | null

The timestamp when the message was last updated

formatdate-time
type?: "start"
StreamTaskMessageDelta { delta, index, parent_task_message, type }

Event for streaming chunks of content

delta?: TaskMessageDelta | null

Delta for text updates

One of the following:
TextDelta { text_delta, type }

Delta for text updates

text_delta?: string | null
type?: "text"
DataDelta { data_delta, type }

Delta for data updates

data_delta?: string | null
type?: "data"
ToolRequestDelta { name, tool_call_id, arguments_delta, type }

Delta for tool request updates

name: string
tool_call_id: string
arguments_delta?: string | null
type?: "tool_request"
ToolResponseDelta { name, tool_call_id, content_delta, type }

Delta for tool response updates

name: string
tool_call_id: string
content_delta?: string | null
type?: "tool_response"
ReasoningSummaryDelta { summary_index, summary_delta, type }

Delta for reasoning summary updates

summary_index: number
summary_delta?: string | null
type?: "reasoning_summary"
ReasoningContentDelta { content_index, content_delta, type }

Delta for reasoning content updates

content_index: number
content_delta?: string | null
type?: "reasoning_content"
index?: number | null
parent_task_message?: TaskMessage { content, task_id, id, 3 more } | null

Represents a message in the agent system.

This entity is used to store messages in MongoDB, with each message associated with a specific task.

The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id: string

ID of the task this message belongs to

id?: string | null

The task message’s unique id

created_at?: string | null

The timestamp when the message was created

formatdate-time
streaming_status?: "IN_PROGRESS" | "DONE" | null
One of the following:
"IN_PROGRESS"
"DONE"
updated_at?: string | null

The timestamp when the message was last updated

formatdate-time
type?: "delta"
StreamTaskMessageFull { content, index, parent_task_message, type }

Event for streaming the full content

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

index?: number | null
parent_task_message?: TaskMessage { content, task_id, id, 3 more } | null

Represents a message in the agent system.

This entity is used to store messages in MongoDB, with each message associated with a specific task.

The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id: string

ID of the task this message belongs to

id?: string | null

The task message’s unique id

created_at?: string | null

The timestamp when the message was created

formatdate-time
streaming_status?: "IN_PROGRESS" | "DONE" | null
One of the following:
"IN_PROGRESS"
"DONE"
updated_at?: string | null

The timestamp when the message was last updated

formatdate-time
type?: "full"
StreamTaskMessageDone { index, parent_task_message, type }

Event for indicating the task is done

index?: number | null
parent_task_message?: TaskMessage { content, task_id, id, 3 more } | null

Represents a message in the agent system.

This entity is used to store messages in MongoDB, with each message associated with a specific task.

The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

task_id: string

ID of the task this message belongs to

id?: string | null

The task message’s unique id

created_at?: string | null

The timestamp when the message was created

formatdate-time
streaming_status?: "IN_PROGRESS" | "DONE" | null
One of the following:
"IN_PROGRESS"
"DONE"
updated_at?: string | null

The timestamp when the message was last updated

formatdate-time
type?: "done"
Task { id, cleaned_at, created_at, 6 more }
id: string
cleaned_at?: string | null
created_at?: string | null
name?: string | null
params?: Record<string, unknown> | null
status?: "CANCELED" | "COMPLETED" | "FAILED" | 5 more | null
One of the following:
"CANCELED"
"COMPLETED"
"FAILED"
"RUNNING"
"INTERRUPTED"
"TERMINATED"
"TIMED_OUT"
"DELETED"
status_reason?: string | null
task_metadata?: Record<string, unknown> | null
updated_at?: string | null
Event { id, agent_id, sequence_id, 3 more }
id: string

The UUID of the event

agent_id: string

The UUID of the agent that the event belongs to

sequence_id: number

The sequence ID of the event

task_id: string

The UUID of the task that the event belongs to

content?: TaskMessageContent | null

The content of the event

One of the following:
TextContent { author, content, attachments, 3 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: string

The contents of the text message.

attachments?: Array<Attachment> | null

Optional list of file attachments with structured metadata.

file_id: string

The unique ID of the attached file

name: string

The name of the file

size: number

The size of the file in bytes

type: string

The MIME type or content type of the file

format?: TextFormat

The format of the message. This is used by the client to determine how to display the message.

One of the following:
"markdown"
"plain"
"code"
style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "text"

The type of the message, in this case text.

ReasoningContent { author, summary, content, 2 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
summary: Array<string>

A list of short reasoning summaries

content?: Array<string> | null

The reasoning content or chain-of-thought text

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "reasoning"

The type of the message, in this case reasoning.

DataContent { author, data, style, type }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
data: Record<string, unknown>

The contents of the data message.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "data"

The type of the message, in this case data.

ToolRequestContent { arguments, author, name, 3 more }
arguments: Record<string, unknown>

The arguments to the tool.

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
name: string

The name of the tool that is being requested.

tool_call_id: string

The ID of the tool call that is being requested.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_request"

The type of the message, in this case tool_request.

ToolResponseContent { author, content, name, 4 more }

The role of the messages author, in this case system, user, assistant, or tool.

One of the following:
"user"
"agent"
content: unknown

The result of the tool.

name: string

The name of the tool that is being responded to.

tool_call_id: string

The ID of the tool call that is being responded to.

is_error?: boolean | null

Whether the tool call resulted in an error. None when the harness does not report a status.

style?: MessageStyle

The style of the message. This is used by the client to determine how to display the message.

One of the following:
"static"
"active"
type?: "tool_response"

The type of the message, in this case tool_response.

created_at?: string | null

The timestamp of the event

formatdate-time
id?: number | string | null
One of the following:
number
string
error?: unknown
jsonrpc?: "2.0"

Handle Agent RPC by ID

import Agentex from 'agentex';

const client = new Agentex({
  apiKey: process.env['AGENTEX_SDK_API_KEY'], // This is the default and can be omitted
});

const agentRpcResponse = await client.agents.rpc('agent_id', {
  method: 'event/send',
  params: {},
});

console.log(agentRpcResponse.id);
{
  "result": [
    {
      "content": {
        "author": "user",
        "content": "content",
        "attachments": [
          {
            "file_id": "file_id",
            "name": "name",
            "size": 0,
            "type": "type"
          }
        ],
        "format": "markdown",
        "style": "static",
        "type": "text"
      },
      "task_id": "task_id",
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "streaming_status": "IN_PROGRESS",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "id": 0,
  "error": {},
  "jsonrpc": "2.0"
}
Returns Examples
{
  "result": [
    {
      "content": {
        "author": "user",
        "content": "content",
        "attachments": [
          {
            "file_id": "file_id",
            "name": "name",
            "size": 0,
            "type": "type"
          }
        ],
        "format": "markdown",
        "style": "static",
        "type": "text"
      },
      "task_id": "task_id",
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "streaming_status": "IN_PROGRESS",
      "updated_at": "2019-12-27T18:11:19.117Z"
    }
  ],
  "id": 0,
  "error": {},
  "jsonrpc": "2.0"
}