Use Allora
The Use Allora
tool, part of AgentiPy, allows users to interact with the Allora Network, a decentralized AI network. It enables fetching AI-generated price predictions for crypto assets (BTC, ETH) and retrieving information about inference topics. This tool uses the allora-sdk
and requires an Allora API key to be configured in the SolanaAgentKit
.
Functionality
This tool is implemented in the AlloraManager
class.
Key Methods:
__init__(self, agent: SolanaAgentKit, base_api_url: Optional[str] = "https://api.upshot.xyz/v2", chain: ChainSlug = ChainSlug.TESTNET)
:Initializes the
AlloraAPIClient
from theallora-sdk
using theallora_api_key
from theagent
and specifies the targetchain
(Testnet or Mainnet).
get_price_prediction(self, asset: PriceInferenceToken, timeframe: PriceInferenceTimeframe, signature_format: SignatureFormat = SignatureFormat.ETHEREUM_SEPOLIA)
:Fetches a future price prediction for a given
asset
(e.g.,PriceInferenceToken.BTC
) andtimeframe
(e.g.,PriceInferenceTimeframe.FIVE_MIN
).Returns a dictionary with
price_prediction
,confidence_interval
, andstatus
.
get_all_topics(self)
:Fetches all available inference topics from the Allora Network.
Returns a dictionary containing a list of
AlloraTopic
objects.
get_inference_by_topic_id(self, topic_id: int)
:Fetches inference data (prediction and confidence) for a specific
topic_id
.Returns a dictionary with
inference_data
andconfidence_interval
.
Note: This tool requires an API key from Allora. The SolanaAgentKit
is used to pass this API key (agent.allora_api_key
) to the AlloraManager
. Ensure the API key is correctly set in your environment or agent configuration.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_allora.py
Last updated