Agent Shell 是 AI Skill Hub 本期精选AI工具之一。综合评分 7.8 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
一个创新的AI工作流工具,将AI代理集成到shell终端中。用户只需按一个快捷键即可激活AI助手,帮助编程、命令执行和工作流自动化。特别适合开发者和命令行爱好者提高生产力。
Agent Shell 是一款基于 TypeScript 开发的开源工具,专注于 AI代理、Shell CLI、开发工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
一个创新的AI工作流工具,将AI代理集成到shell终端中。用户只需按一个快捷键即可激活AI助手,帮助编程、命令执行和工作流自动化。特别适合开发者和命令行爱好者提高生产力。
Agent Shell 是一款基于 TypeScript 开发的开源工具,专注于 AI代理、Shell CLI、开发工具 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:npm 全局安装 npm install -g agent-sh # 方式二:npx 直接运行(无需安装) npx agent-sh --help # 方式三:项目依赖安装 npm install agent-sh # 方式四:从源码运行 git clone https://github.com/guanyilun/agent-sh cd agent-sh npm install npm start
# 命令行使用
agent-sh --help
# 基本用法
agent-sh [options] <input>
# Node.js 代码中使用
const agent_sh = require('agent-sh');
const result = await agent_sh.run(options);
console.log(result);
# agent-sh 配置说明 # 查看配置选项 agent-sh --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export AGENT_SH_CONFIG="/path/to/config.yml"
A real shell with an AI agent one keystroke away.

I live in my terminal. A lot of the time I'm not coding — I'm deploying something, poking at a failing rsync, figuring out why docker build won't start, fixing a one-liner. And very often I need an AI agent to help. Spinning up a full coding agent for this stuff is overkill, and I got tired of copy-pasting errors into a chat window every time.
So I built agent-sh. Under the hood it's a normal shell on top of node-pty — your rc config, your aliases, vim and tmux all just work. But at the start of any line, type > and you're talking to a small agent that already sees your cwd, your last command, and its output. Nothing to set up, no project to explain.
~ $ ls -la # real shell command
~ $ cd ../tests && npm test # real cd, env, aliases — all just work
~ $ vim file.ts # opens vim in the same PTY
~ $ > explain the last error # agent investigates using its own tools
~ $ > draft a commit message # agent reads your diff and shell history
agent-sh is built to be agent-agnostic. The recommended path is the built-in agent ash — a lightweight agent designed so extensions can plug into the same tool surface. If you'd rather host an existing coding agent (pi, claude-code, opencode), you can bring your own — with the trade-off that it manages its own separate tools.
Real terminal, zero compromise. Full PTY with your shell config, aliases, and environment. Shell starts instantly — the agent connects asynchronously in the background.
One entry point, smart tool selection. Type > and agent-sh figures out how to help. Scratchpad tools (bash, read_file, grep, glob) for investigation. Extensions add capabilities like running commands in your live shell. No modes to pick — the agent reasons about which tools to use based on your intent.
Context that just works. Every query includes your cwd, recent commands, and their output. Run a failing test, type > fix this, and agent-sh knows exactly what happened. Context management works like shell history — continuous, persistent across restarts, no sessions to manage. See Context Management.
Any LLM, any backend. agent-sh works with any OpenAI-compatible API out of the box. Define multiple providers in settings and switch models at runtime with /model <name>. Or swap in a completely different agent — bundled bridges run pi, claude-code, or opencode as a drop-in backend (see Bring your own agent).
Extensible by design. The entire system is built on a typed event bus. Extensions can add custom input modes, content transforms (render LaTeX as images, Mermaid as diagrams), themes, slash commands, or replace the agent backend entirely. The built-in TUI renderer is itself just an extension.
Embeddable as a library. The core is a headless kernel — import { createCore } from "agent-sh" to build WebSocket servers, REST APIs, Electron apps, or test harnesses. No terminal required.
Install from npm:
npm install -g agent-sh
Re-run the same command to update. Patch releases ship frequently; npm update -g agent-sh works too.
For unreleased changes on main, clone and link locally — this avoids npm install -g github:..., which builds on your machine and requires a working TypeScript toolchain:
git clone https://github.com/guanyilun/agent-sh.git
cd agent-sh
npm install # installs devDependencies (typescript, etc.)
npm run build # produces dist/
npm link # exposes `agent-sh` globally
Requires Node.js 18+. Supports bash, zsh, and fish; other shells (nushell, etc.) are not yet wired up.
Windows: the interactive shell layer is bash/zsh/fish-only. Run agent-sh inside WSL for the full experience. Native Windows (cmd.exe / PowerShell) is not supported as the host shell, though headless / library / ACP-bridge usage may work — file an issue if you hit a gap.
Tip — add a shell alias:
alias ash="agent-sh"
Once installed, pick a backend below.
ash is agent-sh's own lightweight agent, and the path most users should start with: it shares its tool surface with the rest of the system, so extensions you install (new tools, content transforms, slash commands, themes) compose with it directly. It works with any OpenAI-compatible API — pick one of the zero-config paths below, no settings file needed. The built-in providers (openrouter, openai, openai-compatible, deepseek) register on startup; ash activates the first one with a usable key.
Quickest path — store a key once via the auth subcommand:
agent-sh auth login # picks a provider interactively
agent-sh # launches with the saved key
Keys are written to ~/.agent-sh/keys.json (chmod 0600). Resolution order is settings.json → keys.json → env var, so an env var or settings entry will still win when present. auth login also accepts any provider you declare under providers in settings.json — useful for custom OpenAI-compatible endpoints where the URL is committable but the key shouldn't be.
Or export the env var directly:
Hosted models via OpenRouter (300+ models, one key):
export OPENROUTER_API_KEY=sk-or-...
agent-sh
OpenAI:
export OPENAI_API_KEY=sk-...
agent-sh
DeepSeek:
export DEEPSEEK_API_KEY=sk-...
agent-sh
Local models (Ollama, llama.cpp server, LM Studio, vLLM — anything OpenAI-compatible):
export OPENAI_BASE_URL=http://localhost:11434/v1 # point at your server
agent-sh
Set OPENAI_API_KEY too if your server requires auth.
Once running, switch models at any time with /model <name> (tab-completes; selection persists across sessions).
For richer configuration (multiple providers, extensions), run agent-sh init to scaffold ~/.agent-sh/settings.json with copy-pasteable examples. See the Usage Guide for the full list of supported providers.
ash is designed to be extended. Extensions can add tools, content transforms (e.g. render LaTeX or Mermaid), themes, slash commands, or new input modes — see Extensions for the full surface.
If you already use pi, claude-code, or opencode, agent-sh can host it as the backend instead — see Bring your own agent just below for the full setup and the trade-offs.
创新的终端AI集成方案,降低使用门槛。架构灵活可扩展,但stars数较低,生态有待完善。
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
经综合评估,Agent Shell 在AI工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | agent-sh |
| 原始描述 | 开源AI工作流:A shell-first terminal where an AI agent is one keystroke away。⭐36 · TypeScript |
| Topics | AI代理Shell CLI开发工具工作流自动化编码助手 |
| GitHub | https://github.com/guanyilun/agent-sh |
| 语言 | TypeScript |
收录时间:2026-05-21 · 更新时间:2026-05-22 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。