View a markdown version of this page

入力スパンについて - Amazon Bedrock AgentCore

入力スパンについて

evaluate API は、スパンとイベントという 2 種類のエンティティで構成される sessionSpans のリストを受け入れます。

スパンとイベント

評価サービスは、エージェントの動作とパフォーマンスを理解するために 2 種類のテレメトリデータを処理します。

スパン

スパンには、属性、スコープ情報、タイムスタンプ、リソース識別子など、個々のオペレーションに関するメタデータが含まれます。スパンはaws/spansロググループで使用できます。

イベント

イベントには、モデル、ツール、エージェントからの入出力など、 bodyフィールドにペイロード情報が含まれます。AgentCore ランタイムでホストされているエージェントの場合、イベントは/aws/bedrock-agentcore/runtimes/agent_id-endpoint_nameロググループに保存されます。AgentCore ランタイム外でホストされるエージェントの場合、イベントはOTEL_EXPORTER_OTLP_LOGS_HEADERS環境変数によって設定されたロググループに保存されます。

注記

セッションを評価するには、スパンと対応するイベントの両方が必要です。すべてのスパンにイベントがあるわけではありませんが、サポートされているスコープを持つスパンには対応するイベントを含める必要があります。含まれていない場合、サービスは をスローしますValidationException

スパン構造

スパンは、エージェントワークフロー内のオペレーションに関するコンテキストを提供する必須フィールドとオプションフィールドを含む標準化された構造に従います。

属性のバリエーション

スパン属性に含まれる情報は、使用するエージェントフレームワークと計測ライブラリによって異なります。

サポートされているスコープ

スコープ名は、サービスがスパンを処理できるかどうかを決定します。現在、以下のスコープがサポートされています。

  • strands.telemetry.tracer

  • opentelemetry.instrumentation.langchain

  • openinference.instrumentation.langchain

{ "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" } }, }

イベントの構造

スパンイベントは、 spanIdtraceId を使用してスパンに関連付けられます。イベントの範囲名は、評価に必要な情報が含まれているかどうかを判断するために使用されます。

{ "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 ランタイムで作成およびデプロイされたデモエージェントのスパンと、それに対応するイベントの例です。この例では、

  • トレースレベル評価に使用される InvokeAgent スパン

  • ツールレベルの評価に使用される ExecuteTool スパン

Strands Agents
  1. 属性"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)
  1. 属性"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
  1. 属性"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" } } }