Agent
Agent
Docus Agent provides AI-powered features for your documentation, including a chat assistant and automated PR documentation reviews.
About Docus Agent
The agent enhances your documentation workflow and user experience through two main features:
- Chat Assistant: Answers user questions directly on your documentation site using natural language and source citations.
- Review Agent: Automatically reviews Pull Requests and suggests or commits documentation updates to keep your docs in sync with code changes.
Chat Assistant
The chat assistant answers questions about your documentation through natural language queries. It is embedded directly in your documentation site, so users can find answers quickly.
When users ask questions, the assistant:
- Searches and retrieves relevant content from your documentation using an MCP server.
- Cites sources with navigable links to take users directly to referenced pages.
- Generates copyable code examples to help users implement solutions from your documentation.
Using the Assistant
Users can interact with the assistant in multiple ways:
Floating Input
On documentation pages, a floating input appears at the bottom of the screen. Users can type their questions directly and press Enter to get answers.
Explain with AI
Each documentation page includes an Explain with AI button in the table of contents sidebar. Clicking this button opens the assistant with the current page as context, asking it to explain the content.
Slideover Chat
When a conversation starts, a slideover panel opens on the right side of the screen. This panel displays the conversation history and allows users to continue asking questions.
Review Agent
The Review Agent is a specialized documentation agent that keeps your docs in sync with your code. Triggered by GitHub webhooks, it analyzes Pull Request diffs and identifies necessary documentation updates.
- Automated Reviews: Automatically scans every PR for changes that impact documentation.
- Content Discovery: Uses the built-in MCP server to find existing pages related to the changed code.
- Direct Commits: Can commit updated documentation directly to your PR branch or post suggestions as comments.
Setup for Review Agent
To enable the Review Agent, you need to provide GitHub App credentials:
Create a GitHub App
Create a new GitHub App with Read & Write permissions for Pull Requests and Repository Contents.
Generate Credentials
Generate a private key and a webhook secret for your app.
Set Environment Variables
Add the following to your environment:
GITHUB_APP_ID=your-app-id
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n..."
GITHUB_WEBHOOK_SECRET=your-webhook-secret
Enable in Configuration
Enable the review feature in your nuxt.config.ts:
export default defineNuxtConfig({
docus: {
agent: {
review: {
enabled: true,
mode: 'commit' // or 'comment'
}
}
}
})
Quick Start
1. Set Environment Variables
Add your API key and GitHub credentials to your environment:
AI_GATEWAY_API_KEY=your-api-key
# For Review Agent
GITHUB_APP_ID=...
GITHUB_APP_PRIVATE_KEY=...
GITHUB_WEBHOOK_SECRET=...
2. Configure Nuxt
The agent features are automatically detected based on environment variables, but you can explicitly configure them:
export default defineNuxtConfig({
docus: {
agent: {
chat: {
enabled: true
},
review: {
enabled: true
}
}
}
})
Configuration
Nuxt Configuration
Configure advanced options in nuxt.config.ts:
google/gemini-3-flash/mcptrue (if API key present)/__docus__/assistantfalsecommit (direct commits) or comment (PR comments). Default: commentowner/repo). Auto-detected in CI.App Configuration
The Chat Assistant UI can be customized through app.config.ts:
export default defineAppConfig({
assistant: {
// Show the floating input on documentation pages
floatingInput: true,
// Show the "Explain with AI" button in the sidebar
explainWithAi: true,
// FAQ questions to display when chat is empty
faqQuestions: [],
// Keyboard shortcuts
shortcuts: {
focusInput: 'meta_i'
},
// Custom icons
icons: {
trigger: 'i-lucide-sparkles',
explain: 'i-lucide-brain'
}
}
})
FAQ Questions
Display suggested questions when the chat is empty.
export default defineAppConfig({
assistant: {
faqQuestions: [
'How do I install Docus?',
'How do I customize the theme?'
]
}
})
export default defineAppConfig({
assistant: {
faqQuestions: [
{
category: 'Getting Started',
items: ['How do I install Docus?', 'What is the project structure?']
}
]
}
})
Programmatic Access
Use the useAssistant composable to control the assistant programmatically:
<script setup>
const { isEnabled, isOpen, open, close, toggle } = useAssistant()
function askQuestion() {
// Open the assistant with a pre-filled question
open('How do I configure the theme?', true)
}
</script>
open(message?: string, clearPrevious?: boolean)