This example demonstrates tool usage with LangDB AI Gateway. For detailed integration instructions, see the LangDB Agno documentation.

Code

cookbook/models/langdb/finance_agent.py
from agno.agent import Agent
from agno.models.langdb import LangDB
from agno.tools.yfinance import YFinanceTools

agent = Agent(
    model=LangDB(id="gpt-4o-mini"),
    tools=[
        YFinanceTools(
            stock_price=True, analyst_recommendations=True, stock_fundamentals=True
        )
    ],
    show_tool_calls=True,
    description="You are an investment analyst that researches stocks and helps users make informed decisions.",
    instructions=["Use tables to display data where possible."],
    markdown=True,
)

# agent.print_response("Share the NVDA stock price and analyst recommendations", stream=True)
agent.print_response("Summarize fundamentals for TSLA", stream=True)

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
python3 -m venv .venv
source .venv/bin/activate
2

Set your API key

export LANGDB_API_KEY=xxx
export LANGDB_PROJECT_ID=xxx
3

Install libraries

pip install -U yfinance agno
4

Run Agent

python cookbook/models/langdb/finance_agent.py