Versioned prompt CRUD, A/B experiments, metrics, and LLM optimization API
Project description
Prompt Manager
Versioned prompt CRUD, A/B experiments, metric collection, and LLM-driven optimization API.
Install
# Just the client SDK (for services that fetch prompts)
pip install prompt-manager[client]
# Full API server
pip install prompt-manager[api]
# Client + metric reporting
pip install prompt-manager[client,metric]
# Everything
pip install prompt-manager[all]
Quick start
Start the API
# Configure
export PM_DATABASE_URL=postgresql://prompt_manager:prompt_manager@localhost:15432/prompt_manager
export PM_LLM_PROVIDER=groq
export PM_LLM_MODEL=openai/gpt-oss-120b
export PM_LLM_API_KEY=your-api-key
# Start
arpm-api up # Start PostgreSQL via Docker
arpm-api start # Run migrations + start API on :8910
Use the client SDK
from prompt_manager.client import PromptManagerClient
client = PromptManagerClient(base_url="http://localhost:8910")
# Resolve a prompt (returns latest version, experiment-aware)
prompt = await client.resolve("welcome-email", session_id="user-123")
print(prompt.body) # "Hi {name}, welcome to {company}!"
print(prompt.version) # 2
# Report a quality metric
await client.report_metric("welcome-email", str(prompt.version_id), "quality", 8.5)
API endpoints
| Method | Path | Description |
|---|---|---|
| POST | /prompts |
Create prompt (auto-creates v1) |
| GET | /prompts |
List all prompts |
| GET | /prompts/{slug} |
Get prompt by slug |
| POST | /prompts/{slug}/versions |
Create new version |
| GET | /prompts/{slug}/versions |
List versions |
| GET | /resolve/{slug} |
Resolve prompt (experiment-aware) |
| POST | /experiments |
Create A/B experiment |
| PATCH | /experiments/{id}/status |
Start/pause/conclude |
| POST | /metrics |
Report metric signal |
| GET | /metrics/aggregate |
Aggregated metrics per version |
| POST | /optimize |
Trigger LLM optimization |
| GET | /health |
Health check |
Key features
- Slug-based addressing --
resolve("welcome-email")not UUIDs - Immutable versions -- append-only, SHA-256 dedup, full audit trail
- Experiment routing -- MurmurHash3 deterministic + Thompson Sampling (auto_optimize)
- Sticky sessions -- same user always sees same variant
- Metric collection -- quality signals per version, batch ingestion
- MCP server -- expose all tools via Model Context Protocol
- CLI --
arpm-api up,arpm-api start,arpm-api migrate,arpm-api health
Database
Requires PostgreSQL 14+. Migrations run automatically on arpm-api start.
arpm-api up # Start PostgreSQL via Docker
# Or point to existing Postgres and run migrations only
PM_DATABASE_URL=postgresql://user:pass@host:5432/dbname arpm-api migrate
Configuration
All settings via PM_-prefixed environment variables:
| Variable | Default | Description |
|---|---|---|
PM_DATABASE_URL |
postgresql://localhost:5432/prompt_manager |
PostgreSQL DSN |
PM_HOST |
0.0.0.0 |
Bind host |
PM_PORT |
8910 |
Bind port |
PM_LLM_PROVIDER |
anthropic |
LLM for optimization |
PM_LLM_MODEL |
claude-sonnet-4-20250514 |
Model ID |
PM_LLM_API_KEY |
-- | API key |
Part of autoresearch-prompt-manager
autoresearch-prompt-manager (this package -- API, client, metrics)
-> autoresearcher-shonku (optimization agents)
-> shonku (agent framework)
-> agno (runtime -- https://agno.com)
LLM-driven optimization is powered by agno and AgentOS.
Contributing
- Fork autoresearch-prompt-manager
cd packages/prompt_manager && pip install -e '.[dev,api,client,metric]'- Make changes,
pytest,ruff check src/ - Integration tests:
PM_DATABASE_URL=... python3 -m pytest tests/integration/ - Submit a PR
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autoresearch_prompt_manager-0.1.3.tar.gz.
File metadata
- Download URL: autoresearch_prompt_manager-0.1.3.tar.gz
- Upload date:
- Size: 28.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c3d3c91faf423ad3a7f2e61a64043c5f2dbf26010aaa4a013fac4b7f3042ecf
|
|
| MD5 |
b282b2cc9cf76bee4f73e21446d17377
|
|
| BLAKE2b-256 |
6807cd5a0601c517240e4461f132469a888c35fec8f133ab1cad2d11f29a7d84
|
File details
Details for the file autoresearch_prompt_manager-0.1.3-py3-none-any.whl.
File metadata
- Download URL: autoresearch_prompt_manager-0.1.3-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b949666d150add0f4f395a78e3fcf9a4a5458d7848cc59f65ecae0e8983325d2
|
|
| MD5 |
5c79a146ed84e28c7974bf615c532bd2
|
|
| BLAKE2b-256 |
ba9797739fccd9d62d4d54e2e95ba66e24e4bc32324c918baf2833d3869a5696
|