Skip to main content
FinanceTools provide one finance toolkit with swappable data providers: the same eleven tool names, parameters, and JSON response shape, whatever supplies the data. The default provider is Yahoo Finance (via the yfinance package); financialdatasets.ai is built in, and custom providers can be registered. Agent code does not change when the data source does. Agno ships three finance toolkits, coexisting by design. FinanceTools fixes the tool names while the provider is swappable; YFinanceTools and FinancialDatasetsTools each expose one data source directly, with their own tool names. The older two are not deprecated.

Prerequisites

The default provider needs the yfinance package; the example also uses openai:
The financialdatasets.ai provider needs no extra package — it uses httpx, an Agno core dependency — but requires an API key:

Example

cookbook/91_tools/finance/01_market_brief.py

Provider Selection

provider accepts a FinanceProvider instance, a registered provider id ("yfinance", "financial_datasets", or one you added with register_provider), or None. With None (the default), FinanceTools uses Yahoo Finance if the yfinance package is importable, otherwise financialdatasets.ai if FINANCIAL_DATASETS_API_KEY is set, and otherwise raises an ImportError at construction telling you to install yfinance or set the key. An unknown id raises a ValueError listing the registered providers. Each provider declares the tools it serves, and FinanceTools registers only those:
  • Yahoo Finance ("yfinance") serves all eleven tools. No API key is needed.
  • Financial Datasets ("financial_datasets") serves nine — it has no search_symbols or get_analyst_recommendations, and the agent never sees them. Requests carry the FINANCIAL_DATASETS_API_KEY as an X-API-KEY header; see financialdatasets.ai for plans and rate limits.
To add a provider, subclass FinanceProvider, declare its capabilities, and call register_provider — the custom provider cookbook shows the shape. At call time, provider failures are returned to the agent as JSON {"error": ...} envelopes, never raised.

Toolkit Params

Toolkit Functions

Every tool returns JSON carrying a provider field, and each has an async variant registered under the same name, used automatically with arun and aprint_response. Invalid arguments are returned as JSON errors before any provider call.

Developer Resources