> For the complete documentation index, see [llms.txt](https://docs.agentipy.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentipy.fun/tools/use-stork.md).

# Use Stork

The `Use Stork` tool, part of AgentiPy, allows users to fetch real-time asset price data from the Stork Oracle. Stork provides oracle services for various assets, and this tool enables retrieving the current price and timestamp for a given asset ID.

## Functionality

This tool is implemented in the `StorkManager` class. It uses a helper function `get_stork_price` (from `agentipy.utils.stork.utils`) which likely makes a direct HTTP request to a Stork API endpoint. This tool requires a Stork API key.

### Key Methods:

* `get_price(agent: SolanaAgentKit, asset_id: str)`:
  * (Static async method) Fetches the price data for a specified `asset_id` (e.g., "SOL/USD").
  * The `agent` instance is used to provide the `stork_api_key` (`agent.stork_api_key`).
  * The underlying `get_stork_price` utility constructs the API request to Stork, including the API key.
  * Parses the response to extract the price (converted to float and adjusted by 10^18, common for oracle fixed-point numbers) and the timestamp of the price update.
  * Returns a dictionary containing `price` and `timestamp`.
  * Raises an exception if the API call fails, data is not found, or the response is malformed.

##

**Important Considerations:**

* **API Key Required:** A valid Stork API key must be provided via `agent.stork_api_key`.
* **Direct API Interaction:** This tool interacts directly with the Stork oracle API. It does not use the Agentipy proxy service.
* **Asset IDs:** You need to use the correct `asset_id` string as defined by Stork for the price feed you want to query.
* **Price Precision:** The price is returned as a float, adjusted by 10^18. This is a common practice for oracles to handle fixed-point arithmetic.
* **Data Reliability:** Oracle data is subject to its own update mechanisms and potential (though rare) inaccuracies or delays.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_stork.py>
