混音代理运行时
LLM驱动的自主代理运行时,用于浏览器自动化和软件工程。用简单的英语给它一个任务,它使用LLM来控制一个真正的Chrome浏览器,编写代码,运行测试,并端到端地解决问题。
运作原理
remix-agent-runtime
┌───────────────────────────────────────────────────────────┐
│ │
│ "Log into GitHub and star the remix-browser repo" │
│ │ │
│ ▼ │
│ AGENTS.md ──► ┌────────────────┐ ◄── Credentials │
│ instructions │ Agent Loop │ (remix-credentials) │
│ └───────┬────────┘ │
│ ▲ │ │
│ results │ │ tool calls │
│ │ ▼ │
│ ┌──────────────┴──────────────────────────────────┐ │
│ │ Decorator Chain │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────┐ │ │
│ │ │ CoordinationExecutor (7 coord tools) │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────┴──────────────────────┐ │ │
│ │ │ PermissionAwareExecutor (4 modes) │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────┴──────────────────────┐ │ │
│ │ │ HookAwareExecutor (pre/post tool hooks) │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────┴──────────────────────┐ │ │
│ │ │ LocalToolsExecutor (7 sandboxed tools) │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────┴──────────────────────┐ │ │
│ │ │ SkillAwareExecutor (3 skill tools) │ │ │
│ │ └──────────────────┬──────────────────────┘ │ │
│ │ │ │ │
│ │ ┌──────────────────┴──────────────────────┐ │ │
│ │ │ CompositeToolExecutor (MCP backends) │ │ │
│ │ └────┬────────────────────────────────────┘ │ │
│ └───────┼────────────────────────────────────────┘ │
│ │ │
│ ┌─────────┘ ┌──────────────────────┐ │
│ │ │ Sandboxed filesystem │ │
│ ▼ │ (Seatbelt/Landlock) │ │
│ remix-browser └──────────────────────┘ │
│ (MCP Server) │
│ │ │
└───────┼──────────────────────────────────────────────────┘
│ CDP
▼
┌──────────────┐
│ Chrome │
└──────────────┘- 您以自然语言提供任务
- 代理将任务+可用工具发送给LLM
- LLM决定调用哪些工具(导航、单击、键入、read_file、bash等)
- 工具调用通过装饰器链:钩子触发,本地工具和技能被拦截,其他所有内容都路由到浏览器MCP后端
- 结果返回到LLM,LLM决定下一步行动
- 循环将继续,直到任务完成或满足停止条件
- 结构化JSON输出,记录每一步
混音生态系统
| 项目 | 角色 |
|---|---|
| 混音浏览器 | 用于Chrome自动化的Rust原生MCP服务器——18多种导航、点击、打字、截图、网络监控等工具 |
| 混音凭证 | 使用AES-256-GCM加密、Argon2d密钥推导和可归零内存进行安全凭证管理 |
| 混音代理运行时 (这个项目) | 将它们联系在一起的代理循环——将LLM连接到浏览器工具并自主运行 |
快速启动
先决条件
- 谷歌Chrome或Chromium
- 来自支持的LLM提供商(Anthropic、OpenRouter、AWS Bedrock等)的API密钥
安装
一个命令同时安装两个 remix-agent 和 remix-browser --不需要Rust工具链:
curl -fsSL https://raw.githubusercontent.com/hkd987/remix-agent-runtime/main/scripts/install.sh | sh如果你已经有了 remix-browser 安装后,脚本会检测到它并仅安装代理。
From source
需要 锈 1.88+:
# Install remix-browser
curl -fsSL https://raw.githubusercontent.com/hkd987/remix-browser/main/scripts/install.sh | sh
# Build remix-agent from source
git clone https://github.com/hkd987/remix-agent-runtime.git
cd remix-agent-runtime && cargo build --release
cp target/release/remix-agent /usr/local/bin/预构建的二进制文件可用于macOS(Apple Silicon和Intel)、Linux x86_64和Windows x86_64。看 发布 对于所有下载。
运行你的第一个任务
export REMIX_LLM_API_KEY=sk-ant-your-key-here
remix-agent run "Navigate to example.com and tell me what's on the page"用法
命令行界面
remix-agent run [OPTIONS] [TASK]核心:
| 标志 | 短 | 环境变量 | 描述 |
|---|---|---|---|
| `--config | |||
| ` | -c | -- | YAML配置文件的路径 |
--api-key | -- | REMIX_LLM_API_KEY | LLM提供程序API密钥 |
--base-url | -- | REMIX_LLM_BASE_URL | LLM提供者基本URL(默认值:Anthropic) |
--model | -- | REMIX_LLM_MODEL | 型号ID(默认值: claude-sonnet-4-20250514) |
--max-tokens | -- | -- | 每个响应的最大令牌数(默认值:8192) |
--thinking-budget-tokens | -- | -- | 用于扩展思维的思考/推理预算令牌 |
--timeout | -- | -- | 最大持续时间(秒) |
--max-iterations | -- | -- | 最大代理循环迭代次数(默认值:50) |
--system-prompt | -- | -- | 自定义系统提示 |
--effort | -- | -- | 努力程度: low, medium, high, max |
--verbose | -v | -- | 将日志记录调试到stderr |
| `--output | |||
| ` | -o | -- | 将JSON结果写入文件 |
浏览器:
| 标志 | 环境变量 | 描述 |
|---|---|---|
--headed | -- | 显示浏览器窗口 |
--no-browser | -- | 仅终端模式(无浏览器连接) |
| `--browser-path | ||
| ` | REMIX_BROWSER_PATH | 重新混合浏览器二进制文件的路径 |
代理行为:
| 标志 | 描述 |
|---|---|
--nudge-on-text-only | 当LLM返回没有工具调用的文本时,轻按LLM |
--nudge-max-count | 终止前最多只能轻推文本(默认值:3) |
--goal-check-on-complete | 终止前验证目标完成情况 |
--action-reminder-interval | 每N次迭代注入进度提醒 |
--tool-result-max-bytes | 每个工具结果的最大字节数(默认值:32768) |
--context-window | 覆盖上下文窗口大小以进行压缩 |
--disable-compaction | 禁用自动上下文压缩 |
回路检测:
| 标志 | 描述 |
|---|---|
--loop-detection | 使用默认设置启用循环检测 |
--loop-detection-max-repeats | 警告前的最大相同工具调用数(默认值:3) |
--loop-detection-window | 回顾窗口大小(默认值:10) |
--loop-detection-max-failures | 语义循环警告前没有文件写入的最大失败命令数(默认值:4) |
推理阶段:
| 标志 | 描述 |
|---|---|
--reasoning-stages | 在规划/执行/验证阶段实现自适应思维预算 |
--planning-budget-tokens | 规划阶段的思考符号(默认值:10000) |
--execution-budget-tokens | 执行阶段的思考令牌(默认值:5000) |
--verification-budget-tokens | 验证阶段的思考令牌(默认值:10000) |
--iteration-budget-warning-threshold | 在最大迭代次数的这个分数(例如0.7)时警告代理 |
发现和插件:
| 标志 | 环境变量 | 描述 |
|---|---|---|
| `--agents-md-dir | ||
| ` | REMIX_AGENTS_MD_DIR | 覆盖AGENTS.md搜索目录 |
--no-agents-md | -- | 禁用AGENTS.md发现 |
--no-local-tools | -- | 禁用本地文件系统工具 |
| `--sandbox-dir | ||
| ` | REMIX_SANDBOX_DIR | 本地工具的沙盒根 |
| `--skills-dir | ||
| ` | REMIX_SKILLS_DIR | 附加技能目录 |
--no-skills | -- | 禁用技能发现 |
--no-plugins | -- | 禁用所有插件发现 |
| `--plugins-dir | ||
| ` | REMIX_PLUGINS_DIR | 附加插件目录 |
--no-claude-plugins | -- | 禁用Claude代码插件缓存 |
开发工具:
| 标志 | 描述 |
|---|---|
--no-dev-tools | 禁用所有开发工具(LSP、测试工具、仓库映射) |
--no-lsp | 禁用LSP集成 |
--no-test-harness | 禁用测试线束工具 |
--no-repo-map | 禁用仓库映射工具 |
--lsp-server | 覆盖语言的LSP服务器(例如。, rust=rust-analyzer) |
会议:
| 标志 | 环境变量 | 描述 |
|---|---|---|
--session-id | -- | 恢复现有会话 |
--fork-session | -- | 从现有会话分叉 |
--continue | -- | 恢复最近的会话 |
| `--session-dir | ||
| ` | REMIX_SESSION_DIR | 覆盖会话存储目录 |
权限:
| 标志 | 描述 |
|---|---|
--permission-mode | default, accept_edits, bypass_permissions, plan |
| `--allow-tool | |
| ` | 自动允许工具的正则表达式模式(可重复) |
| `--deny-tool | |
| ` | 被拒绝工具的正则表达式模式(可重复) |
协调:
| 标志 | 环境变量 | 描述 |
|---|---|---|
--no-coordination | -- | 禁用多代理协调 |
--max-workers | -- | 最大并发工作代理数(默认值:5) |
| `--coordination-dir | ||
| ` | REMIX_COORDINATION_DIR | 覆盖协调存储目录 |
SSE流媒体 (要求 sse 功能):
| 标志 | 环境变量 | 描述 |
|---|---|---|
| `--sse-port | ||
| ` | REMIX_SSE_PORT | 实时SSE事件服务器端口 |
示例
# Browser automation
remix-agent run "Take a screenshot of hacker news"
# Watch the browser work (headed mode)
remix-agent run --headed "Fill out the contact form on example.com"
# Terminal-only coding agent (no browser)
remix-agent run --no-browser "Fix the failing tests in src/utils.ts"
# Coding with loop detection and reasoning stages
remix-agent run --no-browser \
--loop-detection \
--reasoning-stages \
--max-iterations 100 \
"Refactor the database module to use connection pooling"
# Use a specific model
remix-agent run --model claude-opus-4-20250805 "Complex multi-step task here"
# Save structured output
remix-agent run --output results.json "Find the price of item X on site Y"
# Full config file
remix-agent run --config task.yaml --verbose
# Resume where you left off
remix-agent run --continue "keep going"
# With a local plugin
remix-agent run --plugins-dir ./my-plugin "Run my custom workflow"使用不同的LLM提供商
运行时可与任何公开与Anthropic Messages API兼容的终结点的提供程序一起使用。只需更改 --base-url 和 --model:
# Anthropic (default)
remix-agent run --api-key sk-ant-xxx "Your task"
# OpenRouter
remix-agent run \
--base-url https://openrouter.ai/api \
--api-key sk-or-xxx \
--model anthropic/claude-sonnet-4 \
"Your task"
# AWS Bedrock (via proxy)
remix-agent run \
--base-url https://your-bedrock-proxy.com \
--api-key your-key \
--model anthropic.claude-sonnet-4-20250514-v1:0 \
"Your task"
# Any compatible provider
remix-agent run \
--base-url https://your-provider.com \
--model your-model-id \
--api-key your-key \
"Your task"可以通过YAML配置为需要的提供者添加自定义标头:
llm:
base_url: "https://your-provider.com"
api_key: "your-key"
model: "your-model"
custom_headers:
X-Provider-Key: "value"
HTTP-Referer: "https://your-app.com"配置
CLI标志覆盖环境变量,环境变量覆盖YAML配置,YAML配置覆盖默认值。
YAML配置文件
task: "Log into the dashboard and export the monthly report"
llm:
api_key: "${ANTHROPIC_API_KEY}"
model: "claude-sonnet-4-20250514"
max_tokens: 8192
thinking_budget_tokens: 10000 # Extended thinking budget
enable_prompt_caching: true # Cache system prompts (default: true)
custom_headers: # Provider-specific headers
HTTP-Referer: "https://your-app.com"
agent:
max_iterations: 50
timeout_secs: 300
system_prompt: |
You are an expert automation agent.
Complete the task efficiently and report what you find.
tool_result_max_bytes: 32768 # Truncate large tool outputs
nudge_on_text_only: false # Nudge LLM when it returns only text
nudge_max_count: 3 # Max nudges before terminating
goal_check_on_complete: false # Verify goal before terminating
action_reminder_interval: 15 # Inject progress reminder every N iterations
iteration_budget_warning_threshold: 0.7 # Warn at 70% of max iterations
loop_detection:
max_repeats: 3 # Identical tool calls before warning
window_size: 10 # Only check last N steps
max_failures_without_write: 4 # Semantic loop: failing without editing
reasoning_stages:
planning_budget_tokens: 10000 # Deep thinking for planning (0-30% of iterations)
execution_budget_tokens: 5000 # Fast execution (30-80%)
verification_budget_tokens: 10000 # Careful verification (80-100%)
planning_threshold: 0.3
verification_threshold: 0.8
browser:
enabled: true # Set false for terminal-only mode
headless: true
viewport_width: 1280
viewport_height: 720
credentials:
- name: "dashboard_login"
credential_type: username_password
username: "${DASHBOARD_USER}"
password: "${DASHBOARD_PASS}"
url_pattern: "*.internal.company.com"
agents_md:
enabled: true
search_dir: "/path/to/project"
max_size_bytes: 32768
local_tools:
enabled: true
sandbox_dir: "/path/to/sandbox"
bash_timeout_secs: 120
read_max_bytes: 1048576 # 1MB
write_max_bytes: 10485760 # 10MB
web_fetch_timeout_secs: 30
web_fetch_max_bytes: 102400 # 100KB
skills:
dirs:
- "/path/to/skills"
enabled: true
script_timeout_secs: 60
plugins:
enabled: true
claude_code_cache: true
hook_timeout_secs: 30
sources:
- path: "/path/to/local-plugin"
- github: "owner/repo"
git_ref: "v1.0"
components:
skills: true
mcp_servers: true
hooks: true
agents: true
session:
enabled: true
storage_dir: "~/.remix/sessions"
max_sessions: 100
compaction:
enabled: true
trigger_threshold: 0.95
context_window_tokens: 200000
preserve_recent_n: 4
permissions:
mode: default # default | accept_edits | bypass_permissions | plan
allowed_tools:
- "navigate|click|screenshot"
denied_tools:
- "bash"
coordination:
enabled: true
max_workers: 5
max_worker_iterations: 10
worker_timeout_secs: 120
storage_dir: "~/.remix/coordination"
dev_tools:
enabled: true
lsp:
enabled: true
request_timeout_secs: 30
server_overrides: # Override LSP server per language
rust: "rust-analyzer"
test_harness:
enabled: true
timeout_secs: 300
repo_map:
enabled: true
max_files: 5000
max_depth: 10
on_complete:
url: "https://hooks.slack.com/your-webhook"
format: "json"
on_error:
url: "https://hooks.slack.com/your-error-webhook"
format: "json"可以使用以下方法在YAML中插值环境变量 ${VAR_NAME} 语法。
凭证
凭据通过以下方式安全管理 混音凭证 --值使用可归零的内存,并从日志中编辑。
credentials:
# Username/password login
- name: "site_login"
credential_type: username_password
username: "admin"
password: "secret"
url_pattern: "*.example.com"
# API key
- name: "api_auth"
credential_type: api_key
fields:
api_key: "sk-xxxxx"
# Custom fields
- name: "oauth_creds"
credential_type: custom
fields:
client_id: "id123"
client_secret: "secret456"
tenant: "acme"支持的凭据类型: username_password, api_key, token, cookie, custom.
代理商.md
代理支持 代理商.md 项目级指令标准。启用后,代理从搜索目录(或当前工作目录)向上走到文件系统根目录,收集所有 AGENTS.md 它找到的文件。
- 文件按从根到叶的顺序排列(首先是一般说明,最后是特定于项目的说明)
- 默认情况下,连接的内容上限为32KB(
max_size_bytes) - 注入系统提示包裹 `
` 标签
- 用以下内容覆盖搜索目录
--agents-md-dir或REMIX_AGENTS_MD_DIR - 禁用
--no-agents-md
本地工具
启用后,代理可以访问七个沙盒文件系统和shell工具:
| 工具 | 说明 |
|---|---|
read_file | 使用可选偏移量/限制读取文件内容 |
write_file | 将内容写入文件(创建父目录) |
edit_file | 查找并替换文件中的精确字符串 |
bash | 在沙盒中执行shell命令 |
grep | 正则表达式在具有上下文的文件中搜索 |
glob | 查找与glob模式匹配的文件 |
web_fetch | 获取一个URL并将内容作为markdown返回 |
所有文件操作都限制在沙盒目录中。使用 --sandbox-dir 或 REMIX_SANDBOX_DIR 设置根。禁用 --no-local-tools.
沙盒
本地工具在操作系统级别被沙盒化:
- macOS:安全带配置文件将文件访问和网络限制在沙盒目录
- Linux:Landlock LSM限制文件系统访问(旧内核回退)
- 路径验证:解析所有文件工具路径,并对照沙盒根进行检查
- 超时:Bash命令在配置的超时后被终止(默认值:120秒)
技能
技能遵循 AgentSkills.io 网站 标准。它们提供了可重用的指令和脚本,代理可以按需加载。
Discovery按以下顺序搜索这些目录:
./skills/(项目本地)~/.remix/skills/(用户全局)--skills-dirCLI标志或REMIX_SKILLS_DIRenv 是- YAML
skills.dirs条目 - 插件贡献的技能
当发现技能时,会添加三个虚拟工具:
load_skill--将技能说明载入上下文run_skill_script--从技能中执行脚本scripts/目录read_skill_resource--从技能目录中读取文件
禁用 --no-skills.
插件
插件系统通过额外的技能、MCP服务器、钩子和外部来源的代理扩展了代理。插件有三个来源:
- 克劳德代码缓存 (
~/.claude/plugins/installed_plugins.json)--自动发现Claude Code安装的插件 - 本地目录 --通过配置或指向磁盘上的插件目录
--plugins-dir - GitHub 仓库 --通过配置克隆和缓存插件仓库
插件是一个包含以下任意组合的目录:
my-plugin/
├── skills/ # Skill definitions (merged into SkillSet)
│ └── my-skill/
│ └── SKILL.md
├── hooks/ # Pre/post tool-use hooks
│ └── hooks.json
├── agents/ # Agent definitions (injected into system prompt)
│ └── researcher.md
└── .mcp.json # MCP server configuration每种组件类型都可以通过以下方式单独启用或禁用 plugins.components 在YAML配置中。
钩子
钩子在工具调用之前和/或之后发出shell命令。它们通过stdin接收JSON上下文,其中包含工具名称、输入参数和(对于post钩子)工具输出。钩子失败会被记录下来,永远不会阻塞代理循环。
{
"hooks": {
"PreToolUse": [
{
"matcher": "navigate|click",
"hooks": [{ "type": "command", "command": "echo pre-hook ran" }]
}
],
"PostToolUse": [
{
"matcher": "screenshot",
"hooks": [{ "type": "command", "command": "./process-screenshot.sh" }]
}
]
}
}匹配器使用正则表达式模式(管道分隔的替代方案,锚定到完整的工具名称)。
插件代理
代理定义是带有YAML frontmatter的markdown文件。发现的代理被注入系统提示中,以便LLM知道它们可用:
---
name: researcher
description: Searches the web for information
model: claude-sonnet-4-20250514
tools:
- web_search
- read_file
---
# Researcher Agent
You are a research specialist...CLI标志
| 标志 | 环境变量 | 描述 |
|---|---|---|
--no-plugins | -- | 禁用所有插件发现 |
| `--plugins-dir | ||
| ` | REMIX_PLUGINS_DIR | 附加插件目录 |
--no-claude-plugins | -- | 禁用Claude Code插件缓存发现 |
多智能体协调
代理可以生成和协调多个子代理并行处理任务。首席代理将工作分解为子任务,将其分配给员工,并收集结果——所有这些都是通过七个虚拟工具完成的:
| 工具 | 说明 |
|---|---|
task_create | 使用主题、描述和元数据创建新任务 |
task_list | 列出所有任务及其状态和所有权 |
task_get | 获取特定任务的完整详细信息 |
task_update | 更新任务状态、主题、描述或依赖关系 |
team_create | 创建一个命名的代理团队 |
send_message | 向其他代理的收件箱发送消息 |
spawn_agent | 生成一个具有名称、任务和可选工具筛选器的新工作代理 |
工作流程:首席代理创建一个团队,创建任务,培养工人来申请和执行任务,通过以下方式进行沟通 send_message,工作人员在任务完成时标记任务已完成。工作人员在循环迭代之间检查收件箱,并将消息作为注入的上下文接收。
所有协调状态(任务、团队、收件箱)都通过原子写入持久化到磁盘,以确保崩溃安全。
coordination:
enabled: true
max_workers: 5
max_worker_iterations: 10
worker_timeout_secs: 120
storage_dir: ~/.remix/coordination禁用 --no-coordination.用以下内容覆盖工人限制 --max-workers 以及存储位置 --coordination-dir.
会话
会话会保留完整的对话历史记录,以便您可以继续或分叉之前的运行。
每个会话都存储在 ~/.remix/sessions/{session_id}/ 包含:
metadata.json--会话ID、状态、时间戳、任务描述messages.jsonl--仅附加所有LLM消息的日志steps.json--每次工具调用和结果的结构化记录
| 操作 | CLI |
|---|---|
| 恢复会话 | remix-agent run --session-id "continue the task" |
| 从会话中分叉 | remix-agent run --fork-session "try a different approach" |
| 自定义存储目录 | remix-agent run --session-dir /path/to/sessions |
session:
enabled: true
storage_dir: ~/.remix/sessions
max_sessions: 100权限
权限控制代理可以在没有用户确认的情况下调用哪些工具。
| 模式 | 描述 |
|---|---|
default | 每次工具调用前询问用户 |
accept_edits | 自动允许写入工具(write_file、edit_file、bash),请求其他工具 |
bypass_permissions | 无需询问即可使用所有工具 |
plan | 只读模式——只允许Read_file、grep、glob、load_skill、Read_skill_resource |
政策评估顺序: bypass_permissions > plan 模式> denied_tools (正则表达式)> allowed_tools (正则表达式)>询问用户。
# Run in plan mode (read-only exploration)
remix-agent run --permission-mode plan "Analyze the codebase structure"
# Auto-allow specific tools
remix-agent run --allow-tool "navigate|click|screenshot" "Take screenshots of each page"
# Deny dangerous tools
remix-agent run --deny-tool "bash|write_file" "Read and summarize the logs"permissions:
mode: default
allowed_tools:
- "navigate|click|screenshot"
denied_tools:
- "bash"上下文压缩
当对话接近模型的上下文窗口限制时,代理会自动将旧消息压缩为摘要。这允许长时间运行的任务继续进行,而不会达到令牌限制。
- 触发:何时
total_input_tokens >= trigger_threshold * context_window_tokens - 过程:旧消息由LLM总结,并替换为紧凑型消息 `` 块
- 保存:最近的N条消息始终保持不变
compaction:
enabled: true
trigger_threshold: 0.95
context_window_tokens: 200000
preserve_recent_n: 4循环检测
该代理包括两层循环检测,以防止浪费迭代:
精确匹配检测 捕获代理重复调用具有相同参数的同一工具。它哈希 (tool_name, canonical_json(input)) 并在滑动窗口内重复计数。
语义循环检测 捕捉到一个更微妙的模式:代理在不修改代码的情况下运行失败的命令。这检测到“无编辑测试”循环,其中代理改变命令语法(例如。, python test.py 对比 python -m pytest test.py)以避免在没有进展的情况下进行精确匹配检测。
agent:
loop_detection:
max_repeats: 3 # Exact-match threshold
window_size: 10 # Lookback window
max_failures_without_write: 4 # Semantic loop threshold当触发时,对话中会注入一个警告,告诉代理停止重新测试并编辑其代码。
推理阶段
推理阶段根据代理在迭代生命周期中的位置动态调整LLM的思维预算:
| 阶段 | 迭代 | 默认预算 | 目的 |
|---|---|---|---|
| 规划 | 0-30% | 10000个代币 | 深入分析、读取代码、形成策略 |
| 执行 | 30-80% | 5000个令牌 | 快速工具调用,编写代码 |
| 验证 | 80-100% | 10000个令牌 | 仔细审查、运行测试、修复边缘案例 |
agent:
reasoning_stages:
planning_budget_tokens: 10000
execution_budget_tokens: 5000
verification_budget_tokens: 10000
planning_threshold: 0.3
verification_threshold: 0.8启用 --reasoning-stages 在CLI上。与…结合 --iteration-budget-warning-threshold 0.7 当代理已经使用了其迭代的70%时,注入一次性警告。
开发工具
该代理可以与语言服务器和测试框架集成,以实现代码智能。
| 工具 | 说明 |
|---|---|
| 语言服务器协议 | 类型检查,转到定义,通过语言服务器(信任分析器、打字脚本语言服务器、版权等)查找引用 |
| 测试线束 | 使用框架自动检测(cargo测试、pytest、jest、go测试等)和结构化结果收集运行测试 |
| 回购地图 | 使用树状图解析生成代码库结构概述 |
dev_tools:
enabled: true
lsp:
enabled: true
request_timeout_secs: 30
server_overrides:
rust: "rust-analyzer"
test_harness:
enabled: true
timeout_secs: 300
repo_map:
enabled: true
max_files: 5000
max_depth: 10单独禁用 --no-lsp, --no-test-harness, --no-repo-map,或同时与 --no-dev-tools。repo映射需要 dev-tools 用于树保姆支撑的货物功能。
网络钩子
任务完成或失败时收到通知:
on_complete:
url: "https://your-server.com/task-done"
format: "json"
on_error:
url: "https://your-server.com/task-failed"
format: "json"SSE事件流
随着 sse 启用货物功能后,代理可以通过服务器发送事件流式传输实时事件,以进行UI集成:
remix-agent run --sse-port 3000 "Your task here"终点:
GET /events--SSE代理事件流(工具调用、结果、完成)GET /health--活体检查
输出
代理生成结构化的JSON输出,其中包含每个步骤的完整记录:
{
"status": "success",
"result": "Found the login button and signed in successfully",
"total_iterations": 3,
"total_duration_ms": 8420,
"total_input_tokens": 45230,
"total_output_tokens": 3120,
"total_cost_usd": 0.0523,
"steps": [
{
"iteration": 1,
"tool": "navigate",
"input": { "url": "https://example.com" },
"output": { "title": "Example" },
"duration_ms": 3200
},
{
"iteration": 2,
"tool": "click",
"input": { "selector": "#login-btn" },
"output": { "success": true },
"duration_ms": 1890
}
]
}可用的浏览器工具
代理有权访问由以下人员公开的所有工具 混音浏览器:
| 类别 | 工具 |
|---|---|
| 导航 | navigate, go_back, go_forward, reload, get_page_info |
| 文档对象模型 | find_elements, get_text, get_html, wait_for |
| 交互 | click, type_text, hover, select_option, press_key, scroll |
| 截图 | screenshot (视口、整页或元素) |
| JavaScript | execute_js, read_console |
| 网络 | network_enable, get_network_log |
| 标签页 | new_tab, close_tab, list_tabs |
元素可以使用CSS选择器、文本内容或XPath表达式作为目标。
基准测试
混音代理运行时包括 港湾 用于运行标准化编码基准的适配器。适配器已插入 harbor-adapter/ 并注册为海关港口代理。
# Run against Terminal-Bench 2.0 (89 coding tasks)
harbor run \
-d "terminal-bench@2.0" \
--agent-import-path "remix_agent_harbor:RemixAgent" \
-m anthropic/claude-sonnet-4-6 \
--ae "REMIX_LLM_API_KEY=$REMIX_LLM_API_KEY" \
-o benchmark-results
# Run a subset of tasks
harbor run \
-d "terminal-bench@2.0" \
-t "specific-task-name" \
-l 10 \
--agent-import-path "remix_agent_harbor:RemixAgent" \
-m anthropic/claude-sonnet-4-6货物特征
运行时附带三个可选功能标志:
| 特性 | 依赖关系 | 描述 |
|---|---|---|
postgres | sqlx | PostgreSQL会话存储后端 |
sse | axum | 实时SSE事件流服务器 |
dev-tools | 树保姆,树保姆-{rust、typescript、python、javascript} | 通过树保姆解析实现代码智能 |
# Build with all features
cargo build --release --features postgres,sse,dev-tools
# Build with just SSE
cargo build --release --features sse发展
# Build
cargo build --release
# Run all tests (sequential to avoid env var conflicts)
cargo test -- --test-threads=1
# Lint
cargo clippy -- -D warnings
# Format check
cargo fmt --check建筑
运行时使用 装饰连锁店 模式,其中每一层拦截其拥有的工具调用,并将其他所有内容委托给下一层:
CoordinationExecutor ← multi-agent coordination (7 tools)
└─ PermissionAwareExecutor ← permission checking (4 modes)
└─ HookAwareExecutor ← fires pre/post hooks around every tool call
└─ LocalToolsExecutor ← intercepts read_file, write_file, edit_file, bash, grep, glob, web_fetch
└─ SkillAwareExecutor ← intercepts load_skill, run_skill_script, read_skill_resource
└─ CompositeToolExecutor ← routes to MCP backends (remix-browser, plugins)所有组件均执行 ToolExecutor trait,使每一层都可以用mock独立测试。这 LlmProvider trait出于同样的原因抽象了LLM HTTP客户端。
src/
├── main.rs # CLI entry point, decorator chain wiring
├── cli.rs # Argument parsing (clap)
├── lib.rs # Public module re-exports
├── error.rs # Error types and exit codes
├── agent/
│ ├── loop_impl.rs # Core agent loop (AgentRunner)
│ ├── state.rs # Message history + step recording
│ ├── compaction.rs # Context compaction logic
│ ├── compaction_prompt.rs # Compaction system prompt
│ ├── loop_detection.rs # Exact-match + semantic loop detection
│ ├── reasoning_stages.rs # Adaptive thinking budget phases
│ ├── reminders.rs # Action reminder injection
│ ├── lsp_tools.rs # LSP integration (dev tools)
│ ├── test_harness.rs # Test framework detection + execution
│ └── repo_map.rs # Codebase structure via tree-sitter
├── agents_md/
│ ├── mod.rs # Public API re-exports
│ └── discovery.rs # AGENTS.md walk + injection
├── browser/
│ ├── mcp.rs # MCP client + ToolExecutor trait definition
│ ├── manager.rs # Browser process lifecycle
│ └── convert.rs # MCP → Anthropic schema conversion
├── config/
│ ├── mod.rs # Config merging (CLI > env > YAML > defaults)
│ ├── schema.rs # AppConfig, LlmConfig, PluginsConfig, etc.
│ ├── credentials.rs # Credential adapter (RawCredential → CredentialSet)
│ └── env.rs # ${VAR} interpolation
├── coordination/
│ ├── mod.rs # Public API re-exports
│ ├── context.rs # CoordinationContext (shared state)
│ ├── executor.rs # CoordinationExecutor decorator
│ ├── shared_executor.rs # SharedToolExecutor for worker agents
│ ├── task_types.rs # Task, TaskStatus, TaskId
│ ├── task_store.rs # TaskStore (RwLock + file persistence)
│ ├── team_types.rs # Team, TeamId, WorkerInfo
│ ├── team_store.rs # TeamStore (RwLock + file persistence)
│ ├── inbox_types.rs # InboxMessage, InboxId
│ └── inbox_store.rs # InboxStore (RwLock + file persistence)
├── llm/
│ ├── client.rs # Anthropic HTTP client with retry
│ └── types.rs # Message, ContentBlock, ToolDefinition
├── local_tools/
│ ├── mod.rs # Public API re-exports
│ ├── executor.rs # LocalToolsExecutor decorator
│ ├── sandbox/
│ │ ├── mod.rs # BashSandbox trait + factory
│ │ ├── path_validator.rs # Sandbox path enforcement
│ │ ├── seatbelt.rs # macOS sandbox-exec wrapper
│ │ └── landlock.rs # Linux Landlock LSM wrapper
│ └── tools/
│ ├── mod.rs # Tool module re-exports
│ ├── read_file.rs # read_file tool
│ ├── write_file.rs # write_file tool
│ ├── edit_file.rs # edit_file tool
│ ├── bash.rs # bash tool
│ ├── grep.rs # grep tool
│ ├── glob_tool.rs # glob tool
│ ├── web_fetch.rs # web_fetch tool
│ └── output_filter.rs # Shared truncation + ANSI stripping
├── output/
│ ├── result.rs # AgentResult, StepRecord
│ ├── webhook.rs # Webhook dispatcher
│ ├── events.rs # Event bus (broadcast channel)
│ └── sse_server.rs # Axum SSE server (optional)
├── permissions/
│ ├── mod.rs # Public re-exports
│ ├── types.rs # PermissionMode, PermissionPolicy
│ └── executor.rs # PermissionAwareExecutor decorator
├── plugins/
│ ├── mod.rs # Public re-exports
│ ├── types.rs # PluginSet, ResolvedPlugin, PluginComponents
│ ├── discovery.rs # discover_all_plugins, resolve_local_dir
│ ├── github.rs # Git clone/update for GitHub plugins
│ ├── composite_executor.rs # CompositeToolExecutor (multi-backend routing)
│ ├── hook_executor.rs # HookAwareExecutor decorator
│ └── components/
│ ├── skills.rs # merge_plugin_skills into SkillSet
│ ├── hooks.rs # HookRegistry, hooks.json parsing
│ ├── agents.rs # Agent .md parsing + system prompt injection
│ └── mcp.rs # Plugin MCP server configuration
├── session/
│ ├── mod.rs # Public re-exports
│ ├── types.rs # SessionId, SessionMetadata, SessionSnapshot
│ └── store.rs # SessionStore (create, load, fork, append)
├── skills/
│ ├── mod.rs # Public API re-exports
│ ├── discovery.rs # Skill discovery + SKILL.md parsing
│ ├── executor.rs # SkillAwareExecutor decorator
│ └── types.rs # SkillSet, SkillEntry, SkillMetadata
└── subagent/
├── mod.rs # Public re-exports
├── types.rs # SubagentDefinition, SpawnRequest
├── executor.rs # SubagentExecutor decorator
└── filtered_executor.rs # FilteredToolExecutor (regex tool filtering)许可证
麻省理工学院
