Skip to main content

Overview

Prompts define the instructions and configuration for LLM interactions in Standard Agents. Each prompt specifies system instructions, model configuration, tools, input validation, and context options.

Key Features

  • File-based: Defined in agents/prompts/ directory
  • Auto-discovered: No manual registration required
  • Type-safe: Full TypeScript support with Zod validation
  • Composable: Prompts can be exposed as tools for other prompts
  • Hot-reloadable: Changes trigger HMR in development

Quick Start

Create a new prompt in agents/prompts/:
agents/prompts/customer_support.ts
Reference it in an agent:
agents/agents/support_agent.ts

Configuration Options

string
required
Unique identifier for this prompt. Use snake_case.
string
required
Description shown when prompt is exposed as a tool. Always required for potential tool use.
string
required
The system instructions sent to the LLM. Supports template variables using {{variableName}} syntax.
string
required
Name of the model configuration to use. Must be defined in agents/models/.
Every prompt is callable as a tool. The deprecated exposeAsTool field has no effect.
boolean
default:"false"
Include full chat history in LLM context.
boolean
default:"false"
Include past tool call results in context.
boolean
default:"false"
Allow the model to return multiple tool calls.
'auto' | 'none' | 'required'
default:"'auto'"
Tool calling strategy:
  • 'auto': LLM decides whether to use tools
  • 'none': Disable tool calling
  • 'required': Force the LLM to call at least one tool
ZodSchema
Zod schema for input validation when called as tool.
(string | SubpromptConfig | PromptToolConfig)[]
default:"[]"
Available callable names, subprompt settings, and static tool options.
An exposed agent referenced in tools performs a handoff in the current thread. Persistent child relationships belong in an owning agent side’s subagents array. Subagent relationship configuration in a prompt tool entry is a definition-time error.
string[]
Hook IDs to run when this prompt is active. References hooks by their unique id property from agents/hooks/. If not specified, falls back to agent-level hooks.
ReasoningConfig
Extended thinking configuration for models that support it.

Tools in Prompts

Tools are callable capabilities exposed to LLMs. They can be:

Functions

Custom code defined in agents/tools/

Prompts

Other prompts exposed as tools (sub-prompts)

Agents

Entire agents exposed as tools (handoffs)

Adding Tools

SubpromptConfig options

string
required
Name of the tool
boolean
default:"true"
Include text response from sub-prompt execution
boolean
default:"true"
Include tool call details from sub-prompt
boolean
default:"true"
Include error details from sub-prompt
string
Property from tool arguments to use as initial user message

PromptToolConfig options

env scopes environment values to the invocation. options contains static tool options. The deprecated tenvs alias remains available for environment values. The admin GET /api/prompts/:name response retains tools[].options unchanged. Prompt list and detail responses include the model display name in model_name. Their model_provider field contains a provider name for icon lookup.

Input Validation

Define input validation with Zod schemas:

Supported Zod Types

Note: Maximum nesting depth is 7 levels.

Extended Thinking

Configure extended thinking for models that support it:

Reasoning Options

number
A prompt can set reasoning.level from 0 to 100. An unset level uses the model’s default. Level 0 means no reasoning. Each provider maps the level to the nearest option the model declares.A prompt’s reasoning.level replaces a native effort value in providerOptions. Other providerOptions keys remain. Without a level, providerOptions apply as provided. Native effort values in a model’s providerOptions remain valid.Saved prompt input with reasoning.effort fails validation. A published package prompt with reasoning.effort loads with a warning. The runtime ignores that field.
number
Maximum tokens for reasoning (Anthropic, Google, Qwen)
boolean
default:"false"
Use reasoning internally but exclude from response
boolean
default:"true"
Send the stored reasoning of earlier assistant messages back to the model on later requests. Set false to stop sending it. The reasoning stays in the message record either way.

Exposing Prompts as Tools

Every prompt is callable as a tool:
Use in another prompt:

Sub-Prompt Execution Flow

When an LLM calls a prompt tool:
  1. Tool call received: Parent prompt receives tool call with arguments
  2. Validation: Arguments validated against requiredSchema
  3. Sub-prompt execution: New execution context created
  4. Message hierarchy: Messages stored with parent_id and depth
  5. Result rollup: Sub-prompt response returned as tool result
  6. Parent continues: Parent LLM receives result and continues

Examples

Basic Conversation

Customer Support with Tools

Data Analysis with Reasoning

Orchestrator

Type Definitions

Canonical prompt types

Import the current types from the package:
A prompt’s tools array accepts callable names, SubpromptConfig, and PromptToolConfig. SubpromptConfig controls result filters and initial message mappings. PromptToolConfig supplies scoped environment values and static options.

ReasoningConfig

PromptInput Type Helper

Extract the input type from a prompt definition:

Best Practices

File Structure

Requirements:
  • One prompt per file
  • Default export required
  • Use snake_case for file names

Models

Define model configurations

Tools

Create custom function tools

Agents

Configure agents that use prompts

Hooks

Intercept execution at various points