Sign inSign up

chenxizhang/claude-agent-web

By chenxizhang

•Updated 8 months ago

Web-based AI assistant powered by Claude Agent SDK with full Claude Code capabilities

Image
Machine learning & AI
Web servers
0

1.6K

chenxizhang/claude-agent-web repository overview

⁠Claude Agent Web

A web-based AI assistant powered by Claude Agent SDK⁠, providing a chat interface with full access to Claude Code's capabilities including file operations, code execution, and web search.

⁠Quick Start with Docker

Pull and run the pre-built Docker image from Docker Hub⁠.

⁠Minimal Setup
docker run -d -p 3000:3000 \
  -e ANTHROPIC_API_KEY="your-api-key" \
  chenxizhang/claude-agent-web

Then open http://localhost:3000⁠ in your browser.

For production or multi-option setups, create a .env.docker file to keep configuration organized and secrets out of your shell history.

1. Create .env.docker:

# API Configuration
ANTHROPIC_API_KEY=your-api-key
ANTHROPIC_BASE_URL=https://your-proxy-or-azure-endpoint.com/anthropic
CLAUDE_MODEL=claude-sonnet-4-5

# Agent Configuration (optional)
AGENT_INSTRUCTIONS_FILE=/plugins/my-agent/instructions.md
AGENT_PLUGINS=/plugins/my-agent

# UI (optional)
APP_TITLE=My AI Assistant

# Authentication (optional — omit this section to disable auth)
AUTH_ENABLED=true
AUTH_TRUST_HOST=true
AUTH_URL=http://localhost:3000
AUTH_SECRET=your-random-secret-base64

# Restrict login to specific email domains (optional)
AUTH_ALLOWED_PATTERN=email:.*@yourcompany\.com$

# Microsoft Entra ID (optional)
AUTH_MICROSOFT_ENTRA_ID_ID=your-client-id
AUTH_MICROSOFT_ENTRA_ID_SECRET=your-client-secret
AUTH_MICROSOFT_ENTRA_ID_ISSUER=https://login.microsoftonline.com/common/v2.0

# GitHub OAuth (optional)
AUTH_GITHUB_ID=your-github-client-id
AUTH_GITHUB_SECRET=your-github-client-secret

# Google OAuth (optional)
AUTH_GOOGLE_ID=your-google-client-id
AUTH_GOOGLE_SECRET=your-google-client-secret

2. Run the container:

docker run -d --name claude-agent-web -p 3000:3000 \
  --env-file .env.docker \
  chenxizhang/claude-agent-web
⁠Running with Plugins

Claude Agent Web supports Claude Code plugins⁠. Mount your plugin directory into the container and configure it via environment variables.

Plugin directory structure (example):

my-agent/
├── .claude-plugin/
│   └── plugin.json          # Plugin manifest
├── instructions.md           # Agent instructions (role, rules, tools)
├── skills/                   # Skill definitions
├── commands/                 # Slash commands
└── scenarios/                # Reference data loaded on-demand

Run with a plugin:

docker run -d --name claude-agent-web -p 3000:3000 \
  --env-file .env.docker \
  -v /path/to/my-agent:/plugins/my-agent \
  chenxizhang/claude-agent-web

The key environment variables in .env.docker for plugin support:

# Point to the instructions file inside the mounted plugin
AGENT_INSTRUCTIONS_FILE=/plugins/my-agent/instructions.md

# Register the plugin (semicolon-separated for multiple plugins)
AGENT_PLUGINS=/plugins/my-agent

Multiple plugins:

docker run -d --name claude-agent-web -p 3000:3000 \
  --env-file .env.docker \
  -v /path/to/plugin-a:/plugins/plugin-a \
  -v /path/to/plugin-b:/plugins/plugin-b \
  chenxizhang/claude-agent-web

With .env.docker containing:

AGENT_PLUGINS=/plugins/plugin-a;/plugins/plugin-b

⁠Features

  • Full Claude Code Integration: Access to all built-in Claude Code tools (Read, Write, Edit, Bash, Glob, Grep, WebSearch, etc.)
  • Sandboxed Execution: Agent operates in an isolated workspace directory for security
  • Streaming Responses: Real-time streaming of AI responses with SSE (Server-Sent Events)
  • Session Management: Supports conversation resumption via session IDs
  • Plugin Support: Load custom Claude Code plugins at runtime
  • Flexible Model Selection: Choose between Haiku (fast), Sonnet (balanced), or Opus (powerful)
  • Interactive Q&A: Supports Claude's AskUserQuestion tool for interactive conversations

⁠Environment Variables

VariableRequiredDefaultDescription
ANTHROPIC_API_KEYYes-Anthropic API key for authentication
ANTHROPIC_BASE_URLNohttps://api.anthropic.comCustom API endpoint (for proxies or Azure)
CLAUDE_MODELNoclaude-haiku-4-5Default model (claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-5)
AGENT_WORKSPACENo/agentspaceWorking directory for the agent (sandboxed)
AGENT_INSTRUCTIONSNo-Custom agent instructions (inline text)
AGENT_INSTRUCTIONS_FILENo-Path to agent instructions file (takes priority over AGENT_INSTRUCTIONS)
AGENT_PLUGINSNo-Semicolon-separated plugin directory paths
APP_TITLENoLumenApp title displayed in header
AUTH_ENABLEDNofalseEnable OAuth authentication
AUTH_URLNo-Public URL of the app (required for OAuth callbacks in Docker)
AUTH_SECRETNo-NextAuth secret (required when auth is enabled)
AUTH_ALLOWED_PATTERNNo-Regex to restrict login (matched against email:xxx|name:xxx|id:xxx)

⁠API Reference

⁠POST /api/chat

Send a message to the AI assistant.

Request Body:

{
  // Required: The user's message
  prompt: string;

  // Optional: Session ID for conversation continuity
  sessionId?: string;

  // Optional: Plugin directories to load
  plugins?: string[];

  // Optional: Model selection
  // - 'claude-haiku-4-5' (fastest, default)
  // - 'claude-sonnet-4-5' (balanced)
  // - 'claude-opus-4-5' (most capable)
  model?: string;

  // Optional: Specific tools to load
  // If not specified, all Claude Code tools are loaded
  tools?: string[];

  // Optional: Maximum conversation turns
  maxTurns?: number;
}

Response: Server-Sent Events (SSE) stream

Event Types:

Event TypeDescriptionPayload
initSession initialized{ sessionId: string }
textStreaming text content{ content: string }
tool_useTool invocation{ toolName: string, toolInput: object }
questionInteractive question{ question: { id, questions: [...] } }
doneCompletion{ result: string, sessionId: string }
errorError occurred{ error: string }

Example:

curl -X POST http://localhost:3000/api/chat \
  -H "Content-Type: application/json" \
  -d '{"prompt": "List files in the current directory"}'

⁠Available Tools

When tools is not specified, all Claude Code built-in tools are available:

CategoryTools
File OperationsRead, Write, Edit, Glob, Grep
Code ExecutionBash
WebWebSearch, WebFetch
User InteractionAskUserQuestion
Task ManagementTask, TaskCreate, TaskUpdate, TaskList, TaskGet
PlanningEnterPlanMode, ExitPlanMode
NotebookNotebookEdit

To load only specific tools for faster performance:

{
  "prompt": "Read the config file",
  "tools": ["Read", "Glob"]
}

⁠Model Comparison

ModelSpeedCapabilityUse Case
claude-haiku-4-5FastestGoodSimple tasks, quick responses
claude-sonnet-4-5MediumBetterGeneral purpose, balanced
claude-opus-4-5SlowestBestComplex reasoning, analysis

⁠Security

  • Sandboxed Execution: All file operations are restricted to /agentspace
  • Non-root Container: Runs as unprivileged nextjs user
  • Permission Bypass: Uses bypassPermissions mode - ensure your deployment is properly secured
  • No Secrets in Code: All sensitive configuration via environment variables

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:1d910778f…

Size

264 MB

Last updated

8 months ago

docker pull chenxizhang/claude-agent-web