Handle Agent RPC by ID
Handle JSON-RPC requests for an agent by its unique ID.
ParametersExpand Collapse
The parameters for the agent RPC request
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.
class ParamsSendMessageRequest: …
The message that was sent to the agent
class TextContent: …
class ParamsSendEventRequest: …
content: Optional[TaskMessageContentParam]
The content to send to the event
class TextContent: …
ReturnsExpand Collapse
class AgentRpcResponse: …
result: Optional[AgentRpcResult]
The result of the agent RPC request
List[TaskMessage]
The content of the message. This content is not OpenAI compatible. These are messages that are meant to be displayed to the user.
class TextContent: …
class StreamTaskMessageStart: …
Event for starting a streaming message
class TextContent: …
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.
class TextContent: …
class StreamTaskMessageDelta: …
Event for streaming chunks of content
delta: Optional[TaskMessageDelta]
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.
class TextContent: …
class StreamTaskMessageFull: …
Event for streaming the full content
class TextContent: …
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.
class TextContent: …
class StreamTaskMessageDone: …
Event for indicating the task is done
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.
class TextContent: …
class Event: …
content: Optional[TaskMessageContent]
The content of the event
class TextContent: …
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"
}