Skip to content

What's New in v2

If you used Prompty v1, the mental model carries forward unchanged. A .prompty file is still a markdown file with YAML frontmatter. The pipeline still works the same way:

.prompty file → load → render → parse → execute → process → result

The functions you know still do exactly what they did:

FunctionWhat it does (same as v1)
load()Parse a .prompty file into a typed agent object
prepare()Render the template + parse role markers into messages
invoke()Full pipeline: load → prepare → execute → process
run()Execute pre-prepared messages (skip load + prepare)

If your v1 code used load()prepare()invoke(), the same pattern works in v2 with updated frontmatter property names. That’s it.

The frontmatter property names were cleaned up to align with the Prompty schema, but the structure is the same — model config, inputs, template settings:

# v1 # v2
model: model:
api: chat apiType: chat
configuration: provider: foundry
type: azure_openai connection:
azure_endpoint: ${env:X} kind: key
api_key: ${env:Y} endpoint: ${env:X}
parameters: apiKey: ${env:Y}
max_tokens: 500 options:
temperature: 0.7 maxOutputTokens: 500
temperature: 0.7

See the Migration Guide for the full property mapping.

What’s New: turn() for Agentic Workflows

Section titled “What’s New: turn() for Agentic Workflows”

The one conceptually new function in v2 is turn(). It handles what happens when an LLM response includes tool calls — something v1 didn’t natively support.

turn() runs a loop: send messages → get response → if tool calls, execute them → re-send → repeat until the model returns a final answer.

from prompty import turn
result = turn(
"agent.prompty",
inputs={"question": "What's the weather in Seattle?"},
tools={"get_weather": get_weather},
)

Without tools, turn() behaves identically to invoke() — the only difference is that it tracks turn numbers for multi-turn conversations.

turn 1
prepare
Jinja2Renderer
PromptyChatParser
Executor
toolCalls ← only appears when the LLM returns tool calls
get_weather
Executor ← re-sends with tool results
Processor

v2 adds TypeScript and C# runtimes alongside the existing Python runtime, and introduces a new Rust runtime. All four share the same .prompty file format and public API:

PythonTypeScriptC#Rust
Packageprompty@prompty/corePrompty.Coreprompty
Providersprompty[openai]@prompty/openaiPrompty.OpenAIprompty-openai
Installuv pip installnpm installdotnet add packagecargo add

First-class streaming with tracing integration:

  • PromptyStream / AsyncPromptyStream wrappers
  • Automatic chunk accumulation for trace output
  • Works with all providers (OpenAI, Azure, Anthropic)

Define outputs in frontmatter → automatic response_format:

outputs:
- name: city
kind: string
- name: temperature
kind: float

Responses are JSON-parsed and validated when an output schema is defined.

  • @trace / [Trace] decorator wraps any function with spans
  • Pluggable backends: console, JSON files, OpenTelemetry
  • All pipeline stages traced automatically
  • OpenAI — direct API key
  • Azure OpenAI / Foundry — API key, Entra ID, managed identity
  • Anthropic — via provider registry
  • Extensible: implement executor/processor protocols and register

The four-stage pipeline (Render → Parse → Execute → Process) is now independently replaceable via the discovery/registry system. Third-party providers can register as plugins.

  • Live preview of rendered prompts
  • Connection management for OpenAI and Azure endpoints
  • Copilot Chat integration