Class AgentProxy
- Inheritance
-
Agent
Proxy
- Inherited Members
Constructors
AgentProxy(AgentId, IAgentRuntime)
Parameters
agentId
AgentId runtime
IAgentRuntime
Fields
Id
The target agent for this proxy.
Field Value
Properties
Metadata
Gets the metadata of the agent.
Property Value
- Agent
Metadata An instance of Agent
Metadata containing details about the agent.
Methods
LoadStateAsync(JsonElement)
Loads the state of the agent from a previously saved state.
Parameters
state
JsonElement A dictionary representing the state of the agent. Must be JSON serializable.
Returns
- Value
Task A task representing the asynchronous operation.
SaveStateAsync()
Saves the state of the agent. The result must be JSON serializable.
Returns
- Value
Task <JsonElement > A task representing the asynchronous operation, returning a dictionary containing the saved state.
SendMessageAsync(object, AgentId, string?, CancellationToken)
Sends a message to the agent and processes the response.
public ValueTask<object?> SendMessageAsync(object message, AgentId sender, string? messageId = null, CancellationToken cancellationToken = default)
Parameters
message
objectThe message to send to the agent.
sender
AgentId The agent that is sending the message.
messageId
stringThe message ID. If
null
, a new message ID will be generated. This message ID must be unique and is recommended to be a UUID.cancellationToken
CancellationToken A token used to cancel an in-progress operation. Defaults to
null
.