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

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

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

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

  <Step title="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
    ```
  </Step>

  <Step title="Set your API key">
    ```bash theme={null}
    export VLLM_API_KEY=xxx
    ```
  </Step>

  <Step title="Save the example">
    Save the code above as `vllm_code_generation.py`.
  </Step>

  <Step title="Run Agent">
    ```bash theme={null}
    python vllm_code_generation.py
    ```
  </Step>
</Steps>
