> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-service-account.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LiteLLM Tool Use

> Call YFinance tools from a LiteLLM agent with sync, streaming, and async runs.

```python tool_use.py theme={null}
"""
Litellm Tool Use
================

Cookbook example for `litellm/tool_use.py`.
"""

import asyncio

from agno.agent import Agent
from agno.models.litellm import LiteLLM
from agno.tools.yfinance import YFinanceTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

openai_agent = Agent(
    model=LiteLLM(
        id="gpt-4o",
        name="LiteLLM",
    ),
    markdown=True,
    tools=[YFinanceTools()],
)

# Ask a question that would likely trigger tool use

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    # --- Sync ---
    openai_agent.print_response("How is TSLA stock doing right now?")

    # --- Sync + Streaming ---
    openai_agent.print_response("Whats happening in France?", stream=True)

    # --- Async ---
    asyncio.run(openai_agent.aprint_response("What is happening in France?"))
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno litellm yfinance
    ```
  </Step>

  <Step title="Export your LiteLLM API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export LITELLM_API_KEY="your_litellm_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:LITELLM_API_KEY="your_litellm_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `tool_use.py`, then run:

    ```bash theme={null}
    python tool_use.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/litellm/tool\_use.py](https://github.com/agno-agi/agno/blob/main/cookbook/90_models/litellm/tool_use.py)
