A standalone copier template for creating agentic AI assistants with NiceGUI web interfaces and Claude Code CLI integration.
This template generates a complete web application that:
- Uses NiceGUI for a modern, reactive web interface
- Integrates Claude Code CLI as the agentic orchestrator (via CBORG LBL service or Anthropic API)
- Supports MCP servers for custom tools (literature retrieval, web search, etc.)
- Provides real-time streaming responses and status updates
- Includes Python best practices (pyproject.toml, ruff linting, pytest)
┌─────────────────────────────────┐
│ NiceGUI Frontend │
│ - Real-time chat interface │
│ - Stream responses │
│ - Material Design UI │
└────────────┬────────────────────┘
│
▼
┌─────────────────────────────────┐
│ FastAPI Backend (built-in) │
│ - Spawns claude CLI process │
│ - Passes queries via stdin │
│ - Streams stdout back to UI │
└────────────┬────────────────────┘
│
▼
┌─────────────────────────────────┐
│ Claude Code CLI │
│ via CBORG (LBL) or Anthropic │
│ + MCP servers for tools: │
│ - artl-mcp (literature) │
│ - mcp-server-fetch (web) │
│ - Custom domain tools │
└─────────────────────────────────┘
- Python >= 3.11
- uv (
curl -LsSf https://astral.sh/uv/install.sh | sh
) - copier (
uv tool install copier --with jinja2-time
) - Claude Code CLI (for running the agent)
copier copy --trust gh:Knowledge-Graph-Hub/nicegui-app-copier my-agent-app
You'll be prompted to answer questions about your project:
- Project name and description
- Author information
- License
- API configuration (CBORG vs. Anthropic)
- Which MCP servers to include
- Port number
cd my-agent-app
# Set up API keys
export ANTHROPIC_AUTH_TOKEN=$(cat ~/cborg.key)
export ANTHROPIC_BASE_URL=https://api.cborg.lbl.gov
export ANTHROPIC_MODEL=anthropic/claude-sonnet
# Install dependencies
uv sync
# Run the app
python app.py
Open browser to http://localhost:8080
my-agent-app/
├── app.py # NiceGUI application entry point
├── agent_alz_assistant/ # Python package
│ ├── __init__.py
│ └── agent.py # Claude CLI orchestrator
├── pyproject.toml # Dependencies and project config
├── mcp_config.json # MCP server configuration
├── CLAUDE.md # System prompt for the agent
├── README.md # Project-specific README
├── .env.example # Environment variable template
└── .gitignore
Edit CLAUDE.md
to customize how your agent behaves:
# My Agent Instructions
You are a specialized assistant for [domain].
## Your Capabilities
- Tool 1: Description
- Tool 2: Description
## Guidelines
- Be helpful and clear
- Cite sources
...
Edit mcp_config.json
to add/remove tools:
{
"mcpServers": {
"my-tool": {
"command": "uvx",
"args": ["my-mcp-server"]
}
}
}
The template supports two modes:
CBORG (LBL service to provide access to LLMs)
export ANTHROPIC_AUTH_TOKEN=your-cborg-key
export ANTHROPIC_BASE_URL=https://api.cborg.lbl.gov
export ANTHROPIC_MODEL=anthropic/claude-sonnet
Direct Anthropic API
export ANTHROPIC_AUTH_TOKEN=your-anthropic-key
export ANTHROPIC_MODEL=claude-sonnet-4-20250514
The template can include:
-
artl-mcp - Scientific literature retrieval by DOI/PMID/PMCID
- Fetches full text from PubMed, arXiv, and other sources
-
mcp-server-fetch - Web content fetching
- Retrieves and processes web pages
Both are optional and can be enabled/disabled during project generation.
- agent-alz-assistant - Alzheimer's research assistant
The generated project includes:
Run tests:
uv run pytest
Lint code:
uv run ruff check .
Format code:
uv run ruff format .
Use a YAML file for automation:
# my-answers.yaml
project_name: my-agent-app
project_slug: my_agent_app
project_description: My agentic assistant
email: [email protected]
full_name: Your Name
use_cborg: true
include_artl_mcp: true
include_fetch_mcp: true
copier copy --trust --defaults --data-file my-answers.yaml \
gh:Knowledge-Graph-Hub/nicegui-app-copier my-agent-app
This template is inspired by monarch-project-copier and follows similar patterns (copier.yaml structure, jinja templates, etc.) but is standalone and focused on NiceGUI web applications rather than LinkML schemas.
If you need more comprehensive project infrastructure (CI/CD, documentation generation, advanced testing), consider using monarch-project-copier and manually adding the NiceGUI app files.
Contributions welcome! This template is designed to evolve with best practices for agentic AI applications.
BSD-3-Clause