# 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>


---

# 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-stork.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.
