Knowledge

AgentBackend's knowledge base lets you upload documents and URLs to give your agents long-term memory. Documents are automatically chunked, embedded, and stored for RAG retrieval. When attached to an agent, relevant chunks are injected into the agent's context at runtime.

Looking for structured data? Knowledge is for unstructured documents (PDFs, URLs). For structured business data (tables, rows, SQL queries), see Agent Data Store.

Supported Formats

Binary

PDFDOCXXLSXPPTXRTF

Text

TXTCSVMarkdownHTMLXMLJSONYAMLSQL

Image (AI text extraction)

PNGJPG/JPEGWEBPGIF

Max file size: 10 MB per file. Up to 5 files per request when using run/with-files.

Upload Documents

Upload files to your knowledge base via the REST API or the Python SDK.

REST API
curl -X POST https://api.agentbackend.ai/v1/knowledge/upload \
  -H "Authorization: Bearer ak_..." \
  -F "file=@manual.pdf"
Python SDK
doc = ab.knowledge.upload("agent_id", "manual.pdf")
ab.knowledge.wait_for_ready(doc.id)
JavaScript SDK
const doc = await ab.knowledge.upload('agent_id', 'manual.pdf');
await ab.knowledge.waitForReady(doc.id);

Ingest from URL

Provide a URL and AgentBackend will fetch, parse, and ingest the content automatically.

cURL
curl -X POST https://api.agentbackend.ai/v1/knowledge/url \
  -H "Authorization: Bearer ak_..." \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/docs"}'
JavaScript SDK
const doc = await ab.knowledge.ingestUrl('agent_id', 'https://example.com/docs');

Attach / Detach

Once a document is processed, attach it to one or more agents. Detach it when it's no longer needed.

cURL
# Attach document to agent
curl -X POST https://api.agentbackend.ai/v1/agents/:id/knowledge/:doc_id \
  -H "Authorization: Bearer ak_..."

# Detach document from agent
curl -X DELETE https://api.agentbackend.ai/v1/agents/:id/knowledge/:doc_id \
  -H "Authorization: Bearer ak_..."
JavaScript SDK
// Attach document to agent
await ab.knowledge.attach('agent_id', 'doc_id');

// Detach document from agent
await ab.knowledge.detach('agent_id', 'doc_id');

Check Status

Documents go through three stages: uploading processing ready (or failed).

cURL
curl https://api.agentbackend.ai/v1/knowledge/:id/status \
  -H "Authorization: Bearer ak_..."
JavaScript SDK
const status = await ab.knowledge.status('doc_id');
console.log(status);

Pipeline Flow

Here's how the RAG pipeline works end to end:

1

Upload file or URL

2

Document is parsed and chunked

3

Chunks are embedded (vector embeddings)

4

Attach document to agent

5

On each run, relevant chunks are retrieved and injected into context

Storage Limits

PlanKnowledge Base
Free50 MB
Pro1 GB
EnterpriseCustom