AgentRuntime Class Documentation
Description: TheAgentRuntime 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:
Parameters:
-
inputs(List[AgentInput]):- Description: A list of
AgentInputobjects. These define the sources from which the agent receives messages. - Requirement: Each
AgentInputobject must implement thestartmethod, which pushes messages to a queue for processing.
- Description: A list of
-
outputs(List[AgentOutput]):- Description: A list of
AgentOutputobjects. These define the destinations to which the agent sends responses. - Requirement: Each
AgentOutputobject must implement thesendmethod, which delivers a response message to its destination.
- Description: A list of
-
agent(Agent):- Description: An
Agentobject that represents the core intelligence of the system. - Requirement: This object must implement the
executemethod, which processes a single request and generates a response.
- Description: An
-
pricing(Optional[Pricing], defaults toNone):- Description: An optional
Pricingobject that defines the cost of using the agent and the wallet address to which payments should be sent. - Default: If
None, no payment validation is performed.
- Description: An optional
-
debug(bool, defaults toFalse):- Description: A boolean indicating whether debug mode is enabled. In debug mode, additional logging information is printed.
-
enable_logs(bool, defaults toFalse):- Description: A boolean indicating whether logging is enabled. When enabled, logs are exported to the Galadriel platform.
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)
Initializes the AgentRuntime with input sources, output destinations, an agent implementation, pricing configuration, debug mode flag, and enable logs flag.
run(self)
Starts the agent runtime loop, continuously processing incoming requests.
_run_request(self, request: Message)
Processes a single request through the agent pipeline, handling payment validation, agent execution, and response delivery.
_get_memory(self) -> List[Dict[str, str]]
Retrieves the current state of the agent’s memory.
_generate_proof(self, request: Message, response: Message) -> str
Generates a cryptographic proof of the request and response.
_publish_proof(self, request: Message, response: Message, proof: str)
Publishes the cryptographic proof.
Data Types:
List[AgentInput]: A list of objects conforming to theAgentInputinterface.List[AgentOutput]: A list of objects conforming to theAgentOutputinterface.Agent: An object conforming to theAgentinterface.Optional[Pricing]: An optionalPricingobject 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 (TrueorFalse).Message: An object with the following attributes:content(str): The content of the message.conversation_id(Optional[str], defaults toNone): An optional conversation ID.type(Optional[str], defaults toNone): An optional message type.additional_kwargs(Optional[Dict], defaults toNone): An optional dictionary of additional keyword arguments.

