# Prompty

> Prompty is an open-source markdown file format and set of runtimes for defining, running, tracing, and building agentic LLM prompts.

Prompty, from Microsoft, is a markdown-based file format (`.prompty`) for LLM prompts. A single file pairs YAML frontmatter (model configuration, inputs, tools, template settings) with a markdown prompt body, and can be executed from VS Code or from language runtimes. The project is MIT licensed and its v2 packages are available for Python, TypeScript, Rust, and C#.

## What It Is

Prompty is a prompt asset format plus runtimes and tooling. The frontmatter holds model and connection details, typed input schemas with defaults, and tool definitions (function, MCP, OpenAPI). The body uses role markers (`system:`, `user:`, `assistant:`) and Jinja2 or Mustache templating. Variable references such as `${env:VAR}` and `${file:path}` pull in environment values and files, with file access scoped to the prompt's directory by default.

## How the Pipeline Works

Every prompt runs through four stages: render (expand template variables), parse (split role markers into messages), execute (call the LLM through a registered provider), and process (extract content, parse structured output, stream chunks). Providers include OpenAI, Microsoft Foundry, and Anthropic. The OpenAI provider can also target OpenAI-compatible endpoints by setting a connection endpoint, leaving the prompt unchanged. In Python, `invoke` runs the whole pipeline, or `load`, `prepare`, and `run` can be called step by step, with async variants.

## Agentic Turns and Tracing

Prompty v2 adds a `turn()` runtime for agentic loops. Tools are declared in frontmatter while handlers are supplied in host code. The loop executes model-requested tools and feeds results back until a final answer. Guardrails, steering, cancellation, retries, context budgets, compaction, and memory-aware conversations are controlled in code. Executions produce traces with messages, token use, latency, and raw responses, via console, JSON file, or OpenTelemetry backends, and a `@trace` decorator for custom functions.

## VS Code Extension

The VS Code extension offers syntax highlighting, autocomplete, a connections sidebar for OpenAI, Microsoft Foundry, and Anthropic, live preview, an interactive chat mode with tool calling, F5 execution, and a trace viewer for `.tracy` files.

## Features
- Markdown .prompty file format with YAML frontmatter
- Jinja2 and Mustache templating
- Typed input schemas with defaults
- Function, MCP, and OpenAPI tool definitions
- Four-stage render/parse/execute/process pipeline
- Agentic turn() runtime with tool loop
- Guardrails, steering, cancellation, and retries
- Context budgets, compaction, and memory-aware turns
- Tracing with console, JSON file, and OpenTelemetry backends
- VS Code extension with live preview, chat mode, and trace viewer
- OpenAI-compatible endpoint support
- Plugin system for custom providers

## Integrations
OpenAI, Microsoft Foundry, Anthropic, OpenTelemetry, VS Code, MCP, OpenAPI

## Platforms
API, VSC_EXTENSION, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
python/2.0.1

## Links
- Website: https://prompty.ai
- Documentation: https://prompty.ai/welcome/
- Repository: https://github.com/microsoft/prompty
- EveryDev.ai: https://www.everydev.ai/tools/prompty
