Skip to main content

CrabAgent - AI Agent Platform with dual-mode (CLI + Serve)

Project description

๐Ÿฆ€ CrabAgent

AI Knowledge Work Platform โ€” Chat when you need answers, Work when you need results. Two modes, one seamless experience. Runs in terminal, browser, or desktop.

CrabAgent is a local-first AI platform with two working modes that adapt to what you're doing:

Chat Mode ๐Ÿ’ฌ Work Mode ๐Ÿ› ๏ธ
Layout Session list + conversation AI sidebar + live workspace
Focus Talk, ask, brainstorm Create, edit, build
Right panel โ€” Document preview / code editor / prototype / meeting notes
Switch Click ๐Ÿ› ๏ธ icon in toolbar Click ๐Ÿ’ฌ icon or AI auto-switches when opening files

You don't pick a mode upfront. Start chatting, and when the AI starts working on a document or code file, the workspace slides open automatically. Switch back to Chat Mode anytime for a clean conversation view.

Chat Mode                          Work Mode
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      โ”‚              โ”‚           โ”‚  โ”‚ AI Chat  โ”‚   Workspace    โ”‚
โ”‚ Sess โ”‚  Conversationโ”‚           โ”‚ ๐Ÿ’ฌโ”‚ Sidebar  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚ List โ”‚              โ”‚           โ”‚  โ”‚ (350px)  โ”‚  โ”‚ Document โ”‚  โ”‚
โ”‚      โ”‚              โ”‚           โ”‚  โ”‚          โ”‚  โ”‚ Preview  โ”‚  โ”‚
โ”‚      โ”‚              โ”‚           โ”‚  โ”‚ Input    โ”‚  โ”‚ Code     โ”‚  โ”‚
โ”‚      โ”‚              โ”‚           โ”‚  โ”‚          โ”‚  โ”‚ Prototypeโ”‚  โ”‚
โ”‚      โ”‚              โ”‚           โ”‚  โ”‚          โ”‚  โ”‚ Meeting  โ”‚  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚  โ”‚          โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                                  โ””โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Python 3.12+ License

English | ไธญๆ–‡


๐Ÿ’ฌ Chat Mode โ€” Pure Conversation

The default mode. Session list on the left, full-width conversation on the right. No distractions.

Best for:

  • Asking questions and getting AI-powered answers
  • Brainstorming and exploring ideas
  • Quick research via web search and browser automation
  • Delegating tasks to specialized AI agents (researcher, analyst, coder, writer)
  • Multi-turn conversations with full project memory
You: "ๅธฎๆˆ‘ๅˆ†ๆžไธ€ไธ‹่ฟ™ไธช้กน็›ฎ็š„ๆžถๆž„"
AI: [reads files, analyzes patterns, generates structured report]
You: "ๆŠŠๅˆ†ๆž็ป“ๆžœๆ•ด็†ๆˆไธ€ไปฝ Word ๆ–‡ๆกฃ"
AI: [creates document] โ†’ auto-switches to Work Mode with preview

๐Ÿ› ๏ธ Work Mode โ€” AI + Live Workspace

When the AI creates or opens a file, the interface splits: AI chat shrinks to a 350px sidebar on the left, and the workspace takes over the right side. Everything the AI does is visible in real time.

Workspace types

Type What shows Trigger
๐Ÿ“„ Document Office document preview (.docx / .xlsx / .pptx) with outline, timeline, and inline edit AI creates/opens an Office file
๐Ÿ’ป Code Monaco-based code editor with syntax highlighting AI works on a code file
๐Ÿ”ฌ Prototype Split-pane: source code on left, live preview on right AI builds an HTML/JS prototype
๐Ÿ“ Meeting Structured meeting notes panel with action item extraction You click "Start Meeting"

Work Mode features

  • Real-time preview: watch the AI edit a document and see changes reflected instantly
  • Inline editing: double-click text in document preview to edit directly
  • AI Edit toolbar: Bold, italic, font size, color โ€” one click to style selected text
  • Natural language edit: type instructions like "make the heading red" and the AI applies it
  • Document timeline: see the full history of AI operations on the document
  • File workspace: create folders, multi-select items, drag files or folders between directories, use a floating context menu, and copy text previews without leaving Work Mode
  • One-click switch back to Chat Mode when you're done
Work Mode in action:

You: "่ฏปๅ– sales.xlsx ๆฑ‡ๆ€ป Q1 ๆ•ฐๆฎ๏ผŒๅšๆˆไธ€ไปฝๆŠฅๅ‘Š"
                          โ”‚
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  AI Chat Sidebar      โ”‚  Workspace (Document Preview) โ”‚
  โ”‚                       โ”‚                               โ”‚
  โ”‚  AI: Reading file...  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
  โ”‚  AI: Q1 total: $1.2M  โ”‚  โ”‚  Q1 Sales Report        โ”‚  โ”‚
  โ”‚  AI: Creating doc...  โ”‚  โ”‚  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€        โ”‚  โ”‚
  โ”‚  AI: Done! โœ“          โ”‚  โ”‚  Total: $1.2M           โ”‚  โ”‚
  โ”‚                       โ”‚  โ”‚  Growth: +23%           โ”‚  โ”‚
  โ”‚  [Input: continue...] โ”‚  โ”‚  ...                    โ”‚  โ”‚
  โ”‚                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค– AI Team

Both modes have access to a team of specialized agents:

Agent Role Best for
Researcher Web researcher Search, browse, collect data
Analyst Data analyst Compare, identify patterns, generate reports
Coder Code expert Write, review, debug, refactor
Writer Content writer Write, edit, translate, format
Plan Creator Task planner Decompose complex tasks into workflows

Orchestration modes

Delegate      โ†’ @researcher "find competitor pricing"
Parallel      โ†’ Run 3 agents simultaneously on different tasks
Pipeline      โ†’ research โ†’ analyze โ†’ write (with data flow)
Handoff       โ†’ Pass context from one agent to another

Cost control: In Settings โ†’ General, map the parent agent's provider|model to a (usually cheaper) provider|model for sub-agents โ€” applied automatically on every delegation, across providers.


๐Ÿ“ฌ Email Intelligence โ€” Tasks from Inbox

CrabAgent watches your inbox and turns emails into action items โ€” automatically.

Incoming email: "ๆ˜Žๅคฉไธ‹ๅˆ3็‚นๅผ€ไผš่ฎจ่ฎบๆ–ฐๅŠŸ่ƒฝ"
      โ”‚
      โ”œโ”€ ๐Ÿง  LLM analyzes: meeting + deadline detected
      โ”œโ”€ ๐Ÿ“ Drafts a reply for your review
      โ”œโ”€ โœ… Creates task: "ๅ‚ๅŠ ๅ…ณไบŽcrabagent็š„ไผš่ฎฎ" (due tomorrow 3PM)
      โ””โ”€ ๐Ÿ”— Links task to email conversation โ€” click to view full context

No rules, no regex. Just LLM-powered understanding.


๐Ÿ’ฌ WeChat Channel โ€” AI in Your Pocket

Bind your WeChat account via QR code, and CrabAgent becomes reachable from your phone.

You (WeChat): "็œ‹ไธ€ไธ‹26ๅนด1ๆœˆๆœ‰ๅ•ฅๅทฅไฝœ"
       โ”‚
       โ”œโ”€ ๐Ÿค– Agent processes with full project context
       โ”œโ”€ ๐Ÿ’ฌ Replies directly in WeChat chat
       โ””โ”€ ๐Ÿ”” Pushes notifications: task overdue, scheduled task done, email summary

Three modes:

  • Command execution โ€” send instructions from WeChat, Agent executes and replies
  • Proactive notifications โ€” task deadlines, scheduled task results, email summaries auto-pushed
  • Conversational โ€” multi-turn chat with full project memory

๐Ÿ”‘ ChatGPT Subscription โ€” Use Your Plus/Pro Membership

Already paying for ChatGPT Plus or Pro? Use it directly in CrabAgent โ€” no API key, no extra cost.

Settings โ†’ Providers โ†’ Add โ†’ "ChatGPT Subscription (Plus/Pro)"
       โ”‚
       โ”œโ”€ ๐Ÿ” Click "Login ChatGPT" โ†’ get a device code
       โ”œโ”€ ๐ŸŒ Open auth.openai.com/codex/device in browser
       โ”œโ”€ โœ๏ธ Sign in with ChatGPT, enter the code
       โ”œโ”€ โœ… CrabAgent auto-detects login
       โ””โ”€ ๐Ÿ“Š Click "View Usage" โ†’ see real-time quota:
            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
            โ”‚ Plan: PLUS     Limit: premium     โ”‚
            โ”‚                                   โ”‚
            โ”‚ 5h window   โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  12.3%      โ”‚
            โ”‚ 7d window   โ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘   3.1%      โ”‚
            โ”‚ Reset in: 4.2h / 6.2d             โ”‚
            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Available models: gpt-5.4, gpt-5.3-codex, gpt-5.3-instant, gpt-5.2-codex, and more โ€” all powered by your ChatGPT subscription.

How it works: CrabAgent uses the same OAuth Device Code flow as the official OpenAI Codex CLI. Your ChatGPT login is stored locally and auto-refreshed. All API calls go through chatgpt.com/backend-api/codex, using your subscription quota โ€” not paid API credits.


๐Ÿง  Project Memory & Self-Evolving Agents

Every time you work in a project, CrabAgent automatically extracts lessons and preferences. Next time you open it, it already knows:

=== ้กน็›ฎไธŠไธ‹ๆ–‡ ===
ไธŠๆฌกๆดป่ทƒ๏ผš06-05 15:30
ๆŠ€ๆœฏๆ ˆ๏ผšPython / FastAPI / SQLAlchemy
้กน็›ฎ็ป้ชŒ๏ผšN+1 ๆŸฅ่ฏข็”จ selectinload ไผ˜ๅŒ–๏ผ›API ๆ–‡ๆกฃ็”จ OpenAPI ่ง„่Œƒ
====================

After each task, agents reflect on what worked (and what didn't) and store the insight permanently:

Layer Scope What's stored
Project Memory Per workspace Recent lessons, tech stack, activity timeline
User Preferences Per user Communication style, tool preferences, rejected patterns
Agent Lessons Per agent Technical strategies, pitfalls, effective approaches

Quick Start

pip install crabagent
crabagent init

# TUI โ€” interactive REPL with slash commands
crabagent

# Web UI โ€” Chat Mode & Work Mode
crabagent --serve          # โ†’ http://localhost:5210
                           #   Default login: admin / xcl1989

# Single-shot CLI
crabagent "organize this directory"

Desktop App (macOS & Windows)

Build the Electron wrapper (requires Python + crabagent installed on your system):

# One-command build (from git clone):
make desktop                       # macOS โ†’ CrabAgent-x.x.x-arm64.dmg

# Or from pip install (auto-detects platform):
crabagent --build-desktop          # macOS โ†’ .dmg | Windows โ†’ .exe installer

# Windows (PowerShell):
.\scripts\build-desktop.ps1        # โ†’ CrabAgent-x.x.x-setup.exe

The desktop app includes a floating desktop pet that reacts to agent state (idle, thinking, working, waiting, celebrating, error). Drag it anywhere on screen; use the tray or app menu to show/hide it.


Features

๐ŸŽฏ Goal Mode

Create a durable goal for the current conversation with the target button or /goal <objective>. A goal keeps its objective, success criteria, constraints, checkpoints, and evidence visible while all planning, tool calls, tests, and results remain in the normal chat stream.

Pause, resume, edit, or inspect the goal timeline at any time. With Auto Continue enabled, CrabAgent starts the next focused session turn after the current response, stopping safely when the goal is completed, paused, blocked, or reaches its configured token or turn budget.

๐Ÿ› ๏ธ Work Mode

Split-pane workspace with live document preview, code editor, prototype builder, meeting notes, and Markdown editor. AI chat sidebar stays interactive while you work.

๐Ÿ“ˆ Usage Insights

Track token consumption by time range and workspace. The Usage page highlights period totals, calls, cache health, and active sessions, then lets you compare model and agent consumption, search and sort sessions, and expand a session to inspect its recent calls.

๐Ÿ“Š Rich Conversation Visualizations

Assistant responses can turn Markdown into shareable visuals: Mermaid flowcharts, sequence/state/ER diagrams, architecture diagrams, and bar, line, area, pie, or scatter charts. KPI cards summarize a key metric. Open any visualization in a larger view, then copy it as a PNG or download a high-resolution PNG to share.

Mermaid diagrams render after a streamed response is complete and are syntax-validated before display, so incomplete diagram text never replaces the conversation with raw parser-error graphics.

๐Ÿ“ Markdown Editor

Split-pane editor for .md files โ€” source on the left, live rendered preview on the right. Bidirectional scroll sync, GFM tables, syntax-highlighted code blocks. Switch between Source / Split / Preview views.

๐Ÿ“„ Intelligent Document Processing

AI agents can read, create, edit, and preview Office documents (.docx, .xlsx, .pptx) directly in conversations.

๐Ÿง  Project Memory

Remembers your project context across sessions. Zero extra cost.

๐Ÿ–ผ๏ธ Multi-modal

Paste/drop images into conversations. Auto-detects vision model support. AI-generated images persist across sessions with inline rendering. Lazy loading: images are fetched on-demand after text renders, so opening image-heavy sessions is instant.

๐Ÿ—‚๏ธ Multi-Workspace

Work across multiple projects simultaneously. The workspace switcher shows a live badge with the count of active sessions in each workspace โ€” no need to switch back and forth to check if a background agent has finished. Running sessions in the current workspace are marked with a pulsing green indicator.

๐ŸŒ Browser Automation

pip install 'crabagent[browser]'
playwright install chromium

๐Ÿ”Œ MCP Client

Connect external MCP servers (stdio + HTTP). Tools auto-discover and get prefixed.

โฑ Scheduled Tasks

> Open Hacker News at 9 AM every day and screenshot top 5
> Check product page every 30 min, notify me if below $500

๐Ÿฆ€ Snapshots (Molt)

Auto-snapshot files before changes. Roll back anytime without Git.

๐Ÿ”ง Custom Tools

Drop a .py file in .crabagent/tools/ โ€” or let the AI create one for you in a conversation.


Installation

pip install crabagent                    # CLI + Web UI + API (all-in-one)
pip install 'crabagent[browser]'        # Browser automation
pip install 'crabagent[memory]'         # Semantic memory search (recommended)
pip install 'crabagent[dev]'            # Testing + linting

Development

make install            # Build frontend + install (editable)
ruff check src/ tests/  # Lint
ruff format src/ tests/ # Format
pytest                   # Run tests

CLI / TUI Commands

Command Description
/exit, /quit Exit
/help Help
/clear Clear context
/model [name] Switch model
/models List models
/provider [cmd] Manage providers
/sessions / /session [id] List/load sessions
/new New session
/agents [cmd] Agent team management
/agent [name] Switch agent
/agent_stats <name> Agent growth stats
/delegate [@agent] [task] Delegate task
`/memory [list search
/skills / /skill <name> List/view skills
/molt [cmd] Snapshot management
/todo [cmd] Todo management
/export Export as Markdown
/image <path> Send image
/runs [agent] View run history
/abort Abort execution

Configuration

Variable Default Description
CRAB_DB_URL sqlite+aiosqlite:///./crabagent.db Database URL
CRAB_JWT_SECRET auto-generated JWT signing key
CRAB_SERVE_HOST 0.0.0.0 Server host
CRAB_SERVE_PORT 5210 Server port
CRAB_MAX_ITERATIONS 50 Max agent iterations
CRAB_MAX_TOKENS 4096 Max response tokens
CRAB_BROWSER_HEADLESS true Browser headless mode
CRAB_WEB_PROXY (empty) HTTP proxy for web tools
CRAB_MEMORY_EMBEDDING auto Memory vector search: auto / on / off

Project Structure

CrabAgent/
โ”œโ”€โ”€ src/crabagent/
โ”‚   โ”œโ”€โ”€ cli/           # CLI + TUI
โ”‚   โ”œโ”€โ”€ core/agent/    # Agent loop, tools, compression, agents
โ”‚   โ”œโ”€โ”€ core/mcp/      # MCP client manager
โ”‚   โ”œโ”€โ”€ core/          # Database, config, project memory, embedding
โ”‚   โ””โ”€โ”€ serve/         # FastAPI + API + scheduler
โ”œโ”€โ”€ frontend/          # React SPA
โ”œโ”€โ”€ electron/          # Electron desktop app
โ”œโ”€โ”€ scripts/           # Build scripts
โ”œโ”€โ”€ crabagent.spec     # PyInstaller config
โ””โ”€โ”€ crabagent.db       # SQLite database

License

GNU Affero General Public License v3 (AGPLv3) for non-commercial use. Commercial use requires a separate license. Contact the author.

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crabagent-0.13.5.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crabagent-0.13.5-py3-none-any.whl (3.1 MB view details)

Uploaded Python 3

File details

Details for the file crabagent-0.13.5.tar.gz.

File metadata

  • Download URL: crabagent-0.13.5.tar.gz
  • Upload date:
  • Size: 4.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for crabagent-0.13.5.tar.gz
Algorithm Hash digest
SHA256 5134e81b90ba815164187043af4f7df9e115ae580366cf0098dbf3688ac88be4
MD5 94360d2cc44d10d95c4d37cc4b0b7dad
BLAKE2b-256 5beb0151989dfa986e8874244cbeec9bacacde2d0bddecea0f6ae78c2db013b8

See more details on using hashes here.

File details

Details for the file crabagent-0.13.5-py3-none-any.whl.

File metadata

  • Download URL: crabagent-0.13.5-py3-none-any.whl
  • Upload date:
  • Size: 3.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for crabagent-0.13.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ecf0695c1e87c5895b77ef5de10b810db9b51367b6e9d66a6c5843656d0f24db
MD5 6ad3b84d1854dc0b2593b4499fff7335
BLAKE2b-256 70ac86f935992ab6d45cc00d3008c78f77d80ce47f20ef10c9033b0b75868619

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page