Skip to content

Handle Agent RPC by ID

agents.rpc(stragent_id, AgentRpcParams**kwargs) -> AgentRpcResponse
POST/agents/{agent_id}/rpc

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

ParametersExpand Collapse
agent_id: str
method: Literal["event/send", "task/create", "message/send", 2 more]
One of the following:
"event/send"
"task/create"
"message/send"
"task/cancel"
"task/interrupt"
params: Params

The parameters for the agent RPC request

One of the following:
class ParamsCreateTaskRequest: …
name: Optional[str]

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: Optional[Dict[str, object]]

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: Optional[Dict[str, object]]

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.

class ParamsCancelTaskRequest: …
task_id: Optional[str]

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

task_name: Optional[str]

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

class ParamsInterruptTaskRequest: …
task_id: Optional[str]

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

task_name: Optional[str]

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

class ParamsSendMessageRequest: …

The message that was sent to the agent

One of the following:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

stream: Optional[bool]

Whether to stream the response message back to the client

task_id: Optional[str]

The ID of the task that the message was sent to

task_name: Optional[str]

The name of the task that the message was sent to

task_params: Optional[Dict[str, object]]

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

class ParamsSendEventRequest: …
content: Optional[TaskMessageContentParam]

The content to send to the event

One of the following:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: Optional[str]

The ID of the task that the event was sent to

task_name: Optional[str]

The name of the task that the event was sent to

id: Optional[Union[int, str, null]]
One of the following:
int
str
jsonrpc: Optional[Literal["2.0"]]
ReturnsExpand Collapse
class AgentRpcResponse: …
result: Optional[AgentRpcResult]

The result of the agent RPC request

One of the following:

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:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: str

ID of the task this message belongs to

id: Optional[str]

The task message’s unique id

created_at: Optional[datetime]

The timestamp when the message was created

formatdate-time
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]]
One of the following:
"IN_PROGRESS"
"DONE"
updated_at: Optional[datetime]

The timestamp when the message was last updated

formatdate-time
class StreamTaskMessageStart: …

Event for starting a streaming message

One of the following:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

index: Optional[int]
parent_task_message: Optional[TaskMessage]

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:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: str

ID of the task this message belongs to

id: Optional[str]

The task message’s unique id

created_at: Optional[datetime]

The timestamp when the message was created

formatdate-time
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]]
One of the following:
"IN_PROGRESS"
"DONE"
updated_at: Optional[datetime]

The timestamp when the message was last updated

formatdate-time
type: Optional[Literal["start"]]
class StreamTaskMessageDelta: …

Event for streaming chunks of content

delta: Optional[TaskMessageDelta]

Delta for text updates

One of the following:
class TextDelta: …

Delta for text updates

text_delta: Optional[str]
type: Optional[Literal["text"]]
class DataDelta: …

Delta for data updates

data_delta: Optional[str]
type: Optional[Literal["data"]]
class ToolRequestDelta: …

Delta for tool request updates

name: str
tool_call_id: str
arguments_delta: Optional[str]
type: Optional[Literal["tool_request"]]
class ToolResponseDelta: …

Delta for tool response updates

name: str
tool_call_id: str
content_delta: Optional[str]
type: Optional[Literal["tool_response"]]
class ReasoningSummaryDelta: …

Delta for reasoning summary updates

summary_index: int
summary_delta: Optional[str]
type: Optional[Literal["reasoning_summary"]]
class ReasoningContentDelta: …

Delta for reasoning content updates

content_index: int
content_delta: Optional[str]
type: Optional[Literal["reasoning_content"]]
index: Optional[int]
parent_task_message: Optional[TaskMessage]

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:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: str

ID of the task this message belongs to

id: Optional[str]

The task message’s unique id

created_at: Optional[datetime]

The timestamp when the message was created

formatdate-time
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]]
One of the following:
"IN_PROGRESS"
"DONE"
updated_at: Optional[datetime]

The timestamp when the message was last updated

formatdate-time
type: Optional[Literal["delta"]]
class StreamTaskMessageFull: …

Event for streaming the full content

One of the following:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

index: Optional[int]
parent_task_message: Optional[TaskMessage]

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:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: str

ID of the task this message belongs to

id: Optional[str]

The task message’s unique id

created_at: Optional[datetime]

The timestamp when the message was created

formatdate-time
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]]
One of the following:
"IN_PROGRESS"
"DONE"
updated_at: Optional[datetime]

The timestamp when the message was last updated

formatdate-time
type: Optional[Literal["full"]]
class StreamTaskMessageDone: …

Event for indicating the task is done

index: Optional[int]
parent_task_message: Optional[TaskMessage]

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:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

task_id: str

ID of the task this message belongs to

id: Optional[str]

The task message’s unique id

created_at: Optional[datetime]

The timestamp when the message was created

formatdate-time
streaming_status: Optional[Literal["IN_PROGRESS", "DONE"]]
One of the following:
"IN_PROGRESS"
"DONE"
updated_at: Optional[datetime]

The timestamp when the message was last updated

formatdate-time
type: Optional[Literal["done"]]
class Task: …
id: str
cleaned_at: Optional[datetime]
created_at: Optional[datetime]
name: Optional[str]
params: Optional[Dict[str, object]]
status: Optional[Literal["CANCELED", "COMPLETED", "FAILED", 5 more]]
One of the following:
"CANCELED"
"COMPLETED"
"FAILED"
"RUNNING"
"INTERRUPTED"
"TERMINATED"
"TIMED_OUT"
"DELETED"
status_reason: Optional[str]
task_metadata: Optional[Dict[str, object]]
updated_at: Optional[datetime]
class Event: …
id: str

The UUID of the event

agent_id: str

The UUID of the agent that the event belongs to

sequence_id: int

The sequence ID of the event

task_id: str

The UUID of the task that the event belongs to

content: Optional[TaskMessageContent]

The content of the event

One of the following:
class TextContent: …

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

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

The contents of the text message.

attachments: Optional[List[Attachment]]

Optional list of file attachments with structured metadata.

file_id: str

The unique ID of the attached file

name: str

The name of the file

size: int

The size of the file in bytes

type: str

The MIME type or content type of the file

format: Optional[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: Optional[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: Optional[Literal["text"]]

The type of the message, in this case text.

class ReasoningContent: …

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

One of the following:
"user"
"agent"
summary: List[str]

A list of short reasoning summaries

content: Optional[List[str]]

The reasoning content or chain-of-thought text

style: Optional[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: Optional[Literal["reasoning"]]

The type of the message, in this case reasoning.

class DataContent: …

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

One of the following:
"user"
"agent"
data: Dict[str, object]

The contents of the data message.

style: Optional[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: Optional[Literal["data"]]

The type of the message, in this case data.

class ToolRequestContent: …
arguments: Dict[str, object]

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: str

The name of the tool that is being requested.

tool_call_id: str

The ID of the tool call that is being requested.

style: Optional[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: Optional[Literal["tool_request"]]

The type of the message, in this case tool_request.

class ToolResponseContent: …

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

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

The result of the tool.

name: str

The name of the tool that is being responded to.

tool_call_id: str

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

is_error: Optional[bool]

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

style: Optional[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: Optional[Literal["tool_response"]]

The type of the message, in this case tool_response.

created_at: Optional[datetime]

The timestamp of the event

formatdate-time
id: Optional[Union[int, str, null]]
One of the following:
int
str
error: Optional[object]
jsonrpc: Optional[Literal["2.0"]]

Handle Agent RPC by ID

import os
from agentex import Agentex

client = Agentex(
    api_key=os.environ.get("AGENTEX_SDK_API_KEY"),  # This is the default and can be omitted
)
agent_rpc_response = client.agents.rpc(
    agent_id="agent_id",
    method="event/send",
    params={},
)
print(agent_rpc_response.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"
}