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

# Knowledge Stack

> The foundational data layer for enterprise AI — ingest, organize, search, and chat over your documents through one API.

<div align="center">
  <img src="https://mintcdn.com/knowledgestack/98UlasllyAOneaJk/logo/knowledge-stack.png?fit=max&auto=format&n=98UlasllyAOneaJk&q=85&s=9211571a1e1a7a0f1220ff703b506194" alt="Knowledge Stack" width="360" style={{ borderRadius: "12px", margin: "0 auto" }} data-path="logo/knowledge-stack.png" />
</div>

**Build production-ready AI agents in under 1 hour.** Knowledge Stack turns a pile of documents into an AI-ready knowledge base — drop in PDFs, DOCX, PPTX, Markdown, or plaintext and get back a hierarchical, multi-tenant, permission-aware corpus with semantic search, streaming chat, and workflow-driven ingestion behind a single REST API.

<Frame caption="Knowledge Stack in 90 seconds — ingest, search, chat, cite.">
  <iframe src="https://www.loom.com/embed/PLACEHOLDER_TOUR_ID" frameBorder="0" allowFullScreen style={{ width: "100%", aspectRatio: "16 / 9", borderRadius: "12px" }} />
</Frame>

<CardGroup cols={3}>
  <Card title="Watch the tour" icon="play" href="/showcase">
    Five short videos — ingestion, agents, citations, RBAC.
  </Card>

  <Card title="Book a demo" icon="calendar" href="https://www.knowledgestack.ai/book-demo">
    30 minutes on your own corpus with a founding engineer.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    First ingest + search call in under five minutes.
  </Card>
</CardGroup>

## Pick your client

<CardGroup cols={3}>
  <Card title="Install the CLI" icon="terminal" href="/cli">
    `uv tool install kscli` — ingest, search, watch workflows from the terminal.
  </Card>

  <Card title="Python & TypeScript SDKs" icon="code" href="/sdks/overview">
    `pip install ksapi` · `npm install @knowledge-stack/ksapi` — fully typed.
  </Card>

  <Card title="MCP server" icon="plug" href="/sdks/mcp-server">
    Drop into LangGraph, Claude Desktop, Cursor, or any MCP-compatible host.
  </Card>

  <Card title="Cookbook" icon="book-open" href="https://github.com/knowledgestack/ks-cookbook">
    Runnable recipes — RAG, citations, bulk ingest, evals, agent workflows.
  </Card>

  <Card title="API Reference" icon="square-terminal" href="/api-reference">
    Every endpoint, request, and response — generated from `openapi.yaml`.
  </Card>

  <Card title="Architecture" icon="diagram-project" href="/architecture">
    How ingestion, search, threads, and Temporal fit together.
  </Card>
</CardGroup>

## Install in 30 seconds

<CodeGroup>
  ```bash CLI theme={null}
  uv tool install kscli
  kscli login --api-key sk-user-...
  ```

  ```bash Python theme={null}
  pip install ksapi
  ```

  ```bash TypeScript theme={null}
  npm install @knowledge-stack/ksapi
  ```

  ```bash MCP theme={null}
  uv tool install ks-mcp
  ```
</CodeGroup>

## Your first call

Ingest a document and run a semantic search. Pick your tool — every example targets the same endpoints.

<CodeGroup>
  ```bash kscli theme={null}
  kscli documents ingest --file report.pdf --path-part-id <folder-path-part-id>
  kscli chunks search --query "key findings" --limit 5
  ```

  ```python Python theme={null}
  from ksapi import KSApi

  ks = KSApi(api_key="sk-user-...")
  ks.documents.ingest(file=open("report.pdf", "rb"), parent_path_part_id="...")
  hits = ks.chunks.search(query="key findings", top_k=5)
  for h in hits:
      print(f"[{h.score:.2f}] {h.content[:120]}")
  ```

  ```typescript TypeScript theme={null}
  import { KSApi } from "@knowledge-stack/ksapi";

  const ks = new KSApi({ apiKey: "sk-user-..." });
  await ks.documents.ingest({
    file: fs.createReadStream("report.pdf"),
    parentPathPartId: "...",
  });
  const hits = await ks.chunks.search({ query: "key findings", topK: 5 });
  hits.forEach((h) => console.log(`[${h.score.toFixed(2)}] ${h.content.slice(0, 120)}`));
  ```

  ```bash curl theme={null}
  curl -X POST https://api.knowledgestack.ai/v1/documents/ingest \
    -H "Authorization: Bearer sk-user-..." \
    -F "file=@report.pdf" \
    -F "parent_path_part_id=<folder-path-part-id>"

  curl -X POST https://api.knowledgestack.ai/v1/chunks/search \
    -H "Authorization: Bearer sk-user-..." \
    -H "Content-Type: application/json" \
    -d '{"query": "key findings", "top_k": 5}'
  ```
</CodeGroup>

## What you can build

| Use case                                    | Building blocks                                                            |
| ------------------------------------------- | -------------------------------------------------------------------------- |
| **AI search across thousands of documents** | `/v1/documents/ingest` → `/v1/chunks/search` (dense, full-text, or hybrid) |
| **Document Q\&A with cited answers**        | `/v1/threads` + `/v1/threads/{id}/stream` (SSE, document-anchored)         |
| **Multi-tenant SaaS knowledge bases**       | Tenant isolation, three roles (Owner / Admin / User), path-level grants    |
| **Internal RAG agents**                     | MCP server plus `ks-cookbook` recipes for LangGraph, OpenAI Agents, CrewAI |
| **Bulk ingestion pipelines**                | `kscli folders bulk-ingest` + Temporal-backed background workflows         |

## See it in action

Knowledge Stack ships a reference workspace UI so your team (and your customers) can ingest, search, and chat without writing a single line of frontend code.

<Frame caption="The Knowledge Stack workspace — chat history, project file tree, search, and a single composer for ingest + chat.">
  <img src="https://mintcdn.com/knowledgestack/98UlasllyAOneaJk/images/workspace-home.png?fit=max&auto=format&n=98UlasllyAOneaJk&q=85&s=dea8c3b4fe0da89f2a0df6945dc09993" alt="Knowledge Stack workspace home with sidebar of chats and files" width="2984" height="1688" data-path="images/workspace-home.png" />
</Frame>

<Frame caption="Every assistant response carries grounded numeric citations that link back to the exact source chunk and page.">
  <img src="https://mintcdn.com/knowledgestack/98UlasllyAOneaJk/images/citations-in-chat.png?fit=max&auto=format&n=98UlasllyAOneaJk&q=85&s=9090d376089f12ae5bf3b0cfd550d1bf" alt="Knowledge Stack chat showing inline citations on each fact in a SCADA report summary" width="3018" height="1706" data-path="images/citations-in-chat.png" />
</Frame>

Built-in **citations** are a core primitive — not a bolt-on. See the [Citations guide](/citations) for the SSE event shape, how to render badges, and how to resolve a citation back to its bounding box on the PDF.

## How the system fits together

<Frame>
  ```
  ┌──────────┐   upload   ┌──────────────┐   chunks    ┌────────────┐
  │  Client  │ ─────────► │  /documents  │ ──────────► │  Temporal  │
  └──────────┘            └──────────────┘             │  worker    │
        ▲                                              └─────┬──────┘
        │ search / chat / stream                             │ embed
        │                                                    ▼
  ┌──────────────┐    rank/filter    ┌──────────────┐  ┌──────────┐
  │  /chunks/    │ ◄──────────────── │   Postgres   │  │  Qdrant  │
  │   search     │                   │  (metadata)  │  │ (vectors)│
  └──────────────┘                   └──────────────┘  └──────────┘
  ```
</Frame>

Read the full picture in [Architecture](/architecture). Key concepts: the [path system](/path-system) (everything is a node in a Unix-style tree), [authentication](/authentication) (cookie or API key), and [authorization](/authorization) (path-level grants).

## Where to next

<CardGroup cols={3}>
  <Card title="Quickstart" icon="play" href="/quickstart">First ingest + search</Card>
  <Card title="Architecture" icon="diagram-project" href="/architecture">System overview</Card>
  <Card title="Path system" icon="folder-tree" href="/path-system">How content is organized</Card>
  <Card title="Ingestion pipeline" icon="conveyor-belt" href="/ingestion">Conversion, chunking, embedding</Card>
  <Card title="Semantic search" icon="magnifying-glass" href="/semantic-search">Dense, full-text, hybrid</Card>
  <Card title="Threads & streaming" icon="comments" href="/threads">Chat with citations</Card>
</CardGroup>

***

## Talk to us

<CardGroup cols={2}>
  <Card title="Book a demo" icon="calendar" href="https://www.knowledgestack.ai/book-demo">
    Walk through Knowledge Stack on your own data with a founding engineer.
  </Card>

  <Card title="Contact sales" icon="envelope" href="mailto:sales@knowledgestack.ai">
    Pricing, enterprise SSO, on-prem, and procurement questions.
  </Card>
</CardGroup>
