> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic Data Stack

> Agentic analytics on ClickHouse: fully managed in ClickHouse Cloud, or self-hosted as an open-source stack of ClickHouse, the MCP server, LibreChat, and Langfuse.

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

The easiest way to run agentic analytics on ClickHouse is [ClickHouse Agents](/products/cloud/features/ai-ml/agents) in ClickHouse Cloud: fully managed, with no infrastructure to run. Users ask questions in plain language, and an AI agent answers by querying the database directly.

To self-host, the **Agentic Data Stack** is a composable open-source stack. You run it yourself, connect your own models, and keep your chat and data in your own environment. It's built from [ClickHouse](/core/get-started/setup/install), the [ClickHouse MCP server](/products/agentic-data-stack/components/mcp-server), [LibreChat](/products/agentic-data-stack/components/librechat), and [Langfuse](/products/agentic-data-stack/components/langfuse).

<h2 id="what-is-agentic-analytics">
  What is agentic analytics?
</h2>

In agentic analytics, the model grounds its answers by running queries against your data. Given a question, the agent inspects the available databases and tables, decides which queries to run, executes them against ClickHouse, and builds an answer from the results. It can refine a query, run a follow-up, or chain several steps together. When a query fails or returns something unexpected, it adjusts and tries again instead of stopping.

<h2 id="what-you-can-do">
  What you can do
</h2>

* **Ask questions in natural language** and get answers drawn from your own data.
* **Build agents with no code** by giving an agent instructions and tools, then reusing it.
* **Share agents and conversations** as read-only links, so others can trace the queries behind an answer.
* **Generate interactive charts and visualizations** from query results inside a conversation.
* **Evaluate and improve answers** by scoring responses in Langfuse with human review or an LLM judge, and refining your prompts and agents.

<h2 id="architecture">
  How the stack fits together
</h2>

<Image img="https://mintcdn.com/private-7c7dfe99-fix-nav-issues/Y9kcWM6RbYppspJn/images/agentic-data-stack/01-architecture.webp?fit=max&auto=format&n=Y9kcWM6RbYppspJn&q=85&s=6ef912fef941753af5f0b9799353fc38" alt="Agentic Data Stack architecture: users interact with LibreChat, which connects to an LLM, to ClickHouse through the MCP server, and to Langfuse for tracing" size="md" width="945" height="784" data-path="images/agentic-data-stack/01-architecture.webp" />

A user asks a question in LibreChat. The model plans a response and, through the MCP server, calls tools to explore and query ClickHouse. Results flow back, and the agent composes an answer. Langfuse, built on OpenTelemetry, records each run from prompt to tool call to response, lets you score outputs automatically or with human review, and tracks quality, cost, and latency.

The ClickHouse MCP server is built on the [Model Context Protocol](https://modelcontextprotocol.io/), an open standard, so it works with any MCP-compatible client or agent framework, not only LibreChat. See the [MCP guides](/core/guides/use-cases/ai-ml/MCP) for clients and agent libraries.

<h2 id="components">
  Components
</h2>

| Component             | Role                                                            | Learn more                                                       |
| --------------------- | --------------------------------------------------------------- | ---------------------------------------------------------------- |
| ClickHouse            | The analytical engine the agent queries                         | [Get started with ClickHouse](/core/get-started/setup/install)   |
| ClickHouse MCP server | The open standard that exposes ClickHouse to the agent as tools | [MCP server](/products/agentic-data-stack/components/mcp-server) |
| LibreChat             | The chat and agent front-end users interact with                | [LibreChat](/products/agentic-data-stack/components/librechat)   |
| Langfuse              | Observability for every prompt, tool call, and response         | [Langfuse](/products/agentic-data-stack/components/langfuse)     |

<h2 id="get-started">
  Get started
</h2>

There are two ways to run agentic analytics on ClickHouse:

* **Managed (ClickHouse Cloud):** the fastest path, with no setup. [ClickHouse Agents](/products/cloud/features/ai-ml/agents) provides hosted chat and agents over your data. The individual pieces are also available managed: the [Remote MCP server](/products/cloud/features/ai-ml/remote-mcp) and [Langfuse Cloud](https://cloud.langfuse.com).
* **Self-hosted (open source):** run the full stack yourself with [Docker Compose](/products/agentic-data-stack/docker-setup), connecting your own models and keeping your data in your environment.

To try the stack against public datasets without installing anything, use [AgentHouse](https://llm.clickhouse.com), the hosted demo.

<h2 id="related">
  Related
</h2>

Other open-source AI capabilities on ClickHouse:

* [AI-powered SQL generation](/core/guides/use-cases/ai-ml/ai-powered-sql-generation): natural-language to SQL in ClickHouse Client and clickhouse-local
* [Vector search with QBit](/core/guides/use-cases/ai-ml/vector-search): runtime-tunable vector search
