evaluateAPI 接受一个列表sessionSpans,该列表由两种类型的实体组成:跨度和事件
跨度和事件
评估服务处理两种类型的遥测数据,以了解您的代理的行为和性能。
跨度
Span 包含有关单个操作的元数据,包括属性、范围信息、时间戳和资源标识符。aws/spans日志组中有 Span 可用。
Events
事件包含body现场的有效载荷信息,包括来自模型、工具和代理的输入和输出。对于在 AgentCore Runtime 上托管的代理,事件存储在/aws/bedrock-agentcore/runtimes/agent_id-endpoint_name日志组中。对于托管在 AgentCore Runtime 之外的代理,事件存储在由OTEL_EXPORTER_OTLP_LOGS_HEADERS环境变量配置的日志组中。
要评估会话,需要跨度和相应的事件。并非所有跨度都会有事件,但是支持范围的跨度应该包括相应的事件,否则服务将抛出。ValidationException
跨度结构
跨度遵循标准化结构,其中包含必填字段和可选字段,这些字段提供了有关代理工作流程中操作的上下文。
属性变体
span 属性中显示的信息因所使用的代理框架和仪器库而异。
支持的范围
作用域名称决定服务是否可以处理跨度。目前支持以下范围:
{
"spanId": "string" ## required
"traceId": "string", ## required
"parentSpanId": "string",
"name": "string" ## required
"scope": {
"name": "string" ## required
},
"startTimeUnixNano": "epoch time", ## required
"endTimeUnixNano": "epoch time", ## required
"durationNano": "epoch time",
"attributes": { ## required
"session.id": "string", ## required
"string": "string"
},
"status": {
"code": "string"
},
"kind": "string",
"resource": {
"attributes": {
"string": "string",
"string": "string"
}
},
}
事件结构
跨度事件使用spanId和traceId与跨度相关联。事件的作用域名称用于确定它是否包含评估所需的信息。
{
"spanId": "string", ## required
"traceId": "string", ## required
"scope": {
"name": "string" ## required
},
"body": "Any", ## required for supported scopes (refer below section)
"attributes": {
"event.name": "string", ## required
"session.id": "string" ## required
},
"resource": {
"attributes": {
"string": "string",
"string": "string"
}
},
"timeUnixNano": "epoch time",
"observedTimeUnixNano": "epoch time",
"severityNumber": "int",
"severityText": "string",
}
事件正文架构
对于具有支持范围的事件,该body字段遵循此架构。内容字段中的实际值因所使用的框架和工具库而异。
{
"body": {
"output": {
"messages": [
{
"content": "string/dict" # depends on framework/instrumentation
"role": "string"
}
]
},
"input": {
"messages": [
{
"content": "string/dict" # depends on framework/instrumentation
"role": "string"
}
]
}
}
}
跨度和事件示例
以下是根据入门指南在 AgentCore Runtime 中创建和部署的演示代理的示例跨度及其相应事件。这些例子演示了
-
InvokeAgent 用于跟踪等级评估的跨度
-
ExecuteTool 用于工具等级评估的跨度
例
- Strands Agents
-
-
属性"gen_ai.operation.name": "invoke_agent"用于识别代理调用跨度
## Example invoke_agent span for strands agent
{
"spanId": "e79d2156ac138f63",
"traceId": "691e400b638f5225711e80da37a4b0bd",
"resource": {
"attributes": {
"deployment.environment.name": "bedrock-agentcore:default",
"aws.local.service": "agentcore_evaluation_demo.DEFAULT",
"service.name": "agentcore_evaluation_demo.DEFAULT",
"cloud.region": "us-east-1",
"aws.log.stream.names": "otel-rt-logs",
"telemetry.sdk.name": "opentelemetry",
"aws.service.type": "gen_ai_agent",
"telemetry.sdk.language": "python",
"cloud.provider": "aws",
"cloud.resource_id": "agent-arn",
"aws.log.group.names": "/aws/bedrock-agentcore/runtimes/agent-id",
"telemetry.sdk.version": "1.33.1",
"cloud.platform": "aws_bedrock_agentcore",
"telemetry.auto.version": "0.12.2-aws"
}
},
"scope": {
"name": "strands.telemetry.tracer",
"version": ""
},
"parentSpanId": "ec3c4c7fb2603f7a",
"flags": 256,
"name": "invoke_agent Strands Agents",
"kind": "INTERNAL",
"startTimeUnixNano": 1763590155895947177,
"endTimeUnixNano": 1763590165204959446,
"durationNano": 9309012269,
"attributes": {
"aws.local.service": "agentcore_evaluation_demo.DEFAULT",
"gen_ai.usage.prompt_tokens": 2021,
"gen_ai.usage.output_tokens": 320,
"gen_ai.usage.cache_write_input_tokens": 0,
"gen_ai.agent.name": "Strands Agents",
"gen_ai.usage.total_tokens": 2341,
"gen_ai.usage.completion_tokens": 320,
"gen_ai.event.start_time": "2025-11-19T22:09:15.895962+00:00",
"aws.local.environment": "bedrock-agentcore:default",
"gen_ai.operation.name": "invoke_agent",
"gen_ai.event.end_time": "2025-11-19T22:09:25.204930+00:00",
"gen_ai.usage.input_tokens": 2021,
"gen_ai.request.model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
"gen_ai.usage.cache_read_input_tokens": 0,
"gen_ai.agent.tools": "[\"analyze_text\", \"get_word_frequency\"]",
"PlatformType": "AWS::BedrockAgentCore",
"session.id": "test-ace-demo-session-18a1dba0-62a0-462g",
"gen_ai.system": "strands-agents",
"gen_ai.tool.definitions": "[{\"name\": \"analyze_text\", \"description\": \"Analyze text and provide statistics about it.\", \"inputSchema\": {\"json\": {\"properties\": {\"text\": {\"description\": \"Parameter text\", \"type\": \"string\"}}, \"required\": [\"text\"], \"type\": \"object\"}}, \"outputSchema\": null}, {\"name\": \"get_word_frequency\", \"description\": \"Get the frequency of words in the provided text.\", \"inputSchema\": {\"json\": {\"properties\": {\"text\": {\"description\": \"Parameter text\", \"type\": \"string\"}, \"top_n\": {\"default\": 5, \"description\": \"Parameter top_n\", \"type\": \"integer\"}}, \"required\": [\"text\"], \"type\": \"object\"}}, \"outputSchema\": null}]"
},
"status": {
"code": "OK"
}
}
- Langgraph (with opentelemetry-instrumentation)
-
-
属性"traceloop.span.kind": "workflow"用于识别代理调用跨度
{
"resource": {
"attributes": {
"deployment.environment.name": "bedrock-agentcore:default",
"aws.local.service": "agentcore_evaluation_demo_lg.DEFAULT",
"service.name": "agentcore_evaluation_demo_lg.DEFAULT",
"cloud.region": "us-east-1",
"aws.log.stream.names": "otel-rt-logs",
"telemetry.sdk.name": "opentelemetry",
"aws.service.type": "gen_ai_agent",
"telemetry.sdk.language": "python",
"cloud.provider": "aws",
"cloud.resource_id": "<agent-arn>",
"aws.log.group.names": "/aws/bedrock-agentcore/runtimes/<agent-id>",
"telemetry.sdk.version": "1.33.1",
"cloud.platform": "aws_bedrock_agentcore",
"telemetry.auto.version": "0.14.0-aws"
}
},
"scope": {
"name": "opentelemetry.instrumentation.langchain",
"version": "0.48.1"
},
"traceId": "691f4a5c0a7ab761407a1a9a36991613",
"spanId": "298f3169bdca46d8",
"parentSpanId": "737921ed52222e5d",
"flags": 256,
"name": "LangGraph.workflow",
"kind": "INTERNAL",
"startTimeUnixNano": 1763658333042983700,
"endTimeUnixNano": 1763658340533358800,
"durationNano": 7490375269,
"attributes": {
"aws.local.service": "agentcore_evaluation_demo_lg.DEFAULT",
"traceloop.span.kind": "workflow",
"traceloop.workflow.name": "LangGraph",
"traceloop.entity.name": "LangGraph",
"PlatformType": "AWS::BedrockAgentCore",
"session.id": "test-ace-demo-session-18a1dba0-62a0-462g",
"traceloop.entity.path": "",
"aws.local.environment": "bedrock-agentcore:default"
},
"status": {
"code": "UNSET"
}
}
- ExecuteTool span
-
-
属性"traceloop.span.kind": "tool"用于识别工具执行跨度
## tool span
{
"traceId": "691f4a5c0a7ab761407a1a9a36991613",
"spanId": "b58bd6568e00fc64",
"parentSpanId": "aaee94b5bd16f3b0",
"scope": {
"name": "opentelemetry.instrumentation.langchain",
"version": "0.48.1"
},
"flags": 256,
"name": "get_word_frequency.tool",
"kind": "INTERNAL",
"startTimeUnixNano": 1763658336583727000,
"endTimeUnixNano": 1763658336584260400,
"durationNano": 533416,
"attributes": {
"aws.local.service": "agentcore_evaluation_demo_lg.DEFAULT",
"traceloop.span.kind": "tool",
"traceloop.workflow.name": "LangGraph",
"traceloop.entity.name": "get_word_frequency",
"PlatformType": "AWS::BedrockAgentCore",
"session.id": "test-ace-demo-session-18a1dba0-62a0-462g",
"traceloop.entity.path": "tools",
"aws.local.environment": "bedrock-agentcore:default"
},
"status": {
"code": "UNSET"
},
"resource": {
"attributes": {
"deployment.environment.name": "bedrock-agentcore:default",
"aws.local.service": "agentcore_evaluation_demo_lg.DEFAULT",
"service.name": "agentcore_evaluation_demo_lg.DEFAULT",
"cloud.region": "us-east-1",
"aws.log.stream.names": "otel-rt-logs",
"telemetry.sdk.name": "opentelemetry",
"aws.service.type": "gen_ai_agent",
"telemetry.sdk.language": "python",
"cloud.provider": "aws",
"cloud.resource_id": "<agent-arn>",
"aws.log.group.names": "/aws/bedrock-agentcore/runtimes/<agent-id>",
"telemetry.sdk.version": "1.33.1",
"cloud.platform": "aws_bedrock_agentcore",
"telemetry.auto.version": "0.14.0-aws"
}
}
}