promptmap
A data-engineering-inspired prompt orchestration tool for LLMs (think dbt for prompts).
Why promptmap? Treating complex LLM workflows as giant one-shot prompts is like navigating a city by staring at your feet, one wrong turn and you're lost. promptmap turns your prompts into a visual map of connected hypotheses (models) and reality-check landmarks (tests), with built-in tools to inspect runs (promptmap docs).
Mechanically, this means you: write modular prompts in Jinja2, chain them into a dependency graph with ref(), and validate outputs against reality with promptmap test. Iterate on complex LLM workflows without losing context or rewriting from scratch. (Read more on the philosophy in motivation.md).
Quick start
uv tool install promptmap --with anthropic # or: openai | gemini
promptmap init --provider anthropic # or: openai | gemini
Edit your .prompt files in map/, then run the pipeline, test expectations, and inspect the run:
export ANTHROPIC_API_KEY=your_key_here
promptmap run # Execute the prompt DAG
promptmap test # Validate outputs against map/*.testprompt
promptmap docs # Generate HTML report of the run and run history
promptmap serve # Launch the interactive local UI / HTTP server
Core concepts
1. Models (map/*.prompt)
Each .prompt file is a node in your DAG. Use ref('model_name') to inject the output of an upstream model:
{# map/outline.prompt #}
Based on this topic, create a detailed outline:
{{ ref('topic') }}
2. Model types (config(model_type=...))
Not every node in your pipeline needs to be a standard LLM call. Override model_type at the top of a .prompt file for deterministic steps, formatting, or coding agents:
| Model Type | What it does | Declaration |
|---|---|---|
| LLM (default) | Sends the rendered Jinja prompt to your configured LLM. | Standard .prompt file |
template |
Renders Jinja directly with no LLM call (for reshaping upstream outputs). | {{ config(model_type="template") }} |
execute_python |
Runs rendered template as Python; captures stdout or output variable. |
{{ config(model_type="execute_python") }} |
agent |
Hands the rendered prompt as a task to a coding agent (mini-swe-agent). |
{{ config(model_type="agent", agent_dir="./repo") }} |
(Optional extra model kinds like python_modal, agent_modal, and agent37 are available via pip install "promptmap[extras]").
3. Tests (map/*.testprompt)
Run promptmap test to validate the latest run's outputs against your expectations:
- LLM-as-a-judge: Prompt tests in
map/*.testprompt(alongside your models) pass when the LLM returns{"results": "pass"}. - Deterministic checks: Compare output fields directly in YAML cases (
map/*.yml) usingexpect(no LLM judge needed).
4. Visualizing & serving (promptmap docs & promptmap serve)
Inspect prompt graph visually:
promptmap docsgenerates a self-contained HTML report of every run—showing rendered prompts, model outputs, token usage, and test results across the DAG.promptmap servestarts a local server to interactively explore the DAG, trigger runs or inspect previous results.
Documentation
| Category | Guides |
|---|---|
| Inputs & Data | Passing variables (promptdata) · Passing files (promptfiles) · RAG inside prompts · Global instructions |
| Workflow & DAG | Grouping models in folders · Map & reduce (each=) · Dynamically skipping models · Models that produce files · Run IDs & iterating on the last answer (previous) |
| Testing & Eval | Writing tests · Validation · Bulk YAML testing & expect |
| CLI, UI & API | promptmap docs (HTML report) · promptmap serve & HTTP server · promptmap ls · Python API & callbacks · Token usage |
| Customization | Custom LLM backend (client.py) · Output format & config() · Agent models · Custom model kinds · Architecture |
Metadata
Release files for promptmap 0.5.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| promptmap-0.5.16.tar.gz | 204.1 kB | Without provenance | Details for promptmap-0.5.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| promptmap-0.5.16-py3-none-any.whl | Python 3 | none | any | Details for promptmap-0.5.16-py3-none-any.whl |
Total release size: 389.6 kB
Release files / promptmap-0.5.16.tar.gz
| Download URL | promptmap-0.5.16.tar.gz |
|---|---|
| Size | 204.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb3382f9613088f46a4d309f6be83627a229d8e82966deb319e03670688b8a09
|
|
BLAKE2b-256 checksum How to use checksums |
b72b5f5bcd8f7d2d60225d7fc538d06572bf6cb36864ab92fb2040c024691d79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / promptmap-0.5.16-py3-none-any.whl
| Download URL | promptmap-0.5.16-py3-none-any.whl |
|---|---|
| Size | 185.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
500e22acc7f1ce4368aa027252f2dbd9510e268264e9113cd51b44053e391100
|
|
BLAKE2b-256 checksum How to use checksums |
a51cfc0bbb08f25616ccc586f6c0ddedadea0adeadcc3686a7826b3a4575bc2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for promptmap 0.5.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.