Loading...
Loading...
Compare original and translation side by side
| Use Case | Tool |
|---|---|
| Wrap headless CLI agent | |
| Create new schemas | Schema Creation Guide |
| 使用场景 | 工具 |
|---|---|
| 封装Headless CLI Agent | |
| 创建新Schema | Schema创建指南 |
ANTHROPIC_API_KEY=... bunx @plaited/agent-eval-harness headless --schema .claude/skills/headless-adapters/schemas/claude-headless.jsonANTHROPIC_API_KEY=... bunx @plaited/agent-eval-harness headless --schema .claude/skills/headless-adapters/schemas/claude-headless.jsonbunx @plaited/agent-eval-harness headless --schema <path>| Flag | Description | Required |
|---|---|---|
| Path to adapter schema (JSON) | Yes |
{
"version": 1,
"name": "my-agent",
"command": ["my-agent-cli"],
"sessionMode": "stream",
"prompt": { "flag": "-p" },
"output": { "flag": "--output-format", "value": "stream-json" },
"autoApprove": ["--allow-all"],
"outputEvents": [
{
"match": { "path": "$.type", "value": "message" },
"emitAs": "message",
"extract": { "content": "$.text" }
}
],
"result": {
"matchPath": "$.type",
"matchValue": "result",
"contentPath": "$.content"
}
}| Mode | Description | Use When |
|---|---|---|
| Keep process alive, multi-turn via stdin | CLI supports session resume |
| New process per turn, accumulate history | CLI is stateless |
bunx @plaited/agent-eval-harness headless --schema <path>| 标识 | 描述 | 是否必填 |
|---|---|---|
| 适配器Schema(JSON)的路径 | 是 |
{
"version": 1,
"name": "my-agent",
"command": ["my-agent-cli"],
"sessionMode": "stream",
"prompt": { "flag": "-p" },
"output": { "flag": "--output-format", "value": "stream-json" },
"autoApprove": ["--allow-all"],
"outputEvents": [
{
"match": { "path": "$.type", "value": "message" },
"emitAs": "message",
"extract": { "content": "$.text" }
}
],
"result": {
"matchPath": "$.type",
"matchValue": "result",
"contentPath": "$.content"
}
}| 模式 | 描述 | 使用场景 |
|---|---|---|
| 保持进程存活,通过标准输入实现多轮交互 | CLI支持会话恢复 |
| 每轮交互启动新进程,累积历史记录 | CLI无状态 |
| Schema | Agent | Mode | Auth Env Var | Status |
|---|---|---|---|---|
| Claude Code | stream | | Tested |
| Gemini CLI | iterative | | Tested |
undefined| Schema | Agent | 模式 | 认证环境变量 | 状态 |
|---|---|---|---|---|
| Claude Code | stream | | 已测试 |
| Gemini CLI | iterative | | 已测试 |
undefinedundefinedundefined--helpheadless--helpheadless| Issue | Likely Cause | Solution |
|---|---|---|
| Tool calls not captured | JSONPath not iterating arrays | Use |
| "unexpected argument" error | Stdin mode misconfigured | Use |
| 401 Authentication errors | API key not properly configured | Set the correct API key environment variable (see Pre-built Schemas table) |
| Timeout on prompt | JSONPath not matching | Capture raw CLI output, verify paths - see guide |
| Empty responses | Content extraction failing | Check extract paths - see guide |
| 问题 | 可能原因 | 解决方案 |
|---|---|---|
| 工具调用未被捕获 | JSONPath未遍历数组 | 使用 |
| "unexpected argument"错误 | 标准输入模式配置错误 | 设置 |
| 401认证错误 | API密钥配置不正确 | 设置正确的API密钥环境变量(请参考预构建Schema表格) |
| 提示超时 | JSONPath不匹配 | 捕获CLI原始输出,验证路径 - 查看指南 |
| 空响应 | 内容提取失败 | 检查提取路径 - 查看指南 |