
What are Agents?
Think of agents as AI personas you create for specific tasks:Custom Knowledge
Give agents access to specific documents or your entire knowledge base
Unique Personality
Define behavior, tone, and expertise through custom system prompts
Specialized Tools
Enable specific capabilities like code execution, image generation, or web search
Shareable
Share agents with teammates or the community
Example Use Cases
- Research Assistant
- Creative Writing Partner
- Code Reviewer
- Personal Tutor
Agent Name: Academic ResearcherPersonality:Knowledge: Research papers, academic notes, journal articlesTools: Online search, code execution for data analysis
Exploring Existing Agents
Khoj Cloud provides pre-built agents you can use immediately:Visit Agents Page
Navigate to app.khoj.dev/agents
Browse Available Agents
Explore agents by category:
- Productivity: Task planners, email assistants, meeting summarizers
- Learning: Tutors, quiz generators, concept explainers
- Creative: Writers, brainstormers, ideation partners
- Technical: Code helpers, debuggers, documentation writers
Creating Your Own Agent (Cloud)
Agent creation on Khoj Cloud may require a subscription. Check pricing for details.
Access Agent Builder
On the agents page, click “Create New Agent”
Configure Basic Details
Name: Choose a descriptive nameAvatar: Upload an image or use an emojiDescription: Brief summary of what the agent does
Define Personality
Write a system prompt that describes:
- The agent’s role and expertise
- How it should communicate (tone, style)
- What it should prioritize or avoid
- Any specific behaviors or constraints
Example Personality Prompt
Example Personality Prompt
Select Knowledge Base
Choose which documents the agent can access:
- All files: Agent can search your entire knowledge base
- Specific folders: Limit to relevant document collections
- No files: Agent relies only on general knowledge
Enable Tools
Toggle capabilities:
- ☑️ Online Search: Real-time web research
- ☑️ Image Generation: Create visuals
- ☑️ Code Execution: Run Python scripts
- ☑️ Document Search: Access knowledge base
Choose AI Model
Select the underlying language model:
- GPT-4: Most capable, best reasoning
- Claude: Strong at analysis and writing
- GPT-3.5: Faster, more economical
- Gemini: Good balance of speed and quality
Set Visibility
- Private: Only you can use this agent
- Public: Share with the Khoj community
- Team: Share with workspace members (Enterprise)
Creating Agents (Self-Hosted)
Self-hosted users create agents via the admin panel:Configure Agent
Required fields:
- Name: Agent identifier
- Personality: Your custom system prompt
- Chat model: Select configured chat model
- Public: Check to make available to all server users
- Creator: Set to limit access to specific user
- Managed by admin: Check if admin-controlled
Writing Effective Personalities
Craft system prompts that guide agent behavior:Be Specific About Role
Be Specific About Role
Instead of:Try:
Define Communication Style
Define Communication Style
Examples:
Set Clear Boundaries
Set Clear Boundaries
Specify what the agent should NOT do:
Include Process Guidelines
Include Process Guidelines
Tell the agent HOW to approach tasks:
Use Examples
Use Examples
Show desired output format:
Agent Best Practices
Single Purpose
Create focused agents for specific tasks rather than generalists
Test Thoroughly
Have multiple conversations to ensure consistent behavior
Iterate
Refine personality based on actual usage and edge cases
Document Usage
Include usage instructions in the agent description
Switching Between Agents
- Web
- Obsidian
Each agent maintains separate conversation history. Switching agents starts fresh context.
Agent vs. Slash Commands
When to use each:| Feature | Agents | Slash Commands |
|---|---|---|
| Customization | Full personality control | Fixed behavior |
| Persistence | Consistent across conversations | One-time modifier |
| Knowledge | Can have specific document access | Uses default search |
| Best For | Ongoing specialized tasks | Quick one-off changes |
Advanced: Agent Chaining
Use multiple agents in sequence for complex workflows:Troubleshooting Agents
Agent not following instructions
Agent not following instructions
Solutions:
- Make personality more explicit and detailed
- Add examples of desired behavior
- Include negative examples (“Don’t do X”)
- Try a more capable base model (GPT-4 vs GPT-3.5)
Agent responses too generic
Agent responses too generic
Solutions:
- Ensure agent has access to relevant knowledge base
- Add more specific domain expertise to personality
- Include technical terminology in system prompt
Agent can't access my documents
Agent can't access my documents
Solutions:
- Verify document search is enabled in agent settings
- Check that knowledge base is configured correctly
- Ensure documents are synced and indexed
Sharing Agents
Add Description
Write clear description of:
- What the agent does
- Who should use it
- Example queries to try
Public agents are searchable in the Khoj agent directory. Well-documented agents get more usage!
Next Steps
Automate with Agents
Schedule agents to run research and send reports
Advanced Chat
Combine agents with chat features like file filters
Share Conversations
Share agent conversations with colleagues
