Executor API

The OpenAgents AI API provides comprehensive endpoints to manage blockchain transactions, user feedback, and analytics. It is built on Flask and Flask-SocketIO frameworks for real-time communication and supports Cross-Origin Resource Sharing (CORS) for enhanced accessibility across applications.


API Endpoints

WebSocket Events

  1. connect

    • Description: Triggered when a client establishes a connection with the server.

    • Response: Logs the session ID and a successful connection message.

  2. data

    • Description: Processes incoming client messages.

    • Parameters:

      • message (str): The client’s message.

      • walletAddress (str): The user's wallet address.

      • balances (dict): Current balances of the user.

    • Response: Initiates or continues a chat session, pushing messages to the corresponding chat.

  3. disconnect

    • Description: Triggered when a client disconnects from the server.

    • Response: Logs a disconnection message.

  4. submit

    • Description: Processes client-submitted transactions.

    • Parameters:

      • signature (str): Transaction signature.

      • walletAddress (str): User's wallet address.

      • transaction (dict): Transaction details.

    • Response: Verifies the signature and updates analytics.


HTTP Endpoints

  1. POST /<chat_id>/submit

    • Description: Submits a transaction tied to a specific chat session.

    • Parameters:

      • signature (str): Transaction signature.

      • wallet_address (str): User’s wallet address.

    • Response: Updates the transaction status and flags the chat as submitted.

  2. POST /feedback

    • Description: Allows users to submit feedback.

    • Parameters:

      • message (str): Feedback content.

    • Response: Stores the feedback in the database.

  3. GET /status

    • Description: Checks the service's operational status.

    • Response: Returns the current status of the API.

  4. GET /health

    • Description: Verifies the system’s health.

    • Response: Returns "OK" to indicate operational health.

  5. GET /balance

    • Description: Retrieves the user's wallet balance.

    • Parameters:

      • wallet_address (str): The user’s wallet address.

    • Response: Returns detailed wallet balances.

  6. GET /leaderboard

    • Description: Fetches leaderboard data for platform activity.

    • Parameters:

      • release (str, optional): Specifies the release type, defaulting to "global."

    • Response: Returns leaderboard rankings and metrics.

  7. GET /quote

    • Description: Provides transaction quotes based on specified parameters.

    • Parameters:

      • wallet_address (str): User’s wallet address.

      • transaction_type (str): Type of transaction (swap or bridge).

      • amount_in (str, optional): Input token amount (mutually exclusive with amount_out).

      • amount_out (str, optional): Expected output token amount.

      • token_in (str): Input token identifier.

      • token_out (str): Output token identifier.

      • from_chain (str): Source blockchain.

      • to_chain (str, optional): Destination blockchain for bridges.

    • Response: Returns a quote, status messages, and error details if any.


Agents and Chains

  1. GET /agents

    • Description: Lists all available AI agents.

    • Response: Returns agent names and descriptions.

  2. GET /chains

    • Description: Lists all supported blockchain networks.

    • Response: Provides the names of supported chains.

  3. GET /tokens

    • Description: Lists all available tokens across supported blockchains.

    • Response: Returns details of tokens categorized by blockchain.


Advanced Features

Knowledge Graphs for Transactions

The API employs a knowledge graph to map blockchain data, enhancing transaction routing by:

  • Efficiently identifying optimal paths.

  • Automating multi-chain operations.

  • Translating complex transaction steps into actionable queries.

Last updated