# Engines (/docs/docklee/engines)
An assistant should answer only from content it's meant to see. An engine makes that explicit. It holds no data of its own and reads only from the sources you link to it, so its sources decide exactly what it can answer from.

A support engine and a sales engine can share some sources and keep others apart, with each source connected only once.

<Callout type="info" title="Create a separate engine when...">
- Two assistants should answer from different content.
- You want a new vector dimension without touching an engine in use.
- A team needs its own engine with its own API key.
</Callout>

## How it works [#how-it-works]

1. **Create the engine.** In the [Docklee dashboard](https://app.docklee.com), open **Knowledge Engines** and create one. Copy its ID.
2. **Link sources.** Open the engine's **Sources** tab and add sources from your library, including any API/SDK Feed your code writes to. Linking a source that's already linked changes nothing, so it's safe to repeat.
3. **Read through Lynk.** Pass the engine ID to `Lynk`, or set it in the environment.

```bash
export DOCKLEE_ENGINE_ID="your-engine-id"
```

## One vector dimension per engine [#one-vector-dimension-per-engine]

The first vector source you link sets the engine's dimension. Later vector sources must match it, and a mismatch fails with `409`.

<Callout type="warn">
To use a different dimension, remove the engine's vector sources first or create a new engine. OKF sources have no dimension, so you can link them to any engine alongside its vector sources.
</Callout>

## Read from an engine [#read-from-an-engine]

`Lynk` reads from one engine per call:

<CodeTabs>
  <Tab value="Python">
    ```python
    from docklee import Lynk

    lynk = Lynk(engine_id="your-engine-id")

    answer = lynk.query_sync("What is the refund window?")
    chunks = lynk.retrieve_sync("refund window", top_k=5)
    ```
  </Tab>
  <Tab value="TypeScript">
    ```ts
    import { Lynk } from 'docklee';

    const lynk = new Lynk({ engineId: 'your-engine-id' });

    const answer = await lynk.query('What is the refund window?');
    const chunks = await lynk.retrieve('refund window', { topK: 5 });
    ```
  </Tab>
  <Tab value="cURL">
    ```bash
    curl https://api.docklee.com/v1/engine/retrieve \
      -H "Authorization: Bearer $DOCKLEE_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"engine_id": "your-engine-id", "query": "refund window", "top_k": 5}'
    ```
  </Tab>
</CodeTabs>

| Method | `top_k` default | `top_k` range |
| --- | --- | --- |
| `query` | 8 | 1 to 50 |
| `retrieve` | 8 | 1 to 100 |

Pass `engine_id` (Python) or `engineId` (TypeScript) to one call to read from a different engine. Calling `query` or `retrieve` with no engine ID raises an error that names the missing setting.

## Control access [#control-access]

A key reaches every engine in your workspace until you narrow it to selected engines. See [API keys](/docs/docklee/api-keys).

## Next steps [#next-steps]

Your engine is reading its sources. Learn the read methods next.

<Cards>
  <Card title="Query an engine" href="/docs/knowledge/query-an-engine" description="Answers with citations, and streaming." />
  <Card title="Sources" href="/docs/docklee/sources" description="Connect what an engine reads." />
  <Card title="Containers" href="/docs/docklee/containers" description="Vector and OKF, and how dimensions work." />
</Cards>
