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

# Sofya Tools

> Demonstrates Sofya tools: web search, URL extraction, and deep research.

```python sofya_tools.py theme={null}
"""
Sofya Tools
=============================

Demonstrates Sofya tools: web search, URL extraction, and deep research.

Set SOFYA_API_KEY in your environment. Get a key at https://sofya.co
"""

from agno.agent import Agent
from agno.tools.sofya import SofyaTools

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

# Example 1: default SofyaTools (web search)
agent = Agent(tools=[SofyaTools()])

# Example 2: enable all Sofya tools (search + extract + research)
agent_all = Agent(tools=[SofyaTools(all=True)])

# Example 3: extraction only, fetch URLs as clean markdown
extract_agent = Agent(
    tools=[
        SofyaTools(
            enable_search=False,
            enable_extract=True,
        )
    ]
)

# Example 4: deep research only, returns a cited report
research_agent = Agent(
    tools=[
        SofyaTools(
            enable_search=False,
            enable_research=True,
        )
    ]
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response(
        "Search for recent developments in the Model Context Protocol",
        markdown=True,
        stream=True,
    )

    extract_agent.print_response(
        "Extract the main content from https://modelcontextprotocol.io/introduction",
        markdown=True,
        stream=True,
    )

    research_agent.print_response(
        "Write a short report on how AI agents use web search tools",
        markdown=True,
        stream=True,
    )
```

## Run the Example

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

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

  <Step title="Export your API keys">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export SOFYA_API_KEY="your_sofya_api_key_here"
      ```

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

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

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

Full source: [cookbook/91\_tools/sofya\_tools.py](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/sofya_tools.py)
