Catalog PyPI
PACKAGE EXPLORERView in registry

agentcode-cli

PyPI

An open, multi-model agentic coding CLI — inspired by Claude Code

Versions collected1
Direct dependencies7From release 1.4.0
Last observed20 Oct, 21:40 UTC

README

Version 1.4.0 documentation

AgentCode

An open, multi-model agentic coding assistant — available as a CLI and VS Code extension. Inspired by Claude Code.

Works with Claude, GPT, Gemini, and any model supported by LiteLLM.


Choose your setup

Option A: CLI only

pip install agentcode-cli

Add your API key to a .env file in your project:

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...        # optional
GEMINI_API_KEY=...           # optional

Run:

agentcode                          # interactive REPL
agentcode "fix the failing tests"  # one-shot mode
agentcode --model gpt-5.6-terra    # use a specific model

All flags:

FlagDescription
--model, -mModel to use (overrides settings and AGENTCODE_MODEL)
--no-routeDisable cost-aware routing — always use the specified model
--auto-approve, -ySkip permission prompts (use with caution)
--dir, -dProject directory to operate in (default: current dir)
--init-settingsCreate a starter .agentcode/settings.json and exit
--serverJSON stdio server mode (used by the VS Code extension)

Option B: VS Code Extension

The extension requires the CLI installed as a backend. Install it first.

Step 1 — Install the CLI:

pip install agentcode-cli

Step 2 — Install the extension:

  • Search AgentCode in the VS Code Marketplace and install, or
  • Download the latest .vsix from the GitHub releases page and install via Cmd+Shift+X → ... → Install from VSIX...

Step 3 — Add your API key: Cmd+, → search AgentCode → paste your key into agentcode.anthropicApiKey

Step 4 — Open the chat panel: Press Cmd+Shift+A

Extension settings

SettingDescription
agentcode.anthropicApiKeyAnthropic API key
agentcode.openaiApiKeyOpenAI API key
agentcode.geminiApiKeyGoogle Gemini API key
agentcode.modelDefault model (e.g. claude-sonnet-5)
agentcode.executablePathPath to agentcode if not on PATH
agentcode.inlineCompletions.enabledEnable/disable inline completions (default: true)

Extension commands

CommandShortcutDescription
AgentCode: OpenCmd+Shift+AOpen the chat panel
AgentCode: Ask about selectionRight-clickAsk about highlighted code
AgentCode: Explain this fileRight-clickExplain the current file
AgentCode: Toggle inline completionsCommand PaletteEnable or disable inline completions

Extension features

  • Inline completions — AI-powered ghost-text suggestions as you type, powered by Claude Haiku. Press Tab to accept
  • Live streaming — responses stream in real time
  • Model picker — switch between Claude, GPT, and Gemini models from the dropdown in the header
  • Active file context — your current file is sent automatically, no copy-pasting needed
  • Diff viewer — edit tool calls open VS Code's native diff viewer so you can review changes before applying
  • Right-click actions — ask about selected code or explain a file directly from the editor

Supported Models

ProviderModelAPI Key
Anthropicclaude-sonnet-5 (default)ANTHROPIC_API_KEY
Anthropicclaude-opus-5ANTHROPIC_API_KEY
Anthropicclaude-fable-5 (opt-in, hardest long-horizon work)ANTHROPIC_API_KEY
Anthropicclaude-haiku-4-5ANTHROPIC_API_KEY
OpenAIgpt-5.6-sol, gpt-5.6-terra, gpt-5.6-lunaOPENAI_API_KEY
Googlegemini/gemini-3.1-pro-preview, gemini/gemini-3.6-flash, gemini/gemini-3.5-flash-liteGEMINI_API_KEY

Any of LiteLLM's ~3,000 models works — the table above is just the routing default. Run /models <filter> in the REPL to browse what's available with current prices, then /model <name> to switch.

Keeping up with new releases

Pricing and model availability come from LiteLLM's model registry, not from hardcoded values in this repo. When a provider ships a new model:

pip install -U litellm

That's it — the new model becomes usable by name and its costs are tracked correctly, with no AgentCode release required. /models will list it.

What does not update automatically is which model serves each routing tier (light/medium/heavy) — that's a judgement call, so it stays explicit. Point a tier at a new model yourself in .agentcode/settings.json:

{
  "model": {
    "light":  "gpt-5.6-luna",
    "medium": "gpt-5.6-terra",
    "heavy":  "gpt-5.6-sol"
  }
}

If you set a model AgentCode can't price (a typo, or one newer than your LiteLLM version), it warns at startup and reports costs as $0.00 rather than guessing.


Cost-Aware Routing

AgentCode automatically picks the cheapest model that can handle the task:

TierAnthropicOpenAIGemini
LightHaiku 4.5GPT-5.6 LunaGemini 3.5 Flash-Lite
MediumSonnet 5GPT-5.6 TerraGemini 3.6 Flash
HeavyOpus 5GPT-5.6 SolGemini 3.1 Pro

Simple questions go to cheap/fast models. Complex multi-file tasks go to powerful ones. Use --no-route to always use the specified model.

For the hardest long-horizon agent work, pick claude-fable-5 manually (CLI --model or the extension picker). It is not used by auto-routing so routine heavy tasks stay on Opus.


Tools

File & Shell

ToolDescriptionPermission
read_fileRead file contents with line numbersAuto
write_fileCreate or overwrite a fileAsk
edit_fileSurgical find-and-replace editAsk
run_commandExecute a bash commandAsk
list_directoryTree view of directory structureAuto
search_filesFind files by glob patternAuto
search_textGrep for text across filesAuto

Git

ToolDescriptionPermission
git_statusShow working tree statusAuto
git_diffShow staged or unstaged changesAuto
git_logShow recent commit historyAuto
git_commitStage files and create a commitAsk
git_branchList, create, or switch branchesAsk
git_pushPush commits to a remoteAsk

Subagents

ToolDescriptionPermission
spawn_subagentsRun multiple agents in parallel on subtasksAuto

Permission model: Read-only tools auto-approve. Write/execute tools and MCP tools ask before running (unless --auto-approve / -y is set). Tools on the permissions.deny list are always blocked, even with auto-approve on. Which tools fall into which bucket is configurable — see Settings below.


Settings

Create a settings file with:

agentcode --init-settings

This writes .agentcode/settings.json in your project. A global file at ~/.agentcode/settings.json is also read; precedence is CLI flags → project → global → built-in defaults. View the merged result anytime with /settings.

{
  "permissions": {
    "auto_approve_all": false,
    "auto_approve": ["read_file", "list_directory", "search_files",
                     "search_text", "git_status", "git_log", "git_diff",
                     "spawn_subagents"],
    "deny": []
  },
  "model": {
    "default": "claude-sonnet-5",
    "routing": true,
    "light": null, "medium": null, "heavy": null
  },
  "limits": {
    "max_file_size": 1000000,
    "max_output": 50000,
    "max_search_results": 100,
    "max_iterations": 25
  },
  "hooks": {}
}
KeyMeaning
permissions.auto_approve_alltrue skips all permission prompts (like -y)
permissions.auto_approveTools that run without asking (default: read-only tools)
permissions.denyTools that are always blocked — beats every other setting
model.defaultDefault model string
model.routingEnable cost-aware routing
model.light/medium/heavyOverride the model for a routing tier
limits.*File-size, output, search, and iteration caps
hooksSame format as hooks.json (see Hooks)

To gate an MCP tool or approve it permanently, use its full name, e.g. "deny": ["mcp__github__delete_repository"] or "auto_approve": ["mcp__filesystem__read_file"].


Slash Commands (CLI only)

CommandDescription
/model <name>Switch model on the fly
/models [filter]Browse available models and live prices
/routeShow or toggle cost-aware routing
/costShow session cost breakdown
/mcpManage MCP server connections
/mcp listShow connected servers
/mcp add <server>Connect a server
/mcp remove <server>Disconnect a server
/clearReset conversation and delete saved session
/compactForce LLM-powered context compaction
/tokensShow estimated token usage
/initCreate an AGENTCODE.md template
/settingsShow resolved settings
/helpShow help
/exitQuit

Session Persistence

Conversations are automatically saved to .agentcode_session.json in your project directory and resumed on next launch. Use /clear to start fresh.


MCP Support (CLI only)

Connect to any MCP server using /mcp add:

/mcp add github       # prompts for GitHub token
/mcp add filesystem   # no credentials needed
/mcp add postgres     # prompts for connection string
/mcp add sqlite       # prompts for database path

Config is saved to .agentcode/mcp.json and reloaded on next launch.

Security notes:

  • Credentials in mcp.json are stored in plaintext. AgentCode sets the file to mode 600 and adds .agentcode/ to your .gitignore automatically, but prefer scoped, revocable tokens where the service offers them.
  • MCP tools ask for permission before running, like built-in write tools. Add specific tools to permissions.auto_approve or permissions.deny in settings.json to change that (see Settings).

Advanced — edit .agentcode/mcp.json directly for custom servers:

{
  "mcpServers": {
    "my-server": {
      "command": "npx",
      "args": ["-y", "@myorg/mcp-server"],
      "env": {"API_KEY": "..."}
    }
  }
}

Global config goes in ~/.agentcode/mcp.json.


Hooks

Run shell commands before or after any tool call. Create .agentcode/hooks.json:

{
  "post_edit_file": "prettier --write \"$AGENTCODE_PATH\"",
  "post_write_file": "prettier --write \"$AGENTCODE_PATH\"",
  "pre_run_command": "echo \"Running: $AGENTCODE_COMMAND\""
}

Supported keys: pre_<toolname>, post_<toolname>, pre_tool / post_tool (wildcard). Global hooks go in ~/.agentcode/hooks.json.


AGENTCODE.md

AgentCode loads project instructions from AGENTCODE.md in your project directory and injects them into the system prompt automatically. Run /init to generate a starter template.


Subagents

AgentCode can spawn parallel agents for independent subtasks:

"Analyze agent.py, router.py, and tools.py in parallel and summarize each one"

The agent calls spawn_subagents internally, runs up to 5 agents in parallel, and returns combined results.

Subagents inherit the session's permission settings, and their approval prompts are serialized so they never talk over each other. By default they cannot spawn subagents of their own — raise AGENTCODE_MAX_SUBAGENT_DEPTH if you want deeper nesting.


Architecture

┌────────────────────────┐      ┌────────────────────────┐
│      cli.py (UI)       │      │  server.py (VS Code)   │
│  REPL · slash commands │      │  JSON stdio protocol   │
│  Rich terminal UI      │      │  for the extension     │
└───────────┬────────────┘      └───────────┬────────────┘
            │                               │
┌───────────▼───────────────────────────────▼────────────┐
│                    agent.py (Brain)                    │
│  Agentic loop · context compaction · permissions       │
│  Hooks · subagents (depth-capped) · settings.py config │
│                                                        │
│   while needs_follow_up:                               │
│     1. router.py picks the model (cost-aware tiers)    │
│     2. Send messages + tools → LLM (via LiteLLM)       │
│     3. If tool_calls → execute, append, loop           │
│        (xml_tool_parser.py converts inline XML/JSON    │
│         tool calls from open-weight fine-tunes)        │
│     4. If text only  → done                            │
└───────────┬───────────────────────────────┬────────────┘
            │                               │
┌───────────▼─────────┐         ┌───────────▼────────────┐
│  tools.py (Hands)   │         │      mcp_client.py     │
│  read/write/edit    │         │  Connect to MCP        │
│  run_command        │         │  servers and expose    │
│  list/search        │         │  their tools to the    │
│  git operations     │         │  agent loop            │
│  spawn_subagents    │         └────────────────────────┘
└─────────────────────┘

Environment Variables

VariableDescriptionDefault
AGENTCODE_MODELDefault modelclaude-sonnet-5
AGENTCODE_MAX_ITERATIONSMax tool-call iterations per turn25
AGENTCODE_MAX_SUBAGENT_DEPTHHow deep subagents may nest1
ANTHROPIC_API_KEYAnthropic API key—
OPENAI_API_KEYOpenAI API key—
GEMINI_API_KEYGoogle Gemini API key—

How to Extend

Add a new tool

  1. Add the function schema to TOOL_DEFINITIONS in tools.py
  2. Implement the function
  3. Register it in TOOL_MAP
  4. If it requires approval, omit it from permissions.auto_approve in .agentcode/settings.json

Publishing to PyPI

pip install build twine
python -m build
twine upload dist/*

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.4.05 Aug 20267

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
vigp17/agentcode

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:40 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f7a3c50ffa2912002246657b0e082c3b3abacb400d99d5f89eb962191ac7f7bc