OpenBB

Retrieve stock prices, company profiles, price targets, and news with OpenBBTools and the OpenBB Platform.

OpenBBTools enable an Agent to provide information about stocks and companies.

Prerequisites

The following example requires the openbb and openai libraries.

uv pip install -U agno openbb openai

Example

cookbook/91_tools/openbb_tools.py
from agno.agent import Agent
from agno.tools.openbb import OpenBBTools

agent = Agent(
    tools=[
        OpenBBTools(
            enable_get_stock_price=True,
            enable_search_company_symbol=True,
            enable_get_company_news=False,
            enable_get_company_profile=False,
            enable_get_price_targets=False,
        )
    ],
    markdown=True,
)

agent.print_response(
    "Get the current stock price for Apple (AAPL)"
)

agent.print_response(
    "Search for the stock symbols of Microsoft and Alphabet"
)

agent.print_response(
    "Get the current stock prices for MSFT and GOOGL"
)

Toolkit Params

ParameterTypeDefaultDescription
obbAnyNoneOpenBB app instance. If not provided, uses default.
openbb_patstrNonePersonal Access Token for OpenBB API authentication. If not provided, uses OPENBB_PAT env var.
providerstr"yfinance"Data provider for financial information. Options: "benzinga", "fmp", "intrinio", "polygon", "tiingo", "tmx", "yfinance".
enable_get_stock_priceboolTrueEnable the stock price retrieval function.
enable_search_company_symbolboolFalseEnable the company symbol search function.
enable_get_company_newsboolFalseEnable the company news retrieval function.
enable_get_company_profileboolFalseEnable the company profile retrieval function.
enable_get_price_targetsboolFalseEnable the price targets retrieval function.
allboolFalseEnable all available functions. When True, all enable flags are ignored.

Toolkit Functions

FunctionDescription
get_stock_priceThis function gets the current stock price for a stock-symbol string (comma-separated symbols only where the selected provider supports them).
search_company_symbolThis function searches for the stock symbol of a company.
get_price_targetsThis function gets the price targets for a stock-symbol string (comma-separated symbols only where the selected provider supports them).
get_company_newsThis function gets the latest news for a stock-symbol string (comma-separated symbols only where the selected provider supports them).
get_company_profileThis function gets the company profile for a stock-symbol string (comma-separated symbols only where the selected provider supports them).

Provider configuration

Provider support and credentials vary by endpoint. OPENBB_PAT signs in to OpenBB; it does not replace an underlying provider's API key. Configure those keys through OpenBB settings.

The toolkit's provider value is forwarded for price, news, profile, and price-target requests. search_company_symbol uses OpenBB's default provider selection for equity search. Check that each chosen provider supports the requested operation.

Developer Resources