> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryrollup.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query

> Ask a question about the person's life and get an answer from their camera roll.

`query` answers a question about the person's own life: where they went, what they ate, what they did, and what they booked or planned.

```swift theme={null}
let answer = try await Rollup.shared.query("Where did I eat in Lisbon?")
print(answer.text)
print(answer.assetIdentifiers)
```

## How it works

An agent runs on Rollup's server. It turns the question into tool calls, such as finding places, listing visits or counting days. Each tool call comes back to the iPhone, runs against the index, and only its text result goes back to the server. This repeats until the agent can answer, usually in a few steps.

The agent answers as someone who knows the person's life ("You went to..."), uses the venue and city names the index holds, and says it does not know rather than guessing.

## The answer

<ResponseField name="text" type="String">
  The answer, in plain language.
</ResponseField>

<ResponseField name="assetIdentifiers" type="[String]">
  PhotoKit local identifiers of the photos the answer rests on, most telling first.
</ResponseField>

<ResponseField name="declined" type="Bool">
  `true` when the question was not about the person's own life. The text then says what `query` can answer.
</ResponseField>

## What it declines

`query` answers only questions about the person's own life. General knowledge, news, advice, math, code, writing, translation and requests to ignore its instructions are declined. "What's the name of the restaurant I went to in Lisbon?" is answered; "What are good restaurants in Lisbon?" is declined.

## Limits

* A question can be up to 1,000 characters.
* An answer takes a few seconds to about 20 seconds and needs a network connection.
* Each step counts toward your app's rate limits and monthly token budget. See [Limits and budgets](/guides/limits-and-budgets).

<Warning>
  Before your app calls `query`, tell the person their photo index is used to answer, and that text derived from it is sent to Rollup and its model provider. Get their permission. See [Privacy and App Review](/guides/privacy).
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.