zuplo 7.14.5 → 7.14.6

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.
Files changed (30) hide show
  1. package/docs/ai-gateway/cookbooks/data-residency.mdx +259 -0
  2. package/docs/ai-gateway/fallback.mdx +6 -4
  3. package/docs/ai-gateway/guardrails.mdx +283 -0
  4. package/docs/ai-gateway/observability/analytics.mdx +121 -0
  5. package/docs/ai-gateway/observability/data-handling.mdx +120 -0
  6. package/docs/ai-gateway/observability/tracing.mdx +203 -0
  7. package/docs/ai-gateway/overview.mdx +6 -4
  8. package/docs/ai-gateway/policies/overview.mdx +4 -0
  9. package/docs/ai-gateway/policy-chains.mdx +10 -3
  10. package/docs/ai-gateway/routing.mdx +277 -0
  11. package/docs/analytics/overview.md +3 -0
  12. package/docs/analytics/tabs/cache.md +89 -0
  13. package/docs/articles/connect-to-aws-alb-with-mtls.mdx +23 -0
  14. package/docs/articles/deployments-and-rollbacks.mdx +93 -0
  15. package/docs/articles/proxy-openai-realtime-api.mdx +247 -0
  16. package/docs/caching/gateway-caching.mdx +2 -1
  17. package/docs/caching/semantic-caching.mdx +133 -0
  18. package/docs/cli/lint.mdx +13 -0
  19. package/docs/cli/variable-delete.mdx +66 -0
  20. package/docs/concepts/source-control-and-deployment.mdx +6 -0
  21. package/docs/concepts/upstream-credentials.mdx +2 -1
  22. package/docs/guides/backend-failover.mdx +117 -0
  23. package/docs/guides/blue-green-deployments.mdx +199 -0
  24. package/docs/handlers/websocket-pipeline-handler.mdx +94 -0
  25. package/docs/mcp-server/authorize-tool-calls.mdx +284 -0
  26. package/docs/mcp-server/overview.mdx +3 -0
  27. package/docs/policies/mcp-capability-filter-inbound/doc.md +81 -0
  28. package/docs/policies/semantic-cache-inbound/doc.md +6 -5
  29. package/docs/policies/semantic-cache-inbound/schema.json +4 -4
  30. package/package.json +5 -5
@@ -0,0 +1,121 @@
1
+ ---
2
+ title: AI Gateway Analytics
3
+ sidebar_label: Analytics
4
+ description:
5
+ See requests, tokens, estimated cost, cache hit rate, model and provider
6
+ share, and latency for every AI Gateway app, and learn how the gateway
7
+ measures each.
8
+ applies_to:
9
+ product: gateway
10
+ hosting: all
11
+ ---
12
+
13
+ Every request to an AI Gateway app records its model, provider, token counts,
14
+ estimated cost, latency, and cache outcome. The Zuplo Portal turns those records
15
+ into dashboards, so you can see what each app spends, which models carry the
16
+ traffic, and how fast the providers answer, without adding any policy or code.
17
+
18
+ ## Where to find it
19
+
20
+ Open your AI Gateway project and select the
21
+ [**Observability**](https://portal.zuplo.com/+/account/project/ai/analytics)
22
+ tab. It has two sub-tabs:
23
+
24
+ - **Logs** shows request logs and messages written by policies. See
25
+ [Logging](../../articles/logging.mdx#viewing-logs-in-the-portal).
26
+ - **Analytics** holds the dashboards described on this page. A sidebar lists its
27
+ sections.
28
+
29
+ | Section | What it shows |
30
+ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
31
+ | **Overview** | A summary of tokens, cost, latency, consumers, and cache hit rate, plus model usage, latency distribution, and cache lookups. |
32
+ | **Requests** | Request volume, errors, and gateway latency for every request the gateway handled. See [Requests](../../analytics/tabs/requests.md). |
33
+ | **Consumers** | Traffic by caller. See [Consumers](../../analytics/tabs/consumers.md). |
34
+ | **Agents** | Traffic from AI agent clients such as ChatGPT, Claude.ai, and Cursor. See [Agents](../../analytics/tabs/agents.md). |
35
+ | **AI & LLMs** | Requests, tokens, estimated cost, and median latency, broken down by model, provider, and token type, plus blocked requests and warnings. |
36
+ | **Pools & Apps** | Spend for the gateway, each pool, and each app, drawn as a tree against their budgets. See [Budget alerts](../budget-alerts.mdx). |
37
+ | **Cache** | Semantic cache hits, misses, stores, saved tokens, and lookup latency. |
38
+
39
+ The time range, filters, and selected section live in the URL, so you can share
40
+ a view by copying the link. How far back you can look depends on your plan. See
41
+ [Data retention](../../analytics/access-and-entitlements.md#data-retention).
42
+
43
+ ## Overview
44
+
45
+ The **Overview** section is the landing page for an AI Gateway project. Its
46
+ summary cards show:
47
+
48
+ - **Total Tokens**, split into input and output tokens.
49
+ - **Estimated Cost**.
50
+ - **Avg Latency**, the average gateway request duration.
51
+ - **Consumers**, the number of distinct callers.
52
+ - **Cache Hit Rate**, hits divided by hits plus misses for the semantic cache.
53
+
54
+ Below the cards, **Model Usage** charts the busiest models over time, **Latency
55
+ Distribution** shows the p50, p90, p95, and p99 latency of AI Gateway requests,
56
+ and **Cache Lookups** charts semantic cache hits and misses. A **Consumers**
57
+ table lists the callers with the most traffic.
58
+
59
+ ## AI & LLMs
60
+
61
+ The **AI & LLMs** section focuses on model traffic and spend.
62
+
63
+ | Panel | What it shows |
64
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------- |
65
+ | **Summary** | **Total Requests**, **Total Tokens** (input and output), **Estimated Cost**, and **Median Latency** (p50). |
66
+ | **Model Usage** | The most-used models by share of AI Gateway requests, over time. |
67
+ | **Model Share** | Each model's share of cost, tokens, and requests, labeled `provider/model`. |
68
+ | **Token Breakdown** | Prompt, completion, and embedding tokens over time. |
69
+ | **Provider Breakdown** | Requests by provider over time. |
70
+ | **Blocked & Warnings** | Requests that a policy blocked, such as a guardrail or an exhausted budget, and budget warnings, by type and over time. |
71
+
72
+ Click a model, a provider, or a blocked-request type to filter the whole section
73
+ to that value; click it again to clear the filter. Every panel, including the
74
+ summary cards, reloads for the filter. To compare latency between models, click
75
+ each model in turn and read its **Median Latency**.
76
+
77
+ **Estimated Cost** uses the provider's reported price when the provider returns
78
+ one, and otherwise multiplies the token counts by the model's rate card. To set
79
+ your own rates, see [Custom pricing](../custom-pricing.mdx).
80
+
81
+ ## Cache
82
+
83
+ The **Cache** section reports on the
84
+ [Semantic Cache](../../policies/ai-gateway-semantic-cache-inbound.mdx) policy:
85
+ **Hit Rate**, **Hits**, **Misses**, **Stores**, and **Saved Tokens** (the prompt
86
+ and completion tokens a hit didn't send to the provider), plus hits and misses
87
+ over time and p50, p95, and p99 cache lookup latency. A hit costs no provider
88
+ tokens, so it adds no cost.
89
+
90
+ ## App and pool overviews
91
+
92
+ Each app and pool has an **Overview** tab with a **Metrics** frame for the last
93
+ 30 days: **Spend**, **Tokens**, **Requests**, and **Cache Hit Rate**, each with
94
+ its change from the previous 30 days, followed by tokens and cost over time.
95
+ Select **View in Analytics** to open the **AI & LLMs** section filtered to that
96
+ app or pool. See [Monitoring usage](../usage-limits.mdx#monitoring-usage).
97
+
98
+ ## How latency is measured
99
+
100
+ The dashboards report two kinds of latency. Both stop the clock when the gateway
101
+ has the response and starts sending it. For a streaming response, that's when
102
+ the stream starts, so the latency shows how quickly the model begins to answer.
103
+
104
+ | Metric | Starts | Ends |
105
+ | ---------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
106
+ | AI Gateway latency: **Median Latency** on **AI & LLMs** and **Latency Distribution** on **Overview** | When the AI Gateway handler receives the request, after the app's policy chain has run | When the provider's response is ready to return. For a streaming response, when the provider starts streaming |
107
+ | Gateway request duration: **Avg Latency** on **Overview** and the latency charts on **Requests** | When the gateway receives the request | When the gateway has the response to send, after every policy has run |
108
+
109
+ AI Gateway latency covers successful responses. It includes every provider call
110
+ the request needed, such as a retry on a [fallback model](../fallback.mdx). For
111
+ a request that the semantic cache answers, it's the time the cache took to find
112
+ and return the stored response.
113
+
114
+ ## Send the data elsewhere
115
+
116
+ - To follow a request through the gateway's policies and into the provider call,
117
+ add OpenTelemetry tracing. See [AI Gateway tracing](./tracing.mdx).
118
+ - To send logs to Datadog, Splunk, or another logging service, add a
119
+ [log plugin](../../articles/logging.mdx#log-integrations).
120
+ - To learn which fields the analytics record, and which features store prompt
121
+ and completion content, see [AI Gateway data handling](./data-handling.mdx).
@@ -0,0 +1,120 @@
1
+ ---
2
+ title: AI Gateway Data Handling
3
+ sidebar_label: Data Handling
4
+ description:
5
+ What the AI Gateway records for each request by default, which features store
6
+ or send prompt and completion text, and how to capture content for an app.
7
+ applies_to:
8
+ product: gateway
9
+ hosting: all
10
+ ---
11
+
12
+ By default, the AI Gateway records usage metadata for each request (who called,
13
+ which model answered, how many tokens it used, what it cost, and how long it
14
+ took) and doesn't keep prompt or completion text. Prompt and completion text
15
+ leaves the request path only through features you add to an app's
16
+ [policy chain](../policy-chains.mdx) or to the gateway's code.
17
+
18
+ ## What Zuplo records by default
19
+
20
+ Each request to an app produces usage records that power
21
+ [AI Gateway analytics](./analytics.mdx) and [budgets](../usage-limits.mdx). They
22
+ hold these fields:
23
+
24
+ | Field | What it holds |
25
+ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | App and pool | The app that served the request and the pool it belongs to. |
27
+ | Caller | The authenticated caller's identifier (`request.user.sub`), and the person for a request made with a personal key on the [User App](../user-apps.mdx). |
28
+ | Model and provider | The model that answered and the provider that served it. |
29
+ | Tokens | Prompt, completion, and embedding token counts. |
30
+ | Cost | The estimated cost, and whether it came from the provider's reported price or a rate card. |
31
+ | Latency | How long the request took. See [How latency is measured](./analytics.mdx#how-latency-is-measured). |
32
+ | Cache outcome | Whether the semantic cache served the request, its similarity score, and the tokens a hit saved. |
33
+ | Blocks and warnings | The type of block or warning, such as a guardrail match or an exhausted budget, without the matched text. |
34
+ | Budget values | For a **By metadata** budget rule, the value its expression read, such as a header value. See [Budget expressions](../usage-limits.mdx#budget-expressions). |
35
+ | Request ID, account, project | Identifiers that tie the records to the request's logs. |
36
+
37
+ The gateway's request logs also hold the method, the full URL including its
38
+ query string, the route, the status code, the duration, and the client's IP
39
+ address and location. See
40
+ [Logging](../../articles/logging.mdx#viewing-logs-in-the-portal).
41
+
42
+ The gateway's log messages describe what happened to a request, such as which
43
+ provider served it, a fallback to another model, or a policy that blocked it.
44
+ When a provider rejects a request, the log message carries the provider's error
45
+ message.
46
+
47
+ Neither the usage records nor the request logs include request or response
48
+ bodies. How long Zuplo keeps them depends on your plan. See
49
+ [Data retention](../../analytics/access-and-entitlements.md#data-retention).
50
+
51
+ ## Features that store or send content
52
+
53
+ These features handle prompt or completion text when you turn them on. Each one
54
+ is off until you add it.
55
+
56
+ | Feature | Content it handles | Where the content goes |
57
+ | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
58
+ | [Semantic Cache](../../policies/ai-gateway-semantic-cache-inbound.mdx) | The system prompt and the most recent messages, which form the match key, and the provider's response. | Zuplo's semantic cache, which keeps each app's entries apart. Entries expire after `expirationSecondsTtl` seconds: one hour by default, up to 30 days. |
59
+ | [Comet Opik Tracing](../../policies/ai-gateway-opik-tracing-inbound.mdx) | Prompt messages or input, completion text, model, token counts, temperature and maximum tokens, request ID, and route. | Your Comet Opik workspace and project. |
60
+ | [Galileo Tracing](../../policies/ai-gateway-galileo-tracing-inbound.mdx) | Prompt and completion text, model parameters, finish reasons, token counts, duration, request ID, and route. | Your Galileo project and log stream. |
61
+ | [Akamai AI Firewall](../../policies/ai-gateway-akamai-firewall-inbound.mdx) | Prompts and completions, for inspection. | Akamai Firewall for AI. |
62
+ | [Prompt Injection Protection](../../policies/ai-gateway-prompt-injection.mdx) | The newest message of each request, for classification. | The classifier you configure: an OpenAI-compatible API, or another app on the same gateway and its provider. |
63
+ | [Smart Router](../../policies/ai-gateway-smart-router-inbound.mdx) | The last user prompt, for classification. | The classifier you configure, such as another app on the same gateway and its provider. |
64
+ | [Log plugins](../../articles/logging.mdx#log-integrations) | The request logs described earlier and messages that policies write with `context.log`. Content appears only if a custom policy logs it. | Your logging service, such as Datadog, Splunk, or AWS CloudWatch. |
65
+ | [OpenTelemetry plugin](./tracing.mdx) | Span timings, HTTP method, URL, status code, and request ID. No prompt or completion text. | Zuplo's trace storage or your OpenTelemetry backend. |
66
+
67
+ The [Data Loss Prevention](../../policies/ai-gateway-dlp-inbound.mdx) policy
68
+ scans content inside the gateway and doesn't send it to another service.
69
+
70
+ ## Capture prompts and completions for an app
71
+
72
+ To record the content of an app's requests for debugging or evaluation, add a
73
+ tracing policy to that app. Other apps on the gateway stay unchanged.
74
+
75
+ <Stepper>
76
+
77
+ 1. **Open the app's policy chain**
78
+
79
+ Open the [**Apps**](https://portal.zuplo.com/+/account/project/ai/apps) tab,
80
+ select the app, and then open its **Policies** tab.
81
+
82
+ 2. **Add a tracing policy**
83
+
84
+ Click **Add policy** and choose Comet Opik tracing or Galileo tracing.
85
+
86
+ 3. **Enter the connection settings**
87
+
88
+ For Comet Opik, enter the `apiKey`, `projectName`, and `workspace`. For
89
+ Galileo, enter the `apiKey`, `projectId`, and `logStreamId`. Reference the
90
+ API key as an environment variable, such as `$env(COMET_OPIK_API_KEY)`,
91
+ rather than pasting it. See
92
+ [Options and secrets](../policy-chains.mdx#options-and-secrets).
93
+
94
+ 4. **Move the policy to the end of the chain**
95
+
96
+ Drag the entry to the end of the chain so the trace records the request that
97
+ earlier policies produced.
98
+
99
+ </Stepper>
100
+
101
+ The change applies to new requests after the app's cached configuration
102
+ refreshes, with no deploy. To stop capturing content, remove the entry or
103
+ disable it.
104
+
105
+ To capture content for every new app in a pool, add the tracing policy to the
106
+ pool's [policy template](../policy-templates.mdx).
107
+
108
+ ## Keep sensitive data out of stored content
109
+
110
+ Policies run in chain order, and each one sees the request as the earlier
111
+ policies left it. Put Data Loss Prevention before the other policies in the
112
+ table above, so the cache key, the traces, and the classifiers receive the
113
+ masked prompt instead of the original text.
114
+
115
+ ## Related resources
116
+
117
+ - [AI Gateway analytics](./analytics.mdx)
118
+ - [AI Gateway tracing](./tracing.mdx)
119
+ - [AI Gateway policy chains](../policy-chains.mdx)
120
+ - [AI Gateway policies overview](../policies/overview.mdx)
@@ -0,0 +1,203 @@
1
+ ---
2
+ title: AI Gateway Tracing
3
+ sidebar_label: Tracing
4
+ description:
5
+ Add the OpenTelemetry plugin to an AI Gateway to trace each request through
6
+ its policies and provider call, and join model calls and tool calls in a
7
+ trace.
8
+ applies_to:
9
+ product: gateway
10
+ hosting: all
11
+ ---
12
+
13
+ An AI Gateway runs the same
14
+ [OpenTelemetry plugin](../../articles/opentelemetry.mdx) as any Zuplo project.
15
+ With the plugin on, each request to an app becomes a trace with a span for every
16
+ policy in the app's chain, the AI Gateway handler, and the call to the LLM
17
+ provider. The gateway reads W3C trace context (`traceparent`) from the caller
18
+ and sends it on to the provider, so an agent's model calls join the agent's own
19
+ trace.
20
+
21
+ <Diagram height="h-64">
22
+ <DiagramNode id="agent">Agent</DiagramNode>
23
+ <DiagramNode id="ai" variant="zuplo">
24
+ AI Gateway
25
+ </DiagramNode>
26
+ <DiagramNode id="mcp" variant="zuplo">
27
+ MCP Gateway
28
+ </DiagramNode>
29
+ <DiagramNode id="llm">LLM provider</DiagramNode>
30
+ <DiagramNode id="tools">MCP server</DiagramNode>
31
+ <DiagramNode id="backend" variant="blue">
32
+ Trace backend
33
+ </DiagramNode>
34
+ <DiagramEdge from="agent" to="ai" label="model call + traceparent" />
35
+ <DiagramEdge from="agent" to="mcp" label="tool call + traceparent" />
36
+ <DiagramEdge from="ai" to="llm" label="traceparent" />
37
+ <DiagramEdge from="mcp" to="tools" />
38
+ <DiagramEdge from="ai" to="backend" lineStyle="dashed" label="spans" />
39
+ <DiagramEdge from="mcp" to="backend" lineStyle="dashed" label="spans" />
40
+ </Diagram>
41
+
42
+ ## Prerequisites
43
+
44
+ - Connect the gateway to a Git repository so you can change its code. See
45
+ [AI Gateway source control](../source-control.mdx).
46
+ - Tracing to Zuplo works on every plan. Sending traces to your own OpenTelemetry
47
+ backend requires an Enterprise plan.
48
+
49
+ ## Enable tracing
50
+
51
+ <Stepper>
52
+
53
+ 1. **Register the plugin**
54
+
55
+ In `modules/zuplo.runtime.ts`, add the plugin in `runtimeInit`. With no
56
+ `exporter`, the plugin sends traces to Zuplo:
57
+
58
+ ```ts title="modules/zuplo.runtime.ts"
59
+ import { OpenTelemetryPlugin } from "@zuplo/otel";
60
+ import { environment, RuntimeExtensions } from "@zuplo/runtime";
61
+
62
+ export function runtimeInit(runtime: RuntimeExtensions) {
63
+ const isWorkingCopy =
64
+ environment.ZUPLO_ENVIRONMENT_STAGE === "working-copy";
65
+
66
+ runtime.addPlugin(
67
+ new OpenTelemetryPlugin({
68
+ sampling: {
69
+ headSampler: { ratio: isWorkingCopy ? 1 : 0.1 },
70
+ },
71
+ }),
72
+ );
73
+ }
74
+ ```
75
+
76
+ To send traces to your own backend instead, add an `exporter` with your
77
+ backend's URL and authentication header, and set `OTEL_TRACES_URL` and
78
+ `OTEL_API_KEY` as
79
+ [environment variables](../../articles/environment-variables.mdx):
80
+
81
+ ```ts
82
+ new OpenTelemetryPlugin({
83
+ exporter: {
84
+ url: environment.OTEL_TRACES_URL,
85
+ headers: { "api-key": environment.OTEL_API_KEY },
86
+ },
87
+ sampling: {
88
+ headSampler: { ratio: isWorkingCopy ? 1 : 0.1 },
89
+ },
90
+ });
91
+ ```
92
+
93
+ See
94
+ [Export to your own backend](../../articles/opentelemetry.mdx#export-to-your-own-backend).
95
+
96
+ 2. **Deploy**
97
+
98
+ Commit the change and push it to your default branch. The gateway deploys,
99
+ and new requests start producing traces.
100
+
101
+ </Stepper>
102
+
103
+ The `ratio` keeps every trace from your working copy and 10% of traces
104
+ elsewhere. See
105
+ [Sample a percentage of traces](../../articles/opentelemetry.mdx#sample-a-percentage-of-traces)
106
+ to change it.
107
+
108
+ ## What a trace contains
109
+
110
+ A request to an app produces a trace like the following. The app's policy chain
111
+ appears inside the Configuration Executor span, one span per entry, and the call
112
+ to the provider is a client span named after the provider's host:
113
+
114
+ ```text
115
+ POST <route>
116
+ ├── policies:inbound
117
+ │ ├── policy:ai-gateway-configuration-loader-inbound
118
+ │ └── policy:ai-gateway-configuration-executor-inbound
119
+ │ └── policies:inbound
120
+ │ ├── policy:ai-gateway-model-filtering-inbound
121
+ │ ├── policy:ai-gateway-metering-inbound
122
+ │ └── policy:ai-gateway-semantic-cache-inbound
123
+ └── handler:aiGatewayHandlerV2
124
+ └── POST: api.openai.com
125
+ ```
126
+
127
+ Spans carry timings, the HTTP method, URL, and status code, and the request ID
128
+ (`zp-rid`) that also appears in the gateway's logs. They don't carry prompt or
129
+ completion text. To record content for evaluation, see
130
+ [AI Gateway data handling](./data-handling.mdx#capture-prompts-and-completions-for-an-app).
131
+
132
+ For a streaming response, the provider span ends when the provider starts
133
+ streaming, so it shows the provider's time to first byte.
134
+
135
+ ## Follow an agent run across gateways
136
+
137
+ An agent run usually mixes model calls and tool calls. To see the whole run as
138
+ one trace, start a span in the agent and send its `traceparent` header on every
139
+ request it makes:
140
+
141
+ - **Model calls** go to the AI Gateway, which continues the trace and passes
142
+ `traceparent` on to the LLM provider.
143
+ - **Tool calls** go to the MCP Gateway, which continues the same trace. See
144
+ [MCP Gateway OpenTelemetry](../../mcp-gateway/observability/logging.mdx#opentelemetry).
145
+
146
+ Add the OpenTelemetry plugin to both projects and point them at the same
147
+ backend. The backend then shows the agent's span with the AI Gateway and MCP
148
+ Gateway spans nested under it.
149
+
150
+ Most OpenTelemetry HTTP instrumentations add `traceparent` to outgoing requests
151
+ for you. To add it yourself, inject the active context into the request headers.
152
+ This example uses the OpenAI SDK with an AI Gateway app:
153
+
154
+ ```ts
155
+ import { context, propagation, trace } from "@opentelemetry/api";
156
+ import OpenAI from "openai";
157
+
158
+ const client = new OpenAI({
159
+ apiKey: process.env.ZUPLO_AI_GATEWAY_API_KEY,
160
+ baseURL: "https://GATEWAY_HOST/APP_ID/v1",
161
+ });
162
+
163
+ const tracer = trace.getTracer("my-agent");
164
+
165
+ await tracer.startActiveSpan("agent-run", async (span) => {
166
+ const headers: Record<string, string> = {};
167
+ propagation.inject(context.active(), headers);
168
+
169
+ const response = await client.chat.completions.create(
170
+ {
171
+ model: "openai/gpt-6-luna",
172
+ messages: [{ role: "user", content: "Summarize today's tickets." }],
173
+ },
174
+ { headers },
175
+ );
176
+
177
+ // Send the same headers on the agent's MCP tool calls.
178
+ span.end();
179
+ return response;
180
+ });
181
+ ```
182
+
183
+ Replace `GATEWAY_HOST/APP_ID` with the app's API URL from the Zuplo Portal.
184
+
185
+ By default, a gateway samples a request that arrives with a `traceparent`
186
+ exactly when the caller sampled it, so the agent's sampling decision covers
187
+ every span in the run. The `ratio` applies only to requests that arrive without
188
+ trace context.
189
+
190
+ ## View and export traces
191
+
192
+ Where you view traces depends on the plugin configuration:
193
+
194
+ - **Zuplo**: with no `exporter`, open
195
+ [**Observability → Traces**](https://portal.zuplo.com/+/account/observability/traces)
196
+ at the account level and filter by **service**, which defaults to the project
197
+ name.
198
+ - **Your own backend**: traces arrive at the `exporter` URL. Open them in that
199
+ tool, for example Honeycomb, Grafana Tempo, Jaeger, or Dynatrace.
200
+
201
+ To send traces to Zuplo and your own backend at once, or to export logs as well,
202
+ see
203
+ [OpenTelemetry](../../articles/opentelemetry.mdx#send-traces-to-zuplo-and-your-own-backend).
@@ -36,7 +36,8 @@ own budget, and admins see who spent what. See [User Apps](./user-apps.mdx).
36
36
  **Provider Independence**: Switch between LLM providers (OpenAI, Anthropic,
37
37
  Google, Mistral, xAI, and more) dynamically without modifying app code.
38
38
  Configure model access through the gateway rather than hard coding it into your
39
- apps.
39
+ apps. Spread traffic across models, route by prompt complexity, and fall back
40
+ when a model fails. See [Routing and reliability](./routing.mdx).
40
41
 
41
42
  **Cost Control**: Set independent spending limits at the gateway, pool, and app
42
43
  levels. Configure hourly, daily, weekly, or monthly rules that warn or block
@@ -44,7 +45,7 @@ when usage reaches a limit.
44
45
 
45
46
  **Security & Compliance**: Apply guardrails to detect and block prompt injection
46
47
  attempts and prevent PII leakage in both requests and responses through
47
- integrated AI firewall policies.
48
+ integrated AI firewall policies. See [Guardrails](./guardrails.mdx).
48
49
 
49
50
  **Self-Service Access**: Developers can create apps, and anyone on the project
50
51
  can create a personal API key, without needing direct access to provider API
@@ -59,8 +60,9 @@ built-in policy.
59
60
  cached responses for similar prompts, reducing costs and improving response
60
61
  times.
61
62
 
62
- **Full Observability**: Real-time dashboards show request counts, token usage,
63
- time-to-first-byte metrics, and spending patterns across your gateway.
63
+ **Full Observability**: Real-time [dashboards](./observability/analytics.mdx)
64
+ show request counts, token usage, latency, and spending patterns across your
65
+ gateway.
64
66
 
65
67
  ## How It Works
66
68
 
@@ -14,4 +14,8 @@ each app picks from that menu in the order it wants. See
14
14
  [Policy Chains](../policy-chains.mdx) for how a chain executes and how options
15
15
  and secrets are inherited.
16
16
 
17
+ To choose between related policies, see [Guardrails](../guardrails.mdx) for
18
+ inspecting prompts and responses, and [Routing and reliability](../routing.mdx)
19
+ for picking models and falling back.
20
+
17
21
  <PolicyOverview policies={policies} products={["ai-gateway"]} />
@@ -132,9 +132,10 @@ Model Filtering → Fallback Model → Budgets and Costs → Semantic Cache
132
132
  - **Model Filtering** first: it accepts or rejects the request and creates the
133
133
  model selection.
134
134
  - **Fallback Model** second: it only enriches an existing model selection and
135
- never creates one. A chain with Fallback Model but no Model Filtering does
136
- nothing at all—the policy logs a warning and passes the request through
137
- unchanged. That's also why a fallback can never bypass the filter.
135
+ never creates one. A chain with Fallback Model but no policy that picks a
136
+ model, such as Model Filtering or Model Load Balancing, does nothing at
137
+ all—the policy logs a warning and passes the request through unchanged. That's
138
+ also why a fallback can never bypass the filter.
138
139
  - **Budgets and Costs** third: use it to set the app's budget and record usage.
139
140
  Place it after Fallback Model so an exhausted app budget can use the selected
140
141
  quota fallback.
@@ -144,6 +145,12 @@ Model Filtering → Fallback Model → Budgets and Costs → Semantic Cache
144
145
  Tracing policies work well at the end of the chain, so traces reflect the
145
146
  request the earlier policies produced.
146
147
 
148
+ Guardrails such as Data Loss Prevention and Prompt Injection Protection go
149
+ before Semantic Cache, so they inspect every request. See the
150
+ [recommended starting chain](./guardrails.mdx#recommended-starting-chain). To
151
+ spread requests across models with Model Load Balancing or route by prompt
152
+ complexity with Smart Router, see [Routing and reliability](./routing.mdx).
153
+
147
154
  When a **Block** budget runs out, requests to a provider can use the app's quota
148
155
  fallback. Cache hits return `429` instead of using a fallback.
149
156