Skip to main content
Define and version reusable AI prompts as components for consistent reasoning across ensembles.

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:
Format breakdown:
  • 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)
Version format:
  • @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: Use the prompt:// 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 the ctx 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://analyze-company@v1.0.0 Solution:
  1. Check prompt exists: edgit list prompts
  2. Check version: edgit tag list analyze-company
  3. Verify deployment: edgit tag show analyze-company@v1.0.0

Inconsistent Results

Issue: Same prompt produces different outputs Solutions:
  1. Set temperature: 0 for deterministic results
  2. Use specific model versions: claude-sonnet-4-20250514
  3. Include more specific examples in the prompt

Cache Issues

Issue: Updated prompt not being used Solution: Invalidate cache or set cache.bypass: true

Next Steps

Query Components

SQL queries as components

Config Components

JSON settings as components

Think Operation

AI reasoning operations

Edgit Versioning

Version control for components