autotel-bedrock 0.1.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # autotel-bedrock
2
2
 
3
- **Bedrock is a provider, not a destination.**
3
+ Amazon Bedrock facts for autotel's canonical `gen_ai.*` spans.
4
4
 
5
- `autotel-genai` already emits canonical `gen_ai.*` spans for every AI SDK call
6
- against Amazon Bedrock `gen_ai.provider.name = aws.bedrock`, the model id,
7
- token usage, input and output messages from nothing but the observer:
5
+ `autotel-genai` emits `gen_ai.*` spans for every AI SDK call against Amazon
6
+ Bedrock (`gen_ai.provider.name = aws.bedrock`, the model id, token usage, input
7
+ and output messages) from the observer alone:
8
8
 
9
9
  ```ts
10
10
  import { registerTelemetry } from 'ai';
@@ -13,8 +13,8 @@ import { autotelTelemetry } from 'autotel-genai/observer';
13
13
  registerTelemetry(autotelTelemetry());
14
14
  ```
15
15
 
16
- **This package is not required for any of it.** It fills in the Bedrock facts
17
- no OpenTelemetry convention covers and no generic price table knows.
16
+ This package adds the Bedrock facts that no OpenTelemetry convention covers
17
+ and no generic price table knows.
18
18
 
19
19
  ## What this package adds
20
20
 
@@ -61,24 +61,24 @@ and keeps the rest as their own attributes:
61
61
  | Attribute | Value |
62
62
  | -------------------------------------- | ------------------------------------------- |
63
63
  | `gen_ai.request.model` | `anthropic.claude-sonnet-4-5-20250929-v1:0` |
64
- | `aws.bedrock.model.id_raw` | what the request actually said |
64
+ | `aws.bedrock.model.id_raw` | the id as the request spelled it |
65
65
  | `aws.bedrock.model.arn` | the ARN, when one was used |
66
66
  | `aws.bedrock.inference_profile.region` | `eu`, `us`, `global`… |
67
67
  | `aws.bedrock.model.vendor` | `anthropic`, `amazon`, `meta`, `zai`… |
68
68
  | `cloud.provider` / `cloud.region` | `aws` / the option or `AWS_REGION` |
69
69
 
70
- Pass `normalizeModel: false` to keep the requested spelling and only add the
71
- extra attributes. Spans from every other provider pass through untouched.
70
+ Pass `normalizeModel: false` to keep the requested spelling and add the extra
71
+ attributes only. Spans from other providers pass through untouched.
72
72
 
73
- Use `spanEnrichers`, not `spanProcessors`. The latter replaces the pipeline
74
- autotel builds, which would switch off the destinations you just configured.
73
+ Register it under `spanEnrichers`. `spanProcessors` replaces the pipeline
74
+ autotel builds, including the destinations you configured.
75
75
 
76
76
  ### Stop reason and guardrails
77
77
 
78
78
  The AI SDK folds Bedrock's stop reasons into its own (`guardrail_intervened`
79
79
  and `content_filtered` both become `content-filter`; `malformed_tool_use` and
80
- `model_context_window_exceeded` become `other`), and the lifecycle events
81
- never see the guardrail trace. `bedrockProviderAttributes` puts both back:
80
+ `model_context_window_exceeded` become `other`), and its lifecycle events omit
81
+ the guardrail trace. `bedrockProviderAttributes` records both:
82
82
 
83
83
  ```ts
84
84
  registerTelemetry(
@@ -96,23 +96,22 @@ registerTelemetry(
96
96
  | `aws.bedrock.guardrail.id` | from the trace, so set `guardrailConfig.trace: 'enabled'` |
97
97
 
98
98
  `gen_ai.response.finish_reasons` keeps the AI SDK's unified value, so a
99
- dashboard built on it still works. An intervention is a policy outcome, not a
100
- failure: the span's status stays unset, and `guardrail.intervened / total` is
101
- one query away.
99
+ dashboard built on it keeps working. An intervention is a policy outcome: the
100
+ span's status stays unset, and `guardrail.intervened / total` is one query.
102
101
 
103
102
  ### Bedrock-only pricing
104
103
 
105
104
  `BEDROCK_PRICING` is a table for `autotelTelemetry({ pricing })` covering the
106
105
  models that exist only behind Bedrock: Nova, Llama, Mistral, DeepSeek, GLM.
107
- Anthropic models are deliberately absent — Bedrock bills them at Anthropic's
108
- rates and `autotel-genai` prices those by family already.
106
+ Bedrock bills Anthropic models at Anthropic's rates, and `autotel-genai`
107
+ prices those by family, so they are not listed here.
109
108
 
110
- Keys match the way `autotel-genai/cost` resolves ids exact, then prefix,
111
- tried again after each region/vendor prefix is peeled so
109
+ Keys match the way `autotel-genai/cost` resolves ids (exact, then prefix, tried
110
+ again after each region and vendor prefix is peeled), so
112
111
  `eu.amazon.nova-pro-v1:0` resolves via `amazon.nova-pro`.
113
112
 
114
- Approximate list prices at the time of writing; a convenience default, not a
115
- billing source of truth. Spread and override what you use:
113
+ The prices are list prices at the time of writing, a convenience default rather
114
+ than a billing source of truth. Spread and override what you use:
116
115
 
117
116
  ```ts
118
117
  autotelTelemetry({
@@ -123,9 +122,11 @@ autotelTelemetry({
123
122
  });
124
123
  ```
125
124
 
126
- ## What you do not need this for
125
+ Runnable example: [`apps/example-bedrock`](../../apps/example-bedrock), a Lambda handler around an AI SDK tool-loop agent, run in-process against Bedrock.
127
126
 
128
- | Already arrives from | |
127
+ ## Already covered elsewhere
128
+
129
+ | Signal | Comes from |
129
130
  | ---------------------------------------- | -------------------------------------- |
130
131
  | `gen_ai.provider.name = aws.bedrock` | `autotel-genai` provider normalisation |
131
132
  | Anthropic model cost on Bedrock | `autotel-genai/cost` family pricing |
package/dist/index.d.cts CHANGED
@@ -31,12 +31,12 @@ declare function parseBedrockModelId(raw: string): ParsedBedrockModelId;
31
31
  * foundation model id, tried again after each vendor/region prefix is
32
32
  * peeled off. So `eu.amazon.nova-pro-v1:0` resolves via `amazon.nova-pro`.
33
33
  *
34
- * Anthropic models are deliberately absent: Bedrock bills them at the same
35
- * rates as Anthropic direct, and `autotel-genai` already prices those by
36
- * family. This table is for the models that only exist behind Bedrock.
34
+ * Bedrock bills Anthropic models at Anthropic's rates and `autotel-genai`
35
+ * prices those by family, so this table covers the models that only exist
36
+ * behind Bedrock.
37
37
  *
38
- * Approximate public prices at the time of writing (eu-west-1 / us-east-1
39
- * on-demand). A convenience default, not a billing source of truth — check
38
+ * Public prices at the time of writing (eu-west-1 / us-east-1 on-demand), a
39
+ * convenience default rather than a billing source of truth. Check
40
40
  * https://aws.amazon.com/bedrock/pricing/ and override what you use.
41
41
  */
42
42
  interface BedrockModelPricing {
@@ -77,13 +77,13 @@ interface BedrockCompatibilityOptions {
77
77
  * `AWS_REGION` from the environment (set on every Lambda); left off when
78
78
  * neither is known.
79
79
  */
80
- region?: string;
80
+ region?: string | undefined;
81
81
  /**
82
82
  * Rewrite `gen_ai.request.model` / `gen_ai.response.model` to the foundation
83
83
  * model id when the request used an inference profile or ARN. The original
84
84
  * spelling is always kept in `aws.bedrock.model.id_raw`. Default `true`.
85
85
  */
86
- normalizeModel?: boolean;
86
+ normalizeModel?: boolean | undefined;
87
87
  }
88
88
  /**
89
89
  * A span processor that fills in the Bedrock-specific fields on the way out.
package/dist/index.d.ts CHANGED
@@ -31,12 +31,12 @@ declare function parseBedrockModelId(raw: string): ParsedBedrockModelId;
31
31
  * foundation model id, tried again after each vendor/region prefix is
32
32
  * peeled off. So `eu.amazon.nova-pro-v1:0` resolves via `amazon.nova-pro`.
33
33
  *
34
- * Anthropic models are deliberately absent: Bedrock bills them at the same
35
- * rates as Anthropic direct, and `autotel-genai` already prices those by
36
- * family. This table is for the models that only exist behind Bedrock.
34
+ * Bedrock bills Anthropic models at Anthropic's rates and `autotel-genai`
35
+ * prices those by family, so this table covers the models that only exist
36
+ * behind Bedrock.
37
37
  *
38
- * Approximate public prices at the time of writing (eu-west-1 / us-east-1
39
- * on-demand). A convenience default, not a billing source of truth — check
38
+ * Public prices at the time of writing (eu-west-1 / us-east-1 on-demand), a
39
+ * convenience default rather than a billing source of truth. Check
40
40
  * https://aws.amazon.com/bedrock/pricing/ and override what you use.
41
41
  */
42
42
  interface BedrockModelPricing {
@@ -77,13 +77,13 @@ interface BedrockCompatibilityOptions {
77
77
  * `AWS_REGION` from the environment (set on every Lambda); left off when
78
78
  * neither is known.
79
79
  */
80
- region?: string;
80
+ region?: string | undefined;
81
81
  /**
82
82
  * Rewrite `gen_ai.request.model` / `gen_ai.response.model` to the foundation
83
83
  * model id when the request used an inference profile or ARN. The original
84
84
  * spelling is always kept in `aws.bedrock.model.id_raw`. Default `true`.
85
85
  */
86
- normalizeModel?: boolean;
86
+ normalizeModel?: boolean | undefined;
87
87
  }
88
88
  /**
89
89
  * A span processor that fills in the Bedrock-specific fields on the way out.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-bedrock",
3
- "version": "0.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Amazon Bedrock facts for autotel's canonical gen_ai.* spans: model-id normalisation for inference profiles and ARNs, cloud.region, and a Bedrock price table",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -24,12 +24,12 @@
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@opentelemetry/sdk-trace-base": ">=2.0.0",
27
- "autotel-genai": ">=1.0.0"
27
+ "autotel-genai": "^0.15.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@opentelemetry/sdk-trace-base": "^2.11.0",
31
31
  "@types/node": "^26.1.2",
32
- "autotel-genai": "0.13.1",
32
+ "autotel-genai": "0.15.0",
33
33
  "tsdown": "^0.22.14",
34
34
  "typescript": "^6.0.3",
35
35
  "vitest": "^4.1.10"