Skip to content

.ask()

Request validated structured output from the configured model adapter.

Updated View as Markdown

Signature

agent.ask<Output>(
  prompt: string,
  schema: StandardSchemaV1<unknown, Output>,
  sessionId?: string,
): Promise<Output>

Usage

const summary = await agent.ask("Return a project summary", projectSummarySchema, "customer-42");

The configured model adapter must implement ask(). XSAF validates through that adapter, then saves the user prompt and JSON-stringified output to session memory.

The schema is a Standard Schema V1 validator. Unlike schemas passed to .tool(), structured-output schemas do not need to publish Standard JSON Schema through XSAF’s tool contract.

The agent must be started before calling .ask(). Model and memory errors reject the request.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close