Backend Architecture Overview
Backends are Phase 2 of the AXON pipeline: they transform model-agnostic IR into LLM-specific prompt structures ready for execution.Design Philosophy
Separation of Concerns
Phase 1 (Compiler) decides WHAT to do:- Which reasoning steps to execute
- What anchors to enforce
- What types to expect
- System prompt structure for Claude vs GPT-4
- Tool declaration format (Anthropic vs OpenAI)
- Chain-of-thought framing
- Structured output schemas
Model Agnosticism at the Core
The IR layer has zero knowledge of any LLM provider:- Claude: Extended thinking blocks with explicit work-showing
- GPT-4: System message with chain-of-thought instructions
- Gemini: markdown-formatted reasoning prompts
Backend Interface
BaseBackend Protocol
All backends implement theBaseBackend abstract class:
Compilation Output
CompiledProgram — Complete backend output:Compilation Flow
Entry Point
Compilation Context
Available Backends
Production-Ready
Anthropic (Claude)
Claude-optimized prompts with extended thinking
Google Gemini
Gemini API with system_instruction formatting
Stubs (Phase 2 Expansion)
OpenAI (GPT)
Chat Completions API format (planned)
Ollama (Local)
Local model adaptations (planned)
Key Differences Between Backends
System Prompt Structure
Anthropic:Tool Declaration Format
Anthropic (Messages API):Structured Output
Anthropic: Uses JSON schema in content blocks Gemini: Usesresponse_schema parameter
OpenAI: Uses response_format with JSON mode
Anchor Enforcement
Backends inject anchor constraints into the system prompt as hard constraints:Adding a New Backend
1. Implement BaseBackend
2. Register Backend
3. Test with Mock Client
Next Steps
Anthropic Backend
Deep dive into Claude-specific compilation
Runtime Executor
See how compiled programs are executed
