Agent.prompt_manager replaces instruction. Fetch timing follows the runtime’s instruction resolution, so do not assume exactly one call per user request
Complete model configuration before running these examples
Use Cozeloop
Create and publish a prompt in Cozeloop, assign theproduction label to the intended version, and obtain a workspace ID and Token with read access. The manager reads only the first message in the prompt template, so place the complete system instructions in that message
Install the SDK and set credentials in the terminal that will run the script:
managed_prompt.py
python managed_prompt.py to generate a response with the selected prompt. A distinctive response format in the template can help verify that it is being used
Constructor parameters
Set
version to select a fixed release, or label to follow a label. Caching and refresh intervals depend on the installed Cozeloop SDK; label changes are not guaranteed to take effect immediately
Failures and template limitations
- An empty prompt, message list, or first message causes the manager to return VeADK’s default prompt and log a warning
- Network, authentication, and SDK exceptions are not universally converted to a default prompt; the application must handle them
- The manager neither combines multiple messages nor automatically renders Cozeloop template variables
- An explicitly supplied
Agent.instructionis not a fallback for this manager
Create a custom prompt manager
SubclassBasePromptManager and implement get_prompt(context, **kwargs). This example reads system-prompt.txt beside the script each time instructions are requested. File changes affect the next read; a missing or empty file fails explicitly
Create the prompt file beside the script:
system-prompt.txt
file_prompt.py
python file_prompt.py to generate a response using the file. See system prompts for readable context fields. Database and configuration-service integrations must define their own timeouts, caching, version selection, failure behavior, and template rendering