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

# Agent runtime

> How Quick chats, Deep chats, and agents use the shared grounded-answer runtime.

Chats and agents run on the same grounded-answer runtime. The runtime combines conversation context, knowledge-base retrieval, connected data, memory, and tools, then cites supporting sources whenever retrieval finds them.

## Quick and Deep modes

<CardGroup cols={2}>
  <Card title="Quick" icon="bolt">
    A fast, single-pass path for direct questions. It retrieves relevant knowledge-base content and returns an answer with minimal orchestration.
  </Card>

  <Card title="Deep" icon="brain">
    A multi-step agent loop for questions that need repeated searches, connected data, charts, apps, tools, or delegation.
  </Card>
</CardGroup>

**Saved agents always run in Deep mode.** Chats can select `quick` or `deep` with the `agent_mode` request field.

## The Deep agent loop

<Steps>
  <Step title="Plan">
    The model interprets the message, available context, and tool catalog, then chooses the next useful action.
  </Step>

  <Step title="Call a tool">
    It can search the knowledge base, run read-only SQL, build a chart, call a connected app or custom tool, use an MCP server, or delegate to another agent.
  </Step>

  <Step title="Observe">
    Tool results return to the model as grounded context. The model can refine its plan and call another tool when needed.
  </Step>

  <Step title="Answer">
    The loop ends with a final answer and cites sources whenever retrieval produced supporting passages. A configurable step limit keeps the run bounded.
  </Step>
</Steps>

## Runtime capabilities

| Capability                           | Quick                                    | Deep                                     |
| ------------------------------------ | ---------------------------------------- | ---------------------------------------- |
| Knowledge-base retrieval             | Single-pass                              | Repeated, agent-directed searches        |
| Source citations                     | When retrieval finds supporting passages | When retrieval finds supporting passages |
| Read-only connected database queries | —                                        | Yes                                      |
| Charts from connected data           | —                                        | Yes                                      |
| Connected apps and custom tools      | —                                        | Yes                                      |
| MCP tools                            | —                                        | Yes                                      |
| Agent delegation                     | —                                        | Yes                                      |

<Note>
  The exact tools available in a Deep run depend on the knowledge base, chat, or agent configuration and the caller's access. Connected apps must be authenticated before the runtime can use them.
</Note>

## Streaming a run

Streaming endpoints expose the run as it happens. Events can include progress, tool activity, final-response content, sources, charts, token usage, completion, and errors. The main runtime normally emits one canonical `final_response` with `isComplete: true`; clients should also support partial `final_response` events and accumulate their `content` for protocol compatibility.

The non-streaming endpoints use the same runtime and return after the final result is ready. See [Chat lifecycle](/developers/lifecycles/chat-lifecycle) and [Chat & streaming](/developers/guides/chat-and-stream) for request and event details.

## Grounding and context

The runtime does not place the entire document corpus into the prompt. Instead, it receives a short preview of available content, searches at run time, and adds the retrieved passages as tool results. Conversation summaries and durable memory are separate context layers.

Read [Prompt assembly](/developers/concepts/prompt-assembly) for precedence and [RAG lifecycle](/developers/lifecycles/rag) for retrieval behavior.

## Next steps

<CardGroup cols={2}>
  <Card title="Prompt assembly" icon="layer-group" href="/developers/concepts/prompt-assembly">
    Understand prompt layers, memory, history, and custom overrides.
  </Card>

  <Card title="RAG lifecycle" icon="magnifying-glass" href="/developers/lifecycles/rag">
    Follow a knowledge-base search from query to cited source.
  </Card>
</CardGroup>
