> ## 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.

# DeepSeek Reasoner

## Code

```python cookbook/reasoning/models/deepseek/trolley_problem.py theme={null}
from agno.agent import Agent
from agno.models.deepseek import DeepSeek
from agno.models.openai import OpenAIChat

task = (
    "你是一位哲学家，负责分析经典的“电车难题”。在这个场景中，一辆失控的电车正沿着轨道冲向被绑住且无法动弹的五个人。你站在天桥上，站在一个陌生人旁边。拯救这五个人唯一的方法是把这个陌生人推下桥到下面的轨道上。这会杀死陌生人，但能拯救轨道上的五个人。为了拯救这五个人，你应该推这个陌生人吗？请提供一个考虑了功利主义、义务论和美德伦理框架的、理由充分的回答。包含一个简单的ASCII艺术图来描绘这个场景。"
)

reasoning_agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    reasoning_model=DeepSeek(id="deepseek-reasoner"),
    markdown=True,
)
reasoning_agent.print_response(task, stream=True)

```

## Usage

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

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

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

  <Step title="运行 Agent">
    <CodeGroup>
      ```bash Mac theme={null}
      python cookbook/reasoning/models/deepseek/trolley_problem.py
      ```

      ```bash Windows theme={null}
      python cookbook/reasoning/models/deepseek/trolley_problem.py
      ```
    </CodeGroup>
  </Step>
</Steps>
