Olas SDK
Bring your agent to the Olas Protocol
Agents built with any framework can now be brought to the Olas Protocol in just a few steps.
This allows you to:
- Monetize your agent by earning Dev Rewards.
- Start your agent with all of the wallet abstraction necessary to make on-chain transactions.
The Olas SDK is a set of tools and instructions that allows engineers to register autonomous agents built with any framework on the Olas Protocol web app. Once registered you can start your agent using Olas Agent Quickstart.
Step 1: Build Olas Agent Configuration
Check the guide at Olas SDK Starter.
Step 2: Publish it
Once the Olas Agent configuration is complete, the next step is to push the Docker image to Docker Hub. The image needs to follow the requirements below:
Docker Image Requirements
- ENTRYPOINT: A script file should be used to start the agent execution.
- HEALTHCHECK: A health check must be defined; otherwise, the agent will not be executed through Olas Agent Quickstart.
You can find a docker file example here.
-
Image Name: The image name must be:
-<author_name>/oar-<agent_name>:<agent_package_hash>
author_name
andagent_name
: These must match the names defined at Step 2 in the Olas agent and service configuration.agent_package_hash
: The hash generated when the Olas agent package was pushed to IPFS. This can be found inpackages/packages.json
from Step 1.
Step 3: Mint it
To register the agent in the Olas Protocol web app, follow the steps in this guide: Mint an Agent.
Note 1: Your Olas Agent must provide at least one dependency, as default specify the value 1.
Note 2: The agent hash can be found in packages/packages.json
from Step 1.
Step 4: Execute it
To run the agent using Olas Agent Quickstart, follow these steps:
1. Clone the Olas Agent Quickstart repository:
git clone https://github.com/valory-xyz/quickstart
2. Add a config.json
file to the configs
folder with the following fields:
agent_name
: The name of your Olas Agent defined on Step 1.agent_id
: The id of your agent minted on Olas Protocol web app, this is number you see on your agent page from Step 4.service_hash
: The hash of your Olas Service generated on Step 1.env_variables
: Here you can define the environment variables that your agent needs, the names must follow what was configured on the fileservice.yaml
on Step 1. The provision type of these variables can be:- user: It will prompt the user running your agent to provide a value.
- fixed: It will use the value defined on the configuration file.
- computed: It will be automatically computed.
Example of config_hello_world.json
{
"name": "<agent_name>",
"hash": "<service_hash>",
"description": "My awesome agent service",
"image": "",
"service_version": "v0.1.0",
"home_chain": "gnosis",
"configurations": {
"gnosis": {
"agent_id": <agent_id>,
"nft": "bafybeifgj3kackzfoq4fxjiuousm6epgwx7jbc3n2gjwzjgvtbbz7fc3su",
"threshold": 1,
"use_mech_marketplace": false,
"fund_requirements": {
"0x0000000000000000000000000000000000000000": {
"agent": 0,
"safe": 0
}
}
}
},
"env_variables": {
"SAFE_CONTRACT_ADDRESSES": {
"name": "Safe contract addresses",
"description": "",
"value": "",
"provision_type": "computed"
},
"GNOSIS_LEDGER_RPC": {
"name": "Gnosis ledger RPC",
"description": "",
"value": "",
"provision_type": "computed"
},
"<ENV_VAR_NAME_1>": {
"name": "<ENV_VAR_NAME_1>",
"description": "",
"value": "",
"provision_type": "user"
},
"<ENV_VAR_NAME_2>": {
"name": "<ENV_VAR_NAME_2>",
"description": "",
"value": "",
"provision_type": "user"
}
}
}
3. Once all the Olas Agent Quickstart repo requirements are met, start the service by running:
./run_service.sh <agent_config.json>
This script will
- Prompts for the Gnosis RPC and required environment variables.
- Sets up the service safe and agent wallet (asking for required funds).
- Mints the service in the registry until it reaches the DEPLOYED
state.
- Downloads the agent's docker image.
- Setup and starts the docker container.
Consideration for building your agent
The agent can be built using any framework and it will be made available on Olas Agent Quickstart through a docker image. The Olas Agent Quickstart allows your user to easily start the agent by providing the values you set up as environment variables.
- Environment variables will be set up in a docker container when the service starts through Olas Agent Quickstart with the prefix
CONNECTION_CONFIGS_CONFIG_<variable_name>
. - Olas Agent Quickstart will deploy a service from a given agent and configure the service multisig Safe and the agent EOA. These information will be available in the docker container as follows:
- The agent EOA private key will be on the file
/agent_key/ethereum_private_key.txt
. - The service safe contract address will be accessible through the environment variable
CONNECTION_CONFIGS_CONFIG_SAFE_CONTRACT_ADDRESSES
as a dictionary with the chain as the key (e.g.,{ "gnosis": "0xE7CA89bE11A7A3b3d0bF6016d7a09f33c03a0a8f" }
).
- The agent EOA private key will be on the file
Agent examples
Here you can see the examples of two agents built with different frameworks: