Class AgentProxy
public class AgentProxy
- Inheritance
-
AgentProxy
- Inherited Members
Constructors
AgentProxy(AgentId, IAgentRuntime)
public AgentProxy(AgentId agentId, IAgentRuntime runtime)
Parameters
agentIdAgentIdruntimeIAgentRuntime
Fields
Id
The target agent for this proxy.
public AgentId Id
Field Value
Properties
Metadata
Gets the metadata of the agent.
public AgentMetadata Metadata { get; }
Property Value
- AgentMetadata
An instance of AgentMetadata containing details about the agent.
Methods
LoadStateAsync(JsonElement)
Loads the state of the agent from a previously saved state.
public ValueTask LoadStateAsync(JsonElement state)
Parameters
stateJsonElementA dictionary representing the state of the agent. Must be JSON serializable.
Returns
- ValueTask
A task representing the asynchronous operation.
SaveStateAsync()
Saves the state of the agent. The result must be JSON serializable.
public ValueTask<JsonElement> SaveStateAsync()
Returns
- ValueTask<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
messageobjectThe message to send to the agent.
senderAgentIdThe agent that is sending the message.
messageIdstringThe message ID. If
null, a new message ID will be generated. This message ID must be unique and is recommended to be a UUID.cancellationTokenCancellationTokenA token used to cancel an in-progress operation. Defaults to
null.