View a markdown version of this page

Comprendere gli intervalli di input - Amazon Bedrock AgentCore

Comprendere gli intervalli di input

L'evaluateAPI accetta un elenco disessionSpans, che consiste in due tipi di entità: span ed eventi

Spazi ed eventi

Il servizio di valutazione elabora due tipi di dati di telemetria per comprendere il comportamento e le prestazioni dell'agente.

Intervalli

Gli span contengono metadati sulle singole operazioni, inclusi attributi, informazioni sull'ambito, timestamp e identificatori di risorse. Gli intervalli sono disponibili nel gruppo di log. aws/spans

Eventi

Gli eventi contengono informazioni sul carico utile sul body campo, inclusi input e output dei modelli, degli strumenti e dell'agente. Per gli agenti ospitati su AgentCore Runtime, gli eventi vengono archiviati in /aws/bedrock-agentcore/runtimes/agent_id-endpoint_name un gruppo di log. Per gli agenti ospitati all'esterno AgentCore di Runtime, gli eventi vengono archiviati nel gruppo di log configurato dalla variabile di OTEL_EXPORTER_OTLP_LOGS_HEADERS ambiente.

Nota

Per valutare una sessione, sono necessari sia gli intervalli che gli eventi corrispondenti. Non tutti gli span avranno eventi, ma quelli con gli ambiti supportati dovrebbero includere gli eventi corrispondenti, altrimenti il servizio genererà un. ValidationException

Struttura Span

Gli span seguono una struttura standardizzata con campi obbligatori e facoltativi che forniscono un contesto sulle operazioni nel flusso di lavoro degli agenti.

Varianti degli attributi

Le informazioni presenti negli attributi span variano in base al framework di agenti e alla libreria di strumentazione utilizzata.

Ambiti supportati

Il nome dell'ambito determina se il servizio può elaborare lo span. Attualmente sono supportati i seguenti ambiti:

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

Struttura degli eventi

Gli eventi Span sono associati agli span che utilizzano and. spanId traceId Il nome dell'ambito dell'evento viene utilizzato per determinare se contiene le informazioni necessarie per la valutazione.

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

Schema del corpo dell'evento

Per gli eventi con ambiti supportati, il body campo segue questo schema. I valori effettivi nel campo del contenuto variano a seconda del framework e della libreria di strumentazione utilizzati.

{ "body": { "output": { "messages": [ { "content": "string/dict" # depends on framework/instrumentation "role": "string" } ] }, "input": { "messages": [ { "content": "string/dict" # depends on framework/instrumentation "role": "string" } ] } } }

Esempi di intervalli ed eventi

Di seguito sono riportati alcuni esempi di intervalli e gli eventi corrispondenti per l'agente demo creato e distribuito in AgentCore Runtime secondo la guida introduttiva. Gli esempi dimostrano

  • InvokeAgent intervalli utilizzati per le valutazioni a livello di traccia

  • ExecuteTool intervalli utilizzati per le valutazioni a livello di utensile

Esempio
Strands Agents
  1. L'attributo "gen_ai.operation.name": "invoke_agent" viene utilizzato per identificare gli intervalli di invocazione dell'agente

    ## 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. L'attributo viene utilizzato "traceloop.span.kind": "workflow" per identificare gli intervalli di invocazione dell'agente

    { "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. L'attributo viene utilizzato "traceloop.span.kind": "tool" per identificare gli intervalli di esecuzione degli strumenti

    ## 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" } } }