Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Was this page helpful?
Claude Managed Agents 在 Claude Console 中提供可观测性工具,帮助您监控、调试和了解您的 Agent 会话。
Console 提供 Agent 会话的可视化时间线视图。在 Console 中导航到 Claude Managed Agents 部分,您可以看到:
如需以编程方式进行调试,可通过 API 获取原始事件:
curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
| jq -r '
.data[]
| "Type: \(.type)",
"Processed: \(.processed_at)",
( if .type | IN("user.message", "agent.message") then
.content[]
| " Block: \(.type)",
(select(.type == "text") | " Text: \(.text[:100])...")
elif .type | IN("agent.tool_use", "agent.custom_tool_use", "agent.mcp_tool_use") then
" Tool: \(.name)"
else empty end ),
"---"
'使用相同的事件流来显示错误并追踪 Token 消耗:
session.error 事件传递curl -fsSL "https://api.anthropic.com/v1/sessions/$SESSION_ID/events" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01" \
| jq -r '
(.data[] | select(.type == "session.error") | "[\(.error.type)] \(.error.message)"),
(reduce (.data[] | select(.type == "span.model_request_end") | .model_usage) as $u
({input: 0, output: 0}; .input += $u.input_tokens | .output += $u.output_tokens)
| "Total input tokens: \(.input), output tokens: \(.output)")
'