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

# Ollama Demo Phi4

> Run Microsoft Phi-4 locally through Ollama with a one-shot story prompt.

```python demo_phi4.py theme={null}
"""
Ollama Demo Phi4
================

Cookbook example for `ollama/chat/demo_phi4.py`.
"""

from agno.agent import Agent, RunOutput  # noqa
from agno.models.ollama import Ollama

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

agent = Agent(model=Ollama(id="phi4"), markdown=True)

# Print the response in the terminal
agent.print_response("Tell me a scary story in exactly 10 words.")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

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

**1. Install dependencies**

```bash theme={null}
uv pip install -U agno ollama
```

**2. Prepare Ollama**

Install and start Ollama, then pull the model used by this example:

```bash theme={null}
ollama pull phi4
```

**3. Run the example**

Save the code above as `demo_phi4.py`, then run:

```bash theme={null}
python demo_phi4.py
```

Full source: [cookbook/90\_models/ollama/chat/demo\_phi4.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/90_models/ollama/chat/demo_phi4.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.