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

# Multi-Doc Agent Deploy

> Deploy a completion endpoint over multiple extracted PDFs.

## Overview

The runtime SDK is intentionally session-first. For multi-doc agent deploy, use sessions for ingestion and the deploy HTTP endpoint for orchestration.

## SDK + HTTP flow

```ts theme={null}
import { createOkra } from '@okrapdf/runtime';

const okra = createOkra({ apiKey: process.env.OKRA_API_KEY });

const [a, b] = await Promise.all([
  okra.sessions.create('./nvidia-10k.pdf', { wait: true }),
  okra.sessions.create('./amd-10k.pdf', { wait: true }),
]);

const response = await fetch('https://api.okrapdf.com/api/agents/deploy', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.OKRA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    documentIds: [a.id, b.id],
    name: 'gpu-comparison',
    documents: [
      { jobId: a.id, fileName: 'NVIDIA 10-K' },
      { jobId: b.id, fileName: 'AMD 10-K' },
    ],
  }),
});

const agent = await response.json();
console.log(agent.url, agent.token);
```

`documents[].jobId` is legacy field naming on the deploy endpoint. It currently expects document IDs under that key. `documentIds` remains canonical for the top-level list.

## Curl flow

```bash theme={null}
curl -X POST "https://api.okrapdf.com/api/agents/deploy" \
  -H "Authorization: Bearer $OKRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "documentIds":["ocr_doc_a","ocr_doc_b"],
    "name":"gpu-comparison"
  }'
```

Query the returned `url` with the returned bearer token:

```bash theme={null}
curl -X POST "https://api.okrapdf.com/v1/agents/gpu-comparison-xxxxxx/completion" \
  -H "Authorization: Bearer agt_..." \
  -H "Content-Type: application/json" \
  -d '{"query":"Compare revenue growth between NVIDIA and AMD"}'
```

## Notes

* Deploy URLs are content-addressed by document set.
* Same document set reuses the same slug.
* Different document set yields a new slug.
