Documentation Index
Fetch the complete documentation index at: https://docs.pandaprobe.com/llms.txt
Use this file to discover all available pages before exploring further.
wrap_bedrock is currently in beta.Installation
- pip
- uv
bedrock extra installs boto3>=1.34.0. For async support install aioboto3 separately — wrap_bedrock detects it at runtime and instruments async methods automatically without making it a hard dependency.
Setup
Converse API (recommended)
Span name:"bedrock-converse", SpanKind: LLM
- Input: top-level
systemblocks hoisted into the messages list as arole="system"entry, followed by themessagesarray. Text-onlycontentblocks are flattened into a single string; mixed-block content (images, tool use/results) round-trips as structured JSON. - Output: assistant
contenttext blocks joined together - Model:
modelIdfrom the request kwargs - Token usage (see mapping table below)
- Model parameters:
temperature,topP,maxTokens,stopSequencesfrominferenceConfig, plusguardrailConfig,additionalModelRequestFields,toolConfig reasoningContentblocks (when models emit them) are stored in span metadata asreasoning_summary
Streaming
{"stream": ..., "ResponseMetadata": ...} response shape — only the inner iterator is replaced with a tracing-aware reducer. User code accesses response["stream"] exactly as before. Time-to-first-token is captured on the first contentBlockDelta; final token usage is read from the trailing metadata event.
InvokeModel API (legacy fallback)
Span name:"bedrock-invoke-model" (or "bedrock-invoke-model-stream"), SpanKind: LLM
- Anthropic Claude on Bedrock —
{"messages": [...], "system": "..."}, outputcontentblocks, usage asinput_tokens/output_tokens - Mistral on Bedrock —
{"messages": [...]} - Amazon Titan —
{"inputText": "..."}, output viaresults[0].outputText, usage viainputTextTokenCount+results[0].tokenCount - Cohere / Meta Llama —
{"prompt": "..."}and provider-specific generation fields
Async (aioboto3)
aioboto3 is supported but not required. When wrap_bedrock is given an aioboto3 client (its module path starts with aioboto3 / aiobotocore, or its methods are coroutine functions), the wrapper installs async-shaped patches for converse, converse_stream, invoke_model, and invoke_model_with_response_stream.
Token usage mapping
| Bedrock Field | PandaProbe Field |
|---|---|
usage.inputTokens (Converse) | prompt_tokens |
usage.outputTokens (Converse) | completion_tokens |
usage.totalTokens (Converse) | total_tokens |
usage.cacheReadInputTokens | cache_read_tokens |
usage.cacheWriteInputTokens | cache_creation_tokens |
usage.input_tokens (InvokeModel/Anthropic) | prompt_tokens |
usage.output_tokens (InvokeModel/Anthropic) | completion_tokens |
inputTextTokenCount (Titan) | prompt_tokens |
results[0].tokenCount (Titan) | completion_tokens |
meta.billed_units.input_tokens (Cohere) | prompt_tokens |
meta.billed_units.output_tokens (Cohere) | completion_tokens |

