Overview
Artaios’sPromptConfig provides sophisticated prompt engineering capabilities through dynamic context control, few-shot examples, and intelligent history management. This enables precise control over what information reaches your LLM.
Core Concepts
Message Ordering
Artaios constructs prompts in an optimal order for LLM attention:1
System Prompt
Highest attention - Behavioral instructions and role definition
2
Few-Shot Examples
Teaching patterns - Static examples showing desired behavior
3
Conversation History
Dynamic context - Previous messages (configurable)
4
Current User Input
Highest attention - The current task or question
This ordering leverages the primacy and recency effects in LLM attention, placing the most important information at the beginning and end.
PromptConfig Schema
Template Variables
Artaios supports dynamic template variables in yoursystem_prompt using {{ variable }} syntax. Variables are substituted recursively before the prompt is sent to the LLM, enabling powerful dynamic context injection.
Variable Categories
Custom Variables
Dynamic values from the variables system:
{{ variables.name }}Prompt Library
Access stored prompts from database:
{{ prompts.name }}User Input
Current user message content:
{{ user_input }}Conversation History
User-visible message history:
{{ history }} / {{ history[N] }}Full Execution History
Complete trace with internal messages:
{{ full_history }}Structured Outputs
Data from previous agents:
{{ agent.output.field }}Agent Outputs
Non-structured agent responses:
{{ agent.output }}1. Prompt Library Variables
Access reusable prompts stored in the database with automatic user/company scoping.
Example:
Variables in Prompt Library: You can use template variables inside prompt library prompts! For example, a stored prompt can contain Usage:This enables powerful prompt composition and reusability!
{{ user_input }}, {{ history }}, or even other {{ prompts.* }} references. The system resolves them recursively (up to 10 iterations).Example Prompt Library Entry:2. User Input Variable
Access the current user’s message content.
Example:
3. Conversation History Variables
Access formatted conversation history (user-visible messages only, excludes internal tool calls).
Example:
History vs include_history: You can use
{{ history }} template variable for formatted history in your system prompt, or use include_history: true to add messages to the message list. They serve different purposes.4. Full Execution History Variables
Access complete execution trace including internal messages, tool calls, and tool results.
Example:
5. Structured Output Variables
Access structured data from previous agents in multi-agent workflows.Structured outputs are stored internally under the key
"agent_name.output". There is no output_name field — the key is always agent_name.output.6. Agent Output Variables
Access the last message from a specific agent (non-structured output).
Example:
7. Custom Variables
Access variables defined in the system’svariables section. These are populated from user inputs, agent variable_assignments, or defaults.
Example:
Variables are the bridge between structured output and prompt substitution. Use
variable_assignments on agents to populate variables from structured output, then reference them with {{ variables.name }} in downstream agents. See Variables System for details.Recursive Variable Substitution
Variables are substituted recursively up to 10 iterations, allowing nested variable references. Example:Nested Variables: You can reference prompts that contain other variables. The system will resolve them recursively until no more variables remain.
Variable Substitution Timing
Variables are substituted before building provider messages:- Template Resolution:
{{ variables }}→ actual values - Message Building: System prompt + examples + history + user input
- LLM Call: Final messages sent to provider
Complete Variable Example
System Prompt
The system prompt defines your agent’s behavior, role, and capabilities.Basic Example
Advanced System Prompt
Few-Shot Examples
Few-shot examples teach your agent desired behavior through concrete examples.Basic Few-Shot Configuration
Complex Few-Shot Examples
-
input: |
def process_data(data):
return [x * 2 for x in data if x > 0]
output: |
Code Quality: Good
Strengths:
- Concise list comprehension
- Clear filtering logic
- Add type hints:
def process_data(data: list[int]) -> list[int]: - Add docstring explaining the transformation
Exclude All History
Sliding Window (Last N Messages)
History Management Examples
User Input Control
Control whether the current user message is included in the prompt.Include User Input (Default)
Exclude User Input
- Conversation summarization
- Automatic analysis without user prompt
- Background processing tasks
When
include_user_input: false, the agent processes only the conversation history without the latest user message. This is useful for automated tasks triggered by system events.Internal Message Control
Control whether outputs from internal agents (those withstreaming_config.show_output_to_user: false) are included in the conversation history sent to the LLM.
Include Internal Messages (Default)
Exclude Internal Messages
show_output_to_user: true and user messages appear in history. Internal agent outputs are filtered out.
Use Case: Customer-facing agents that should only see the user conversation, not background processing.
Internal messages are outputs from agents with
streaming_config.show_output_to_user: false. These agents run in the background without emitting text to the end user.Media Handling
Control how images, PDFs, and other media are handled in conversation history.Strip Media from History
- Historical messages: Text only, media stripped
- Current user input: Media always included
- Reduce token costs (images are expensive)
- Focus on text-based context
- Process only the latest image
Include Media in History
- Visual conversation continuity
- Comparing multiple images
- Document series analysis
Advanced Patterns
Critical: Tool Execution Results (ReAct Agents)
When a ReAct agent executes tools, the results are tagged with the currentrun_id. These messages bypass all filtering to ensure the agent can see:
- Tool call requests
- Tool execution results
- Error messages from failed tools
- Without tool results, ReAct agents can’t complete their reasoning loop
- Tool results must be visible even if history is limited
- This is automatic - no configuration needed
Context-Aware Routing
Multi-Stage Processing
Summarization Pipeline
Validation & Best Practices
Automatic Validation
Artaios automatically validates your prompt configuration:Empty Configuration Warning
Empty Configuration Warning
Warning: All components disabled (no system prompt, no examples, no history, no user input)Fix: Enable at least one component
History Without User Input
History Without User Input
Warning: History enabled but user input disabledBehavior: Only conversation history sent to LLM, not current questionUse Case: Intentional for summarization/analysis
User Input Without History
User Input Without History
Info: User input enabled but history disabledBehavior: Only current question sent (stateless)Use Case: Classification, single-turn tasks
Few-Shot Format Validation
Few-Shot Format Validation
Error: Missing ‘input’ or ‘output’ in examplesFix: Ensure each example has both fields
Best Practices
System Prompt Design
- Be specific about role and capabilities
- Include output format requirements
- Add constraints and guidelines
- Use structured formatting (Markdown)
Few-Shot Examples
- Use 2-5 high-quality examples
- Cover diverse scenarios
- Show ideal output format
- Keep examples concise
History Management
- Use sliding windows for long conversations
- Disable for stateless operations
- Monitor token usage
- Consider media costs
Token Optimization
- Strip unnecessary media
- Limit history length
- Use concise system prompts
- Optimize few-shot examples
Complete Example
Troubleshooting
Empty Prompt Warning
Empty Prompt Warning
Issue: “PromptConfig has no content”Cause: All components disabled or emptySolution: Enable at least one component (system_prompt, examples, history, or user_input)
Few-Shot Validation Error
Few-Shot Validation Error
Issue: “Example missing ‘input’ or ‘output’ field”Cause: Incorrect example formatSolution: Ensure each example has both
input and output keysToken Limit Exceeded
Token Limit Exceeded
Issue: “Context too long” or token limit errorsCause: Too much history or large media filesSolution:
- Reduce
include_historyto smaller number - Set
include_media_in_history: false - Shorten system prompt
- Use fewer few-shot examples
Unexpected Behavior
Unexpected Behavior
Issue: Agent not following instructionsCause: Conflicting configuration or unclear promptsSolution:
- Make system prompt more specific
- Add relevant few-shot examples
- Check if history is interfering
- Test with
include_history: falsefirst
Performance Tips
1
Start Simple
Begin with basic system prompt and no examples. Add complexity only when needed.
2
Measure Token Usage
Monitor token consumption and optimize based on actual usage patterns.
3
Test Incrementally
Add few-shot examples one at a time and measure impact on quality.
4
Optimize History
Find the minimum history length that maintains quality.
5
Profile Costs
Track costs per agent and optimize expensive ones first.
Quick Reference
Template Variables Cheat Sheet
PromptConfig Settings
Message Ordering
Final prompt structure sent to LLM:- System Message - Behavioral instructions (highest attention)
- Few-Shot Examples - Teaching patterns (static)
- Separator - Optional section marker
- Conversation History - Previous messages (filtered)
- Run-ID Messages - Tool results (ALWAYS included)
- Current User Input - Latest message (highest attention)
Common Patterns
- Stateless Agent
- Conversational Agent
- Multi-Agent Workflow
- Summarization
Variable Substitution Flow
Troubleshooting Quick Fixes
Next Steps
Model Selection
Choose the right models for your use case
Structured Output
Generate structured data with schemas
Agent Capabilities
Explore tools, streaming, and other capabilities
Agent Types
Explore different agent architectures