Prompt composition

Reference one prompt from another and inject its rendered output at request time.

We recommend installing the Respan MCP so your AI coding tool can work with your prompts, logs, and traces directly. Authenticate with your Respan API key from the API keys page:

$claude mcp add \
> --transport http \
> --header "Authorization: Bearer YOUR_RESPAN_API_KEY" \
> respan \
> https://mcp.respan.ai/mcp

See the MCP docs for OAuth setup and other clients.

New to prompts? Start with the Quickstart.
For schema, deployment, streaming, and logging, see Advanced features.

Prompt composition lets a variable in one prompt reference another prompt. At request time, the child is rendered first, converted to plain text, and inserted into the parent variable.

To use prompt composition, create two prompts: a child prompt and a parent prompt that has a {{variable}} where the child’s output will be injected.

In the parent prompt's Variables tab, set the variable type to Prompt, select the child prompt, add test values to the child's variables, then run the test.
1

Configure the variable

In the parent prompt editor, open the Variables tab on the right and configure the variable you want to embed a prompt into:

  • Set its type to Prompt
  • Select the child prompt to embed
  • Add test values for the child’s variables
2

Run your test

Click Run to test. The child prompt is rendered first, converted to plain text, and injected into the parent variable before the LLM sees it.

Composition limits:

  • No circular references. A prompt can’t reference itself, directly or through another prompt (e.g. A → B → A). Cycles are rejected with HTTP 400.
  • One level of nesting only. Composition supports a single parent → child chain (depth 2). A child prompt can’t embed yet another prompt, so its variables must be plain values. Going deeper returns HTTP 400.