AgentRuntime
class provides the runtime environment for executing agent workflows. It manages the lifecycle of agent execution, including input processing, payment validation, response generation, and output delivery.
Class Definition:
inputs
(List[AgentInput]):
AgentInput
objects. These define the sources from which the agent receives messages.AgentInput
object must implement the start
method, which pushes messages to a queue for processing.outputs
(List[AgentOutput]):
AgentOutput
objects. These define the destinations to which the agent sends responses.AgentOutput
object must implement the send
method, which delivers a response message to its destination.agent
(Agent):
Agent
object that represents the core intelligence of the system.execute
method, which processes a single request and generates a response.pricing
(Optional[Pricing], defaults to None
):
Pricing
object that defines the cost of using the agent and the wallet address to which payments should be sent.None
, no payment validation is performed.debug
(bool, defaults to False
):
enable_logs
(bool, defaults to False
):
inputs
(List[AgentInput]): Stores the input sources for the agent.outputs
(List[AgentOutput]): Stores the output destinations for responses.agent
(Agent): Stores the agent implementation being used.pricing
(Optional[Pricing]): Stores the payment configuration, if required.spent_payments
(Set[str]): A set to keep track of already processed transaction signatures to prevent duplicate processing.debug
(bool): Flag to enable debug mode for more verbose logging.enable_logs
(bool): Flag to enable log exporting.__init__(self, inputs: List[AgentInput], outputs: List[AgentOutput], agent: Agent, pricing: Optional[Pricing] = None, debug: bool = False, enable_logs: bool = False)
AgentRuntime
with input sources, output destinations, an agent implementation, pricing configuration, debug mode flag, and enable logs flag.
run(self)
_run_request(self, request: Message)
_get_memory(self) -> List[Dict[str, str]]
_generate_proof(self, request: Message, response: Message) -> str
_publish_proof(self, request: Message, response: Message, proof: str)
List[AgentInput]
: A list of objects conforming to the AgentInput
interface.List[AgentOutput]
: A list of objects conforming to the AgentOutput
interface.Agent
: An object conforming to the Agent
interface.Optional[Pricing]
: An optional Pricing
object with the following attributes:
cost
(float): The cost of the task in SOL.wallet_address
(str): The Solana wallet address where payment should be sent.bool
: A boolean value (True
or False
).Message
: An object with the following attributes:
content
(str): The content of the message.conversation_id
(Optional[str], defaults to None
): An optional conversation ID.type
(Optional[str], defaults to None
): An optional message type.additional_kwargs
(Optional[Dict], defaults to None
): An optional dictionary of additional keyword arguments.