Introducing the Open Autonomy Client SDK
We are excited to announce the release of the Open Autonomy Client SDK. This new library simplifies the process of querying services built with the Open Autonomy framework, making it easier than ever to interact with autonomous services. In this blog post, we'll introduce the Open Autonomy Client SDK, discuss its benefits and provide a practical example of how it can be used to query a service, for example the Price Oracle autonomous service.
The Open Autonomy Client SDK is a library designed to streamline the process of querying autonomous services within the Autonolas ecosystem. By providing an abstracted approach to interacting with autonomous services, the SDK allows developers to easily request information from multiple agents using a single client. This powerful tool simplifies the complexities of working with autonomous services, making them more accessible to developers of varying levels.
It's crucial to query information from a set of agents, rather than relying on a single agent as a source. This is because individual agents could be out of sync, encounter errors, or experience other issues that compromise the integrity of the data, including being malicious. The Open Autonomy Client SDK plays a vital role in addressing this challenge and ensures a more robust response that takes into account the collective consensus of the multi-agent system.
To demonstrate the Open Autonomy Client SDK in action, let's take a look at the Price Oracle service, created using Autonolas by Valory. This service provides an estimation of the Bitcoin price (USD) based on observations coming from different data sources. Using the Open Autonomy Client SDK, we can easily query the agents involved in the Price Oracle service. Here's an example script:
The script can be examined step by step:
- The first step is to import the necessary libraries. The asyncio library is needed because the Client SDK queries the agents asynchronously to save time. The json library is not necessary, but helps format the data before printing them for this demo.
- The next step is to instantiate the open_autonomy_client SDK and the Client class that will be used to fetch data. These objects will be used later in the script to interact with the agents.
- A list is specified with the addresses and URLs of the agents to be queried. These parameters are the only ones that need to be changed in the script in order to run it for any service.
- An asynchronous function is defined to initialize the client with the specified constants and call the fetch() method on the instance. Using these two lines of code, the agents_data is received, which continues to print in a JSON format.
- The asyncio library is used to execute the defined asynchronous function. that we defined.
An example result after running the above script should look like the following:
More details about how the client can be used with the Price oracle autonomous service can be found in the OracleKit documentation.
The Open Autonomy Client SDK is a helpful tool that makes querying autonomous services within the Autonolas ecosystem easier and more efficient than ever before. If you're a developer interested in working with multi-agent systems, try out the Open Autonomy Client SDK today!
Sign up for updates