Skip to content

definePrompt

Reference for prompt configuration and callable tools

Signature

import { definePrompt } from '@standardagents/spec';

export default definePrompt({
  name: 'asset_orchestrator',
  toolDescription: 'Coordinates asset generation.',
  prompt: 'Use the available tools to process the request.',
  model: 'base_model',
  includeChat: true,
  includePastTools: true,
  tools: [
    {
      name: 'generate_asset',
      env: { ASSET_STYLE: 'topdown' },
      options: { format: 'png' },
    },
  ],
});

Import the canonical types from the package:

import type {
  PromptDefinition,
  PromptToolConfig,
  SubpromptConfig,
} from '@standardagents/spec';

includeChat and includePastTools each default to false. Set includePastTools: true when later steps must read tool results. includeChat: true does not include tool history by itself.

Prompt tools

Form Fields
Callable name A tool, prompt, or exposed agent name.
PromptToolConfig name, env, options.
SubpromptConfig name, result filters, initial message mappings.

PromptToolConfig.options contains static tool options. PromptToolConfig.env scopes environment values to the invocation. The deprecated tenvs alias remains available for environment values. The admin prompt detail response preserves options unchanged.

SubpromptConfig supports includeTextResponse, includeToolCalls, and includeErrors. Each filter defaults to true. initUserMessageProperty selects the initial message argument. initAttachmentsProperty selects attachment arguments.

Persistent subagents

Declare child relationships in an agent side's subagents array. A prompt tool entry cannot configure a subagent relationship. The runtime injects lifecycle tools for enabled relationships. The child's side A prompt schema defines its invocation arguments. Those arguments persist as ThreadState.arguments.

Attachment mappings

Mapped attachments are validated in the parent thread. The runtime copies them into the child filesystem. The child receives paths local to its own filesystem.