> ## 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/reasoning/agents/analyse_treaty_of_versailles.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIChat

task = (
    "分析导致 1919 年签署《凡尔赛条约》的关键因素。 "
    "讨论该条约对德国的政治、经济和社会影响，以及它如何促成了第二次世界大战的爆发。 "
    "提供包含多种历史观点的细致评估。"
)

reasoning_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    reasoning=True,
    markdown=True,
)
reasoning_agent.print_response(task, stream=True, show_full_reasoning=True)
```

## 用法

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

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

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

  <Step title="运行示例">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/reasoning/agents/analyse_treaty_of_versailles.py
      ```

      ```bash Windows theme={null}
      python cookbook/reasoning/agents/analyse_treaty_of_versailles.py
      ```
    </CodeGroup>
  </Step>
</Steps>
