LLM prompt management and evaluation platform. Version prompts, run A/B tests, evaluate with metrics, and deploy with confidence using Agenta's self-hosted solution.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
LLM prompt management and evaluation platform. Version prompts, run A/B tests, evaluate with metrics, and deploy with confidence using Agenta's self-hosted solution.
Manage, evaluate, and deploy LLM prompts with confidence. Version control your prompts, run A/B tests, and measure quality with automated evaluation.
Quick Start
# Install Agenta SDK
pip install agenta
# Start Agenta locally with Docker
docker run -d -p 3000:3000 -p 8000:8000 ghcr.io/agenta-ai/agenta
# Or use pip for just the SDK
pip install agenta
# Initialize project
agenta init --app-name my-llm-app
When to Use This Skill
USE when:
Managing multiple versions of prompts in production
Need systematic A/B testing of prompt variations
Evaluating prompt quality with automated metrics
Collaborating on prompt development across teams
Requiring audit trails for prompt changes
Building LLM applications that need to iterate quickly
Need to compare different models with same prompts
Want a playground for rapid prompt experimentation
Self-hosting is required for security/compliance
DON'T USE when:
Simple single-prompt applications
No need for prompt versioning or testing
Already using another prompt management system
Rapid prototyping without evaluation needs
Cost-sensitive projects (evaluation adds API calls)
Prerequisites
# SDK installation
pip install agenta>=0.10.0
# For self-hosted deployment
docker pull ghcr.io/agenta-ai/agenta
# Or with docker-compose
git clone https://github.com/Agenta-AI/agenta
cd agenta
docker-compose up -d
# Environment setupexport AGENTA_HOST="http://localhost:3000"export AGENTA_API_KEY="your-api-key"# If using cloud version# For LLM providersexport OPENAI_API_KEY="sk-..."export ANTHROPIC_API_KEY="sk-ant-..."
Verify Installation
import agenta as ag
from agenta import Agenta
# Initialize client
client = Agenta()
# Check connectionprint(f"Agenta SDK version: {ag.__version__}")
print("Connection successful!")
Core Capabilities
1. Prompt Versioning and Management
Creating Versioned Prompts:
"""
Create and manage versioned prompts with Agenta.
"""import agenta as ag
from agenta import Agenta
from typing importOptional, Dict, Any# Initialize Agenta
ag.init()
@ag.entrypointdefgenerate_summary(
text: str,
max_length: int = 100,
style: str = "professional") -> str:
"""
Generate a summary with versioned prompt.
Args:
text: Text to summarize
max_length: Maximum summary length
style: Writing style (professional, casual, technical)
Returns:
Generated summary
"""# Define prompt template (this becomes versioned)
prompt = f"""Summarize the following text in a {style} tone.
Keep the summary under {max_length} words.
Text: {text}
Summary:"""# Call LLM (Agenta tracks this)
response = ag.llm.complete(
prompt=prompt,
model="gpt-4",
temperature=0.3,
max_tokens=max_length * 2
)
return response.text
# Example usage
text = """
The company reported strong Q3 results with revenue up 25% year-over-year.
Operating margins improved to 18% from 15% in the prior year.
The CEO highlighted expansion into new markets and product launches.
"""
summary = generate_summary(text, max_length=50, style="professional")
print(summary)
# Problem: Cannot connect to Agenta host# Solution: Verify host and network settingsdefdiagnose_connection(host: str):
import requests
try:
response = requests.get(f"{host}/api/health", timeout=5)
if response.status_code == 200:
print("Connection successful")
else:
print(f"Server returned: {response.status_code}")
except requests.exceptions.ConnectionError:
print("Cannot reach server - check host/port")
except requests.exceptions.Timeout:
print("Connection timed out - server may be overloaded")
Evaluation Failures
# Problem: Evaluations failing or inconsistent# Solution: Add retry logic and validationdefrobust_evaluation(prompt: str, max_retries: int = 3):
for attempt inrange(max_retries):
try:
result = ag.llm.complete(prompt=prompt)
if validate_result(result):
return result
except Exception as e:
if attempt == max_retries - 1:
raise
time.sleep(2 ** attempt)
Version Conflicts
# Problem: Multiple team members editing same variant# Solution: Use branching strategydefcreate_branch_variant(base_variant: str, branch_name: str):
# Clone variant for isolated development
base = client.get_variant_by_name(app_name, base_variant)
return client.create_variant(
app_name=app_name,
variant_name=f"{base_variant}-{branch_name}",
config=base.config
)
1.0.0 (2026-01-17): Initial release with versioning, A/B testing, evaluation, playground, model comparison, self-hosting
This skill provides comprehensive patterns for LLM prompt management with Agenta, refined from production prompt engineering workflows.
# Create variant in Agenta
self
self
"template"
"parameters"
or
return
id
or
False
def
list_versions
self
List
"""List all prompt versions."""
self
self
for
in
id
"template"
""
"parameters"
return
def
set_active_version
self, version_id: str
None
"""Set a version as the active/default version."""
self
self
def
get_version
self, version_id: str
"""Get a specific version."""
self
return
id
"template"
""
"parameters"
def
compare_versions
self,
version_ids: List[str],
test_input: str
Dict
str
str
"""
Compare outputs from multiple versions.
Args:
version_ids: List of version IDs to compare
test_input: Input to test with
Returns:
Dictionary mapping version_id to output
"""
for
in
self
# Format prompt with test input
format
input
# Generate output
return
# Usage
"summarizer-app"
# Create versions
"concise-v1"
"Summarize briefly: {input}"
"max_tokens"
100
"detailed-v2"
"Provide a comprehensive summary with key points: {input}"
"""
Route a request to a variant based on traffic split.
Args:
config: A/B test configuration
Returns:
Selected variant ID
"""
0
for
in
if
return
# Fallback to first variant
return
list
0
def
run_request
self,
config: ABTestConfig,
input_data: str
Dict
"""
Run a single request in the A/B test.
Args:
config: A/B test configuration
input_data: Input for the prompt
Returns:
Result dictionary with variant and output
"""
import
# Route to variant
self
self
# Prepare prompt
"template"
""
format
input
# Run with timing
"variant_id"
"input"
"output"
"latency"
"tokens_used"
if
hasattr
'usage'
else
0
# Store result
self
return
def
get_test_results
self, config: ABTestConfig
Dict
"""
Get aggregated results for an A/B test.
Args:
config: A/B test configuration
Returns:
Aggregated results by variant
"""
for
in
self
if
not
continue
"latency"
for
in
"tokens_used"
for
in
"sample_count"
len
"avg_latency"
sum
len
"avg_tokens"
sum
len
if
else
0
"min_latency"
min
"max_latency"
max
return
def
declare_winner
self, config: ABTestConfig
Optional
str
"""
Analyze results and declare a winner.
Args:
config: A/B test configuration
Returns:
Winner variant ID or None if inconclusive
"""
self
# Check minimum samples
for
in
if
"sample_count"
print
f"Insufficient samples for {variant_id}"
return
None
# Simple winner selection based on latency
# In production, use statistical significance tests
f"""Evaluate the following response on {self.criteria}.
Score from 0.0 to 1.0.
Response:
{output}{f'Expected: {expected}'if expected else''}
Provide your evaluation as JSON: {{"score": 0.0-1.0, "reasoning": "..."}}
"""
"gpt-4"
0
try
float
"score"
0.5
"reasoning"
""
except
0.5
"Failed to parse judge response"
return
self
"reasoning"
"criteria"
self
class
EvaluationPipeline
"""
Pipeline for running multiple evaluations.
"""
"""
Evaluate a single output with all metrics.
Args:
output: Generated output
expected: Expected output (optional)
context: Additional context
Returns:
Dictionary of metric results
"""
for
in
self
return
def
evaluate_batch
self,
test_cases: List[Dict]
Dict
str
List
"""
Evaluate a batch of test cases.
Args:
test_cases: List of {input, output, expected} dicts
Returns:
Aggregated results by metric
"""
"""
Get summary statistics from batch evaluation.
Args:
batch_results: Results from evaluate_batch
Returns:
Summary statistics
"""
for
in
for
in
"mean"
sum
len
if
else
0
"min"
min
if
else
0
"max"
max
if
else
0
"count"
len
return
# Usage
# Create evaluation pipeline
"qa-bot"
"answer"
"explanation"
20
200
"helpfulness"
# Test cases
"input"
"What is Python?"
"output"
"Python is a programming language known for its simplicity. The answer is that it's versatile. Here's an explanation: it's widely used in data science and web development."
"expected"
"Python is a high-level programming language"
"input"
"Explain recursion"
"output"
"Recursion is a function calling itself. The answer involves base cases and recursive calls. Explanation: it's useful for tree structures."
"""
Compare multiple prompts with same input.
Args:
prompts: List of prompt templates
test_input: Input to test
parameters: Shared parameters
Returns:
List of ExperimentRuns
"""
"""
Sweep over parameter values.
Args:
param_name: Parameter to sweep
values: List of values to try
test_input: Input for testing
Returns:
List of ExperimentRuns
"""
"""
Find the best run based on a metric.
Args:
metric: Metric to optimize
minimize: Whether to minimize (True) or maximize (False)
Returns:
Best ExperimentRun or None
"""
"""
Run the same prompt across all models.
Args:
prompt: Prompt to test
temperature: Temperature setting
max_tokens: Maximum output tokens
Returns:
Results for each model
"""
"""
Run benchmark across multiple prompts.
Args:
prompts: List of prompts to test
temperature: Temperature setting
Returns:
Aggregated benchmark results
"""
for
in
self
return
self
def
get_summary
self
Dict
str
Dict
"""Get summary statistics for all models."""
for
in
self
if
not
continue
for
in
if
0
if
not
continue
"runs"
len
"avg_latency"
sum
for
in
len
"avg_tokens"
sum
for
in
len
"total_cost"
sum
for
in
"min_latency"
min
for
in
"max_latency"
max
for
in
return
def
recommend_model
self,
priority: str = "balanced"
str
"""
Recommend best model based on priority.
Args:
priority: "speed", "cost", "quality", or "balanced"
Returns:
Recommended model name
"""
self
if
not
return
self
0
if
"speed"
return
min
lambda
"avg_latency"
elif
"cost"
return
min
lambda
"total_cost"
elif
"quality"
# Assume larger models = better quality
"gpt-4"
"claude-3-opus"
"gpt-4.1"
"claude-3-sonnet"
"gpt-4.1-mini"
for
in
if
in
return
else
# balanced
# Score based on normalized latency and cost
max
"avg_latency"
for
in
max
"total_cost"
for
in
or
1
for
in
"avg_latency"
"total_cost"
0.5
0.5
return
min
lambda
return
self
0
# Usage
"gpt-4"
"gpt-4.1-mini"
# Single comparison
"Explain quantum computing in simple terms"
print
"Single Comparison Results:"
for
in
print
f" {model}:"
print
f" Latency: {result.latency:.3f}s"
print
f" Tokens: {result.tokens}"
print
f" Cost: ${result.cost:.4f}"
print
f" Output: {result.output[:100]}..."
# Benchmark
"What is machine learning?"
"Explain the difference between AI and ML"
"Write a haiku about technology"
print
"\nBenchmark Summary:"
for
in
print
f" {model}:"
print
f" Runs: {stats['runs']}"
print
f" Avg Latency: {stats['avg_latency']:.3f}s"
print
f" Total Cost: ${stats['total_cost']:.4f}"
# Get recommendation
"balanced"
print
f"\nRecommended model (balanced): {recommended}"
"AGENTA_HOST"
self
if
self
"AGENTA_API_KEY"
self
# Initialize Agenta
self
# Test connection
f"{self.base_url}/api/health"
return
200
except
as
print
f"Initialization failed: {e}"
return
False
def
create_app
self,
name: str,
description: str = ""
Dict
"""
Create a new application.
Args:
name: Application name
description: Application description
Returns:
Created application details
"""
"""
Deploy a variant to an environment.
Args:
app_name: Application name
variant_name: Variant to deploy
environment: Target environment
Returns:
Deployment details
"""
# Get variant
self
next
for
in
if
None
if
not
raise
f"Variant '{variant_name}' not found"
# Deploy
return
self
id
def
get_deployment_status
self, app_name: str
Dict
"""
Get deployment status for an application.
Args:
app_name: Application name
Returns:
Deployment status
"""
"""
Create a Langchain chain from Agenta prompt.
Args:
variant_name: Variant to use
model: Model name
temperature: Temperature setting
Returns:
Langchain chain
"""