SeaworkSeawork

CLI

Seawork CLI 让你从终端管理智能体。它与守护进程 API 暴露的接口相同,因此应用中能做的一切都可以从命令行完成。

智能体编排:你可以告诉编程智能体使用 Seawork CLI 来生成和管理其他智能体。这使一个智能体能够将子任务委托给其他智能体并等待结果的多智能体工作流成为可能。

快速参考

seawork run "fix the tests"           # Start an agent
seawork ls                             # List running agents
seawork attach <id>                    # Stream agent output
seawork send <id> "also fix linting"  # Send follow-up task
seawork logs <id>                      # View agent timeline
seawork stop <id>                      # Stop an agent

运行智能体

使用 seawork run 以任务启动新智能体:

seawork run "implement user authentication"
seawork run --provider codex "refactor the API layer"
seawork run --detach "run the full test suite"  # background
seawork run --worktree feature-x "implement feature X"
seawork run --output-schema schema.json "extract release notes"
seawork run --output-schema '{"type":"object","properties":{"summary":{"type":"string"}},"required":["summary"]}' "summarize release notes"

--worktree 参数在隔离的 git worktree 中创建智能体,适用于并行功能开发。

使用 --output-schema仅返回匹配的 JSON 输出。可以传递 schema 文件路径或内联 JSON schema 对象。此模式不能与 --detach一起使用。

默认情况下, seawork run 等待完成。使用 --detach 在后台运行。

列出智能体

seawork ls                    # Running agents in current directory
seawork ls -a                 # Include completed/stopped agents
seawork ls -g                 # All directories
seawork ls -a -g --json       # Full list as JSON

流式输出

使用 seawork attach 实时流式传输智能体的输出:

seawork attach abc123   # Attach to agent (Ctrl+C to detach)

智能体 ID 可以缩短——如果不模糊, abc 即可使用。

发送消息

向运行中或空闲的智能体发送后续任务:

seawork send <id> "now run the tests"
seawork send <id> --image screenshot.png "what's wrong here?"
seawork send <id> --no-wait "queue this task"

查看日志

seawork logs <id>                  # Full timeline
seawork logs <id> -f               # Follow (streaming)
seawork logs <id> --tail 10        # Last 10 entries
seawork logs <id> --filter tools   # Only tool calls

等待智能体

阻塞直到智能体完成当前任务:

seawork wait <id>
seawork wait <id> --timeout 60   # 60 second timeout

在脚本中或当一个智能体需要等待另一个时很有用。

权限

智能体可能会请求某些操作的权限。从 CLI 管理这些:

seawork permit ls                # List pending requests
seawork permit allow <id>        # Allow all pending for agent
seawork permit deny <id> --all   # Deny all pending

智能体模式

更改智能体的操作模式(特定于提供商):

seawork agent mode <id> --list   # Show available modes
seawork agent mode <id> bypass   # Set bypass mode
seawork agent mode <id> plan     # Set plan mode

守护进程管理

seawork daemon start             # Start the daemon
seawork daemon status            # Check status
seawork daemon stop              # Stop the daemon

使用 SEAWORK_HOME 运行多个隔离的守护进程实例。

多智能体工作流

CLI 设计为可被智能体自身使用。你可以指示智能体生成子智能体进行并行工作:

# Agent A spawns Agent B and waits for it
seawork run --detach "implement the API" --name api-agent
seawork wait api-agent
seawork logs api-agent --tail 5

简单的实现 + 验证循环:

# Requires jq
while true; do
  seawork run --provider codex "make the tests pass" >/dev/null

  verdict=$(seawork run --provider claude --output-schema '{"type":"object","properties":{"criteria_met":{"type":"boolean"}},"required":["criteria_met"],"additionalProperties":false}' "ensure tests all pass")
  if echo "$verdict" | jq -e '.criteria_met == true' >/dev/null; then
    echo "criteria met"
    break
  fi
done

这种模式实现了层级任务分解——主导智能体可以分解工作、委托给专家,并综合结果。

输出格式

大多数命令支持多种输出格式以便脚本使用:

seawork ls --json                # JSON output
seawork ls --format yaml         # YAML output
seawork ls -q                    # IDs only (quiet)

全局选项

  • --host <host:port> ——连接到不同的守护进程
  • --json ——JSON 输出
  • -q, --quiet ——最简输出
  • --no-color ——禁用颜色