# Capture Reasoning Content (/reasoning/usage/agents/capture-reasoning-content-cot)



Capture explicit `ReasoningTools` notes or provider-exposed content from a supported native `reasoning_model`. These fields can be empty; instructions and display flags do not guarantee that a tool is called or a summary is returned.

<Steps>
  <Step title="Add the following code to your Python file">
    ```python title="capture_reasoning_content_default_cot.py"
    from agno.agent import Agent
    from agno.models.openai import OpenAIChat, OpenAIResponses
    from agno.run.agent import RunCompletedEvent
    from agno.tools.reasoning import ReasoningTools

    def make_agent(separate_stage: bool) -> Agent:
        if separate_stage:
            return Agent(
                model=OpenAIChat(id="gpt-4.1"),
                reasoning_model=OpenAIResponses(
                    id="gpt-5.2", reasoning_effort="medium", reasoning_summary="auto"
                ),
            )
        return Agent(
            model=OpenAIChat(id="gpt-4.1"),
            tools=[ReasoningTools(add_instructions=True)],
        )

    for separate_stage in (False, True):
        response = make_agent(separate_stage).run("Compute the sum of integers 1 through 10.")
        print(response.reasoning_content or "No reasoning content was returned")

        completed = None
        for event in make_agent(separate_stage).run(
            "Compute 5 factorial.", stream=True, stream_events=True
        ):
            if isinstance(event, RunCompletedEvent):
                completed = event
        if completed is not None:
            print(completed.reasoning_content or "No reasoning content was returned")
        else:
            print("The stream ended without a completion event")
    ```
  </Step>

    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Install dependencies">
    ```bash
    uv pip install -U openai agno
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeBlockTabs defaultValue="Mac/Linux">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Mac/Linux">
          Mac/Linux
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Windows">
          Windows
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Mac/Linux">
        ```bash
          export OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Windows">
        ```bash
          $Env:OPENAI_API_KEY="your_openai_api_key_here"
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </Step>

  <Step title="Run Agent">
    ```bash
    python capture_reasoning_content_default_cot.py
    ```
  </Step>
</Steps>
