Use Switchboard

The Use Switchboard tool, part of AgentiPy, provides functionalities for interacting with the Switchboard oracle network on Solana. The current implementation focuses on simulating a Switchboard data feed, which can be useful for testing or development purposes. This operation is routed through an Agentipy proxy service.

Functionality

This tool is implemented in the SwitchboardManager class. It interacts with an Agentipy proxy service (agent.base_proxy_url) to perform actions related to Switchboard. The agent's private key is encrypted and sent to this proxy, and an OpenAI API key (agent.openai_api_key) also seems to be part of the payload.

Key Methods:

  • simulate_switchboard_feed(agent: SolanaAgentKit, feed: str, crossbar_url: Optional[str] = None) -> Optional[Dict[str, Any]]:

    • Simulates a Switchboard data feed (likely the public key of a feed account).

    • Parameters:

      • agent: The SolanaAgentKit instance.

      • feed: The feed address (string) to be simulated.

      • crossbar_url (Optional): The crossbar URL for Switchboard. If not provided, the proxy service might use a default.

    • Sends a request to the Agentipy proxy endpoint (/switchboard/simulate-switchboard-feed).

    • Returns a dictionary with the simulation result from the proxy or an error.

Important Considerations:

  • Proxy Service: This tool relies on an Agentipy proxy service. The functionality is dependent on this proxy's implementation of Switchboard feed simulation.

  • Simulation vs. On-Chain: This method simulates a feed. It does not directly interact with or alter live Switchboard oracle data on-chain but rather provides a way to test or get hypothetical values based on the simulation logic implemented in the proxy.

  • API Keys: An openai_api_key is passed to the proxy; its role in the simulation process should be understood from the proxy's documentation. The agent's Solana private key is also encrypted and sent.

Source Code

You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_switchboard.py

Last updated