---
title: ".ask()"
description: "Request validated structured output from the configured model adapter."
---

> Documentation Index
> Fetch the complete documentation index at: https://xsaf.ilha.build/llms.txt
> Use this file to discover all available pages before exploring further.

# .ask()

## Signature

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

## Usage

```ts
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()`](/xsaf/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.

Source: https://xsaf.ilha.build/xsaf/ask/index.mdx
