Overview
A context defines the execution environment for a flow—memory scope, reasoning depth, model parameters, and language preferences. While personas define “who” executes a flow, contexts define “how” it’s executed.Syntax
Fields
memory (optional)
Type: One of session, persistent, none, ephemeral
Defines the memory scope for the execution.
| Scope | Lifetime | Use Case |
|---|---|---|
none | No memory | Stateless operations, one-off queries |
ephemeral | Single flow execution | Temporary working memory |
session | Current session/conversation | Chat contexts, iterative tasks |
persistent | Across sessions | Long-term knowledge, user preferences |
language (optional)
Type: String (ISO language code)
Preferred language for the execution context.
depth (optional)
Type: One of shallow, standard, deep, exhaustive
Defines the reasoning depth and thoroughness of analysis.
| Level | Characteristics | Typical Use |
|---|---|---|
shallow | Fast, high-level overview | Quick summaries, previews |
standard | Balanced depth and speed | General purpose tasks |
deep | Thorough, detailed analysis | Complex reasoning, research |
exhaustive | Maximum detail, multi-pass | Legal review, critical analysis |
max_tokens (optional)
Type: Integer (must be positive)
Maximum number of tokens for the model’s response.
- 500-1000: Brief summaries, quick responses
- 2000-4096: Standard tasks, moderate complexity
- 8000-16000: Long-form reports, comprehensive analysis
- 16000+: Extended documents, multi-part responses
temperature (optional)
Type: Float (range: 0.0 to 2.0)
Controls randomness/creativity in model outputs. Lower = more deterministic, higher = more creative.
| Range | Behavior | Use Cases |
|---|---|---|
0.0 - 0.3 | Highly deterministic | Facts, analysis, legal, medical |
0.4 - 0.7 | Balanced | General purpose, Q&A |
0.8 - 1.2 | Creative | Brainstorming, content generation |
1.3 - 2.0 | Highly creative | Experimental, artistic |
cite_sources (optional)
Type: Boolean (default: false)
Whether to require source citations in this context.
Complete Examples
Legal Review Context
Quick Summary Context
Research Context
Creative Writing Context
Production Context
Usage with Run Statements
Contexts are activated using thewithin modifier:
Best Practices
1. Match Context to Task Criticality
High-stakes tasks need stricter contexts:2. Memory Scope Tradeoffs
3. Temperature for Determinism
Lower temperature for consistency:4. Token Budgets
Set appropriate token limits:5. Combine with Personas
Contexts and personas work together:Common Patterns
Development vs. Production
Multi-Language Support
Tiered Analysis Depths
Type Checking
The AXON type checker validates: ✅ Memory scope: Must be one of the valid scopes✅ Depth level: Must be one of the valid depth levels
✅ Temperature range: Must be between 0.0 and 2.0
✅ Max tokens: Must be positive
✅ Context references: Referenced contexts must exist
