# 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 the `allora-sdk` using the `allora_api_key` from the `agent` and specifies the target `chain` (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`) and `timeframe` (e.g., `PriceInferenceTimeframe.FIVE_MIN`).
  * Returns a dictionary with `price_prediction`, `confidence_interval`, and `status`.
* `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` and `confidence_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>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/tools/use-allora.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
