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

# Code Generation

> Generate Python code with a vLLM agent running a code model.

## Code

```python vllm_code_generation.py theme={null}
from agno.agent import Agent
from agno.models.vllm import VLLM

agent = Agent(
    model=VLLM(id="deepseek-ai/deepseek-coder-6.7b-instruct"),
    description="You are an expert Python developer.",
    markdown=True,
)

agent.print_response(
    "Write a Python function that returns the nth Fibonacci number using dynamic programming."
)
```

## Usage

> [!NOTE]
>
> vLLM installation depends on your operating system and accelerator. Check the [official installation guide](https://docs.vllm.ai/en/latest/getting_started/installation/) for supported NVIDIA CUDA, AMD ROCm, Intel XPU, CPU, and Apple Silicon configurations.

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

**1. Install dependencies**

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

**2. Start the vLLM server in a separate terminal**

```bash theme={null}
source .venv/bin/activate
vllm serve deepseek-ai/deepseek-coder-6.7b-instruct \
    --dtype float32 \
    --tool-call-parser pythonic
```

**3. Set your API key**

```bash theme={null}
export VLLM_API_KEY=xxx
```

**4. Save the example**

Save the code above as `vllm_code_generation.py`.

**5. Run Agent**

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


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