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

# 使用工具的代理

## 代码

```python cookbook/models/litellm/tool_use.py theme={null}
from agno.agent import Agent
from agno.models.litellm import LiteLLM
from agno.tools.yfinance import YFinanceTools

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

# 提出一个可能触发工具使用的问题
openai_agent.print_response("How is TSLA stock doing right now?")
```

## 用法

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

  <Step title="设置你的 API 密钥">
    ```bash theme={null}
    export LITELLM_API_KEY=xxx
    ```
  </Step>

  <Step title="安装库">
    ```bash theme={null}
    pip install -U litellm openai agno
    ```
  </Step>

  <Step title="运行代理">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/models/litellm/tool_use.py
      ```

      ```bash Windows theme={null}
      python cookbook/models/litellm/tool_use.py
      ```
    </CodeGroup>
  </Step>
</Steps>
