How Knowledge Actually Works
The Knowledge Plugin allows agents to learn from documents in three ways:- Auto-load from
docs
folder (recommended for most use cases) - Upload via Web Interface (best for dynamic content)
- Hardcode small snippets (only for tiny bits of info like “hello world”)
Basic Character Examples
Example 1: Document-Based Support Bot
Create a support bot that learns from your documentation:characters/support-bot.ts
- Load all documents from the
docs
folder - Process them into searchable chunks
- Use this knowledge to answer questions
Example 2: API Documentation Assistant
For technical documentation:characters/api-assistant.ts
Example 3: Simple Info Bot (Hello World Example)
For very basic, hardcoded information only:characters/info-bot.json
knowledge
array is only for tiny snippets. For real documents, use the docs
folder!
Real-World Setup Guide
Step 1: Prepare Your Documents
Create a well-organizeddocs
folder:
Step 2: Configure Auto-Loading
.env
Step 3: Start Your Agent
- Automatically find and load all documents
- Process PDFs, text files, markdown, etc.
- Create searchable embeddings
- Log progress: “Loaded 23 documents from docs folder on startup”
Using the Web Interface
Uploading Documents
- Start your agent:
elizaos start
- Open browser:
http://localhost:3000
- Select your agent
- Click the Knowledge tab
- Drag and drop files or click to upload
- Adding documents while the agent is running
- Uploading user-specific content
- Testing with different documents
- Managing (view/delete) existing documents
What Happens When You Upload
When you upload a document via the web interface:- The file is processed immediately
- It’s converted to searchable chunks
- The agent can use it right away
- You’ll see it listed in the Knowledge tab
How Agents Use Knowledge
Automatic Knowledge Search
When users ask questions, the agent automatically:The Knowledge Provider
The knowledge plugin includes a provider that automatically injects relevant knowledge into the agent’s context:Configuration Examples
Production Support Bot
.env
Development Setup
.env
Best Practices
DO: Use the Docs Folder
✅ Recommended approach for most use cases:DO: Use Web Upload for Dynamic Content
✅ When to use the web interface:- User-uploaded content
- Frequently changing documents
- Testing different documents
- One-off documents
DON’T: Hardcode Large Content
❌ Avoid this:Testing Your Setup
Quick Verification
-
Check the logs when starting:
-
Ask the agent about your documents:
- Use the Knowledge tab to see all loaded documents
Troubleshooting
No documents loading?- Check
LOAD_DOCS_ON_STARTUP=true
is set - Verify
docs
folder exists and has files - Check file permissions
- Ensure documents contain the information
- Try more specific questions
- Check the Knowledge tab to verify documents are loaded
Summary
- For production: Use the
docs
folder with auto-loading - For dynamic content: Use the web interface
- For tiny snippets only: Use the knowledge array
- The agent automatically searches knowledge - no special commands needed