Skip to main content

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).

DAG visual


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 tests/
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 (tests/*.prompt)

Run promptmap test to validate the latest run's outputs against your expectations:

  • LLM-as-a-judge: Prompt tests in tests/*.prompt pass when the LLM returns {"results": "pass"}.
  • Deterministic checks: Compare output fields directly in YAML using expect (no LLM judge needed).

4. Visualizing & serving (promptmap docs & promptmap serve)

Inspect prompt graph visually:

  • promptmap docs generates a self-contained HTML report of every run—showing rendered prompts, model outputs, token usage, and test results across the DAG.
  • promptmap serve starts 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.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for promptmap 0.5.13
File Size Uploaded
promptmap-0.5.13.tar.gz 198.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for promptmap 0.5.13
File Interpreter ABI Platform
promptmap-0.5.13-py3-none-any.whl Python 3 none any Details

Total release size: 379.5 kB

Release files / promptmap-0.5.13.tar.gz

Download URL promptmap-0.5.13.tar.gz
Size 198.5 kB
Tags Source
SHA-256 checksum
How to use checksums
675e5112cbccf03a2c6ae28d54f44c917e58c1c96ad085a82cfcbb0843e89acd
BLAKE2b-256 checksum
How to use checksums
00e342248c481cee55983a727fe28fad12c3c481ac50500e5a708ec09a8a877b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

Release files / promptmap-0.5.13-py3-none-any.whl

Download URL promptmap-0.5.13-py3-none-any.whl
Size 181.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c167a12b111c029ba105961c925a7e4849b5a73a325cf5c422bcd910bc1b42a4
BLAKE2b-256 checksum
How to use checksums
1889e8e6db8e2fb9ffa8ab7d12bd865c55b1a1dbb0002d0d7926fe612d4ac1fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.0

Release history Release notifications | RSS feed

This release

0.5.13 This release

2 release files

0.5.12

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page