Skip to main content
Agents in Khoj are specialized AI assistants you can customize with unique personalities, knowledge bases, and capabilities. Whether you need a research assistant, creative writing partner, or domain expert, agents adapt to any role.
Khoj Agents Gallery

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

Agent Name: Academic ResearcherPersonality:
You are a meticulous research assistant with expertise in 
academic literature. Always cite sources, present multiple 
perspectives, and highlight areas needing further investigation.
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:
1

Visit Agents Page

2

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
3

Try an Agent

Click any agent to start a conversation with it immediately
Public agents created by the Khoj team and community are marked with badges indicating their specialties.

Creating Your Own Agent (Cloud)

Agent creation on Khoj Cloud may require a subscription. Check pricing for details.
1

Access Agent Builder

On the agents page, click “Create New Agent”
2

Configure Basic Details

Name: Choose a descriptive nameAvatar: Upload an image or use an emojiDescription: Brief summary of what the agent does
3

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
You are a fitness and nutrition coach with a holistic approach 
to health. You provide personalized advice based on the user's 
goals, current fitness level, and dietary preferences.

Guidelines:
- Always ask about medical conditions before giving advice
- Emphasize sustainable habits over quick fixes
- Use encouraging, non-judgmental language
- Cite scientific research when making claims
- Suggest exercises with proper form descriptions

Avoid:
- Diagnosing medical conditions
- Extreme diets or dangerous practices
- One-size-fits-all recommendations
4

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
5

Enable Tools

Toggle capabilities:
  • ☑️ Online Search: Real-time web research
  • ☑️ Image Generation: Create visuals
  • ☑️ Code Execution: Run Python scripts
  • ☑️ Document Search: Access knowledge base
6

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
7

Set Visibility

  • Private: Only you can use this agent
  • Public: Share with the Khoj community
  • Team: Share with workspace members (Enterprise)
8

Save and Test

Click “Create Agent” then start a conversation to test behavior

Creating Agents (Self-Hosted)

Self-hosted users create agents via the admin panel:
1

Access Admin Panel

Navigate to: http://localhost:42110/server/admin/database/agent
2

Add New Agent

Click “Add Agent” in the top right
3

Configure Agent

Required fields:
  • Name: Agent identifier
  • Personality: Your custom system prompt
  • Chat model: Select configured chat model
Optional fields:
  • Public: Check to make available to all server users
  • Creator: Set to limit access to specific user
  • Managed by admin: Check if admin-controlled
4

Save Agent

Click “Save” - the agent is now available in your Khoj interface
On self-hosted instances, agents marked as public are visible to all users on your server. Leave unchecked and set a specific Creator for private agents.

Writing Effective Personalities

Craft system prompts that guide agent behavior:
Instead of:
You are helpful.
Try:
You are a senior product manager specializing in SaaS products. 
You help users define features, write requirements, and prioritize 
roadmaps using frameworks like RICE and Kano model.
Examples:
Use a friendly, conversational tone. Keep responses concise.
Communicate formally and precisely, like an academic paper.
Be encouraging and patient. Use lots of examples and analogies.
Specify what the agent should NOT do:
Do not:
- Provide medical diagnoses
- Write complete code solutions for homework
- Make financial investment recommendations
- Share personal opinions on political topics
Tell the agent HOW to approach tasks:
When reviewing code:
1. First, summarize what the code does
2. Identify any bugs or errors
3. Suggest improvements for readability
4. Note performance considerations
5. Highlight security concerns if any
Show desired output format:
When explaining concepts, use this format:

**Simple Definition:** One sentence explanation
**Analogy:** Real-world comparison
**Example:** Concrete instance
**Common Misconceptions:** What people often get wrong

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

1
Click the agent icon/name in the chat header
2
Select a different agent from the dropdown
3
The conversation continues with the new agent
Each agent maintains separate conversation history. Switching agents starts fresh context.

Agent vs. Slash Commands

When to use each:
FeatureAgentsSlash Commands
CustomizationFull personality controlFixed behavior
PersistenceConsistent across conversationsOne-time modifier
KnowledgeCan have specific document accessUses default search
Best ForOngoing specialized tasksQuick one-off changes
Combine both: Use agents for specialized roles, then use slash commands within that agent for specific tasks (e.g., research agent using /code for analysis).

Advanced: Agent Chaining

Use multiple agents in sequence for complex workflows:
1

Agent 1: Research

Use a research agent to gather information
Research the latest trends in renewable energy
2

Agent 2: Analysis

Switch to an analyst agent to process findings
[Copy research results]
Analyze these trends and identify the top 3 opportunities
3

Agent 3: Writing

Use a writing agent to create content
[Copy analysis]
Write a blog post about these renewable energy opportunities

Troubleshooting Agents

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)
Solutions:
  • Ensure agent has access to relevant knowledge base
  • Add more specific domain expertise to personality
  • Include technical terminology in system prompt
Solutions:
  • Verify document search is enabled in agent settings
  • Check that knowledge base is configured correctly
  • Ensure documents are synced and indexed

Sharing Agents

1

Make Public

Edit your agent and set visibility to “Public”
2

Add Description

Write clear description of:
  • What the agent does
  • Who should use it
  • Example queries to try
3

Share Link

Copy the agent URL to share directly:
https://app.khoj.dev/agents/<agent-id>
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

Build docs developers (and LLMs) love