Skip to content
Français

defineTextResponse

import { defineTextResponse } from "@elie-laloum/outpost/core";

Declare a text response with automatic tagged final-answer instructions. Returns the trimmed content of the last complete tag pair; missing tags fail with ResponseError. Invalid tags or repair counts fail with code configuration. Exact injected text and customization limits.

Complete example and detailed rules.

  • optionsRequired
    TextResponseOptions
    Tag used by automatic final-answer instructions and allowed repair turns.
  • options.tagRequired
    string
    Tag name without angle brackets: a letter followed by letters, digits, _ or -. Another form fails with code configuration.
  • options.repairsOptional
    number | undefined
    Correction turns allowed after an invalid answer, default 0; must be a nonnegative integer. Above 0, the agent must be able to resume its conversation. Exact injected text and customization limits.

ResponseSpec<string>

export declare function defineTextResponse(
  options: TextResponseOptions,
): ResponseSpec<string>;