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
Text
Image (AI text extraction)
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.
curl -X POST https://api.agentbackend.ai/v1/knowledge/upload \
-H "Authorization: Bearer ak_..." \
-F "file=@manual.pdf"doc = ab.knowledge.upload("agent_id", "manual.pdf")
ab.knowledge.wait_for_ready(doc.id)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 -X POST https://api.agentbackend.ai/v1/knowledge/url \
-H "Authorization: Bearer ak_..." \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/docs"}'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.
# 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_..."// 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 https://api.agentbackend.ai/v1/knowledge/:id/status \
-H "Authorization: Bearer ak_..."const status = await ab.knowledge.status('doc_id');
console.log(status);Pipeline Flow
Here's how the RAG pipeline works end to end:
Upload file or URL
Document is parsed and chunked
Chunks are embedded (vector embeddings)
Attach document to agent
On each run, relevant chunks are retrieved and injected into context
Storage Limits
| Plan | Knowledge Base |
|---|---|
| Free | 50 MB |
| Pro | 1 GB |
| Enterprise | Custom |