Overview
Prompt components enable you to:- Reuse prompts across multiple agents and ensembles
- Version prompts with semantic versioning for reproducibility
- A/B test different prompt versions
- Organize complex multi-step instructions
- Deploy prompts independently from code
Quick Start
1. Create a Prompt Component
Create a prompt file (plain text or Markdown):2. Add to Edgit
3. Reference in Your Ensemble
URI Format and Versioning
All prompt components use the standardized URI format:prompt://- Protocol identifier for prompt components{path}- Logical path to the prompt (e.g.,analyze-company,workflows/extraction/step1)[@{version}]- Optional version identifier (defaults to@latest)
@latest- Always uses the most recent version@v1- Uses latest patch of major version (v1.x.x)@v1.0.0- Specific semantic version (immutable)@prod- Custom tag for production versions@staging- Custom tag for staging versions
Example URIs
How to Reference in Ensembles
There are three ways to reference prompts in your ensembles:1. URI Format (Recommended)
Use theprompt:// URI format to reference versioned prompt components:
2. Inline Prompt with Variables
For simple operations or during development, use inline prompts with template variables:3. Inline Prompt (No Variables)
For static prompts without variables:Using Prompt Components
Multi-Step Workflow
Caching and Performance
Prompt components are automatically cached for 1 hour (3600 seconds) after first load.Default Caching
Custom Cache TTL
Bypass Cache
Best Practices
1. Version Your Prompts
Use semantic versioning to track changes:2. Use Production Tags
Create stable version tags for production ensembles:3. Test Before Promoting
4. Clear, Specific Instructions
5. Include Examples
6. Organize by Purpose
Use path hierarchies for organization:Provider-Specific Considerations
Anthropic (Claude)
Optimized for detailed instructions and reasoning:OpenAI (GPT)
Works well with concise instructions:Cloudflare Workers AI
Use simpler, shorter prompts:Common Patterns
Sentiment Analysis
Information Extraction
Content Summarization
Versioning Strategy
Development Workflow
Rollback Strategy
Using ctx API in Agents
When building custom agents with TypeScript handlers, you can access prompts through thectx API:
ctx.prompts.get(name)
Get the raw prompt text by name:ctx.prompts.render(name, vars)
Render a prompt template with variables:Complete Example with AI Call
Dynamic Prompt Selection
Troubleshooting
Prompt Not Found
Error:Component not found: prompt://[email protected]
Solution:
- Check prompt exists:
edgit list prompts - Check version:
edgit tag list analyze-company - Verify deployment:
edgit tag show [email protected]
Inconsistent Results
Issue: Same prompt produces different outputs Solutions:- Set
temperature: 0for deterministic results - Use specific model versions:
claude-sonnet-4-20250514 - Include more specific examples in the prompt
Cache Issues
Issue: Updated prompt not being used Solution: Invalidate cache or setcache.bypass: true

