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

# Prompt management

In production, system prompts often need versioning and dynamic delivery. Prompt
management lets you template and hot-update the prompt at runtime without
changing code or restarting the service. Before handling each user request,
VeADK calls the prompt manager's `get_prompt` method to fetch the latest content
and uses it as the agent's system prompt.

## Using CozeLoop

VeADK ships `CozeloopPromptManager`, which connects the system prompt to
CozeLoop's cloud prompt management.

Install the CozeLoop Python SDK:

```bash lines theme={null}
pip install cozeloop
```

Provide credentials via environment variables rather than hardcoding them:

```bash lines theme={null}
export COZELOOP_WORKSPACE_ID="<your Workspace ID>"
export COZELOOP_TOKEN="<your CozeLoop token>"
```

Create the manager and pass it to the agent:

```python lines theme={null}
import os
from veadk import Agent
from veadk.prompts.prompt_manager import CozeloopPromptManager

prompt_manager = CozeloopPromptManager(
    cozeloop_workspace_id=os.environ["COZELOOP_WORKSPACE_ID"],
    cozeloop_token=os.environ["COZELOOP_TOKEN"],
    prompt_key="your_prompt_key",  # the Prompt Key created in CozeLoop
    label="production",            # the Prompt label created in CozeLoop
)

agent = Agent(name="assistant", prompt_manager=prompt_manager)
```

<Note>
  CozeLoop caches prompts locally with a one-minute refresh interval. If fetching
  fails, it falls back to VeADK's default system prompt.
</Note>

## Custom prompt manager

To load prompts from your own configuration service, database, or files,
subclass `BasePromptManager` and implement `get_prompt`. It is called before
handling each user request, and the returned string becomes the agent's system
prompt.
