System prompts define what your agent knows and how it behaves. AFK supports three methods — inline strings, instruction files, and auto-detection — with Jinja2 templating for dynamic values.Documentation Index
Fetch the complete documentation index at: https://afk.arpan.sh/llms.txt
Use this file to discover all available pages before exploring further.
Three ways to set instructions
- Inline string
- Instruction file
- Auto-detection
Set instructions directly on the Agent. Best for simple, static prompts.
Precedence chain
When multiple sources are available, AFK uses this order: The first non-empty source wins. If you set bothinstructions and instruction_file, the inline string takes priority.
Template variables with Jinja2
Use{{ variable }} syntax to inject dynamic values into prompts:
Available template variables
| Source | Variables | Example |
|---|---|---|
Agent.context dict | Any key-value pairs you set | {{ company_name }}, {{ user_role }} |
| Built-in | agent_name, model_name | {{ agent_name }} |
| Runtime | run_id, thread_id (if available) | {{ thread_id }} |
Prompt from file with templates
Templates work in instruction files too:prompts/reviewer.md
Error handling
| Error | Cause | Resolution |
|---|---|---|
PromptResolutionError | instruction_file path doesn’t exist | Check that the file exists under the configured prompts_dir. |
PromptTemplateError | Jinja2 template syntax error | Check for unclosed {{ }} or {% %} blocks. |
PromptTemplateError | Missing template variable | Add the variable to Agent.context or provide a default: {{ var | default("fallback") }} |
Design guidelines
- Inline for prototyping, files for production. Switch to instruction files when your prompt exceeds ~5 lines.
- Use templates for anything dynamic. Don’t concatenate strings — use
{{ variable }}and set values incontext. - Be specific in instructions. Tell the agent what to do and what not to do. Include output format expectations.
- Test prompt changes with evals. A small prompt change can dramatically shift behavior. Run your eval suite after any edit.
Next steps
Agent Skills
Reusable knowledge bundles loaded on demand.
Evals
Test prompt changes with behavioral assertions.