Prerequisites
- ManyLayers running with a workspace license
- An embedding model provider configured (e.g.,
text-embedding-3-smallvia your OpenAI provider) - A chat model configured (e.g.,
gpt-4o)
Steps
Create a knowledge base
A knowledge base stores your documents as vector embeddings for semantic search. Give it a name and select the embedding model to use.From the workspace UI: go to Knowledge Bases → New knowledge base, choose a name and embedding model.Via API:Save the returned
kb_id.Upload your documents
Upload files directly, or connect a data source. ManyLayers chunks documents automatically and generates embeddings in the background.You can also connect live data sources (Confluence, Notion, Google Drive, SharePoint) so the knowledge base stays updated automatically. See Connectors for setup.Check indexing progress:
Test the search
Before connecting to an agent, verify that search is returning relevant results:If results are poor, check that documents have finished indexing and consider adjusting the chunk size in the knowledge base settings.
Create a workspace agent with the knowledge base
In the workspace UI, go to Agents → New agent. Select your chat model, attach your knowledge base, and configure the system prompt to instruct the agent to ground its answers in the retrieved documents.Example system prompt:Enable the knowledge base as a tool for this agent.
Query via chat
Open the workspace chat, select your agent, and ask questions about your documents:The agent automatically retrieves relevant document chunks, passes them as context to the chat model, and cites its sources.You can also query programmatically using the standard chat completions API with the agent ID:
Improving search quality
If answers aren’t grounded well in your documents, try these adjustments:- Enable reranking — add a reranker model to the knowledge base settings to improve result relevance
- Adjust chunk size — smaller chunks (256-512 tokens) work better for specific factual lookups; larger chunks (1024+) work better for summaries
- Add more documents — the more complete your knowledge base, the better coverage you get
- Use web search as a fallback — enable web search alongside the knowledge base so the agent can answer questions not covered by your documents
Next steps
- Connect live data sources with Connectors
- Set up Evals to measure answer quality over time
- Run canary routing to test different models for your RAG pipeline