# Qdrant recipe

URL: https://briq.cloud/cookbook/qdrant

> A vector database, for a knowledge file the agent can search by meaning, not grep.

Tags: database, vector, ai

Guide:

- [Connect to a database from outside](https://briq.cloud/docs/guides/connect-to-a-database-from-outside.md): A briq's database reachable from psql, a BI tool or an app elsewhere, over TLS, with a normal connection string.

## Run it

MCP:

```ts
briq_run({
  recipe: "qdrant",
  params: {
    "size": "small",
    "diskGb": 2
  },
  wait: true
})
```

REST:

```bash
curl -X POST https://api.briq.cloud/v1/briqs \
  -H "Authorization: Bearer $BRIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipe": "qdrant",
    "params": {
      "size": "small",
      "diskGb": 2
    },
    "wait": true
  }'
# → { "briqs": [{ "id": "bq_…", … }], "outputs": { "QDRANT_URL": "…" }, … }

# ... when done, for each briq id
curl -X DELETE https://api.briq.cloud/v1/briqs/<id> \
  -H "Authorization: Bearer $BRIQ_API_KEY"
```

## Parameters

| Name | Type | Options | Default | What it does |
| --- | --- | --- | --- | --- |
| `size` | enum | nano, small, medium, large | "small" | — |
| `diskGb` | number | — | 2 | Volume size, in GB |

## Outputs

Returned by `briq_run` once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

| Output | Value |
| --- | --- |
| `QDRANT_URL` | `http://qdrant.<stack>.internal:6333` |
| `QDRANT_GRPC_URL` | `http://qdrant.<stack>.internal:6334` |
| `QDRANT_API_KEY` | `<QDRANT_API_KEY>` |

## What it runs

| Briq | Image | Ports | Size | Volume |
| --- | --- | --- | --- | --- |
| qdrant | `qdrant/qdrant:latest` | 6333, 6334 | small | 2 GB at /qdrant/storage |

## When to use it

* The agent's context is a growing pile of documents or past runs, and keyword search misses what
  is phrased differently.
* You are building or testing RAG and need real upsert, filtering and nearest-neighbour search.
* The agent should store what it learns and query it back by meaning.

## Tips

* **Send the API key** on every request: `api-key: <QDRANT_API_KEY>`.
* **gRPC for bulk upserts** (`QDRANT_GRPC_URL`); REST (`QDRANT_URL`) for queries.
* **gRPC from outside**: `briq_expose` port 6334 with `protocol: "grpc"`, then send the API key.
  See [Connect to a database from outside](https://briq.cloud/docs/guides/connect-to-a-database-from-outside).
* **Create collections first**: `PUT /collections/<name>` with the vector size and distance.
* **Dashboard**: `briq_expose` port 6333 with `mode: "private"` (the briq restarts to publish it),
  then open `/dashboard`.
* **Many vectors?** The volume starts small: pass `diskGb`, e.g. `params: { diskGb: 20 }`. Set it
  when the briq is created, and it counts toward your [plan's disk](https://briq.cloud/docs/cost#plans).
