You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
system_prompt="You are a helpful assistant that provides concise responses.",
293
+
tools=[http_request, calculator],
294
+
trace_attributes={
295
+
"session.id": "abc-1234",
296
+
"user.id": "user-email-example@domain.com",
297
+
"tags": [
298
+
"Agent-SDK",
299
+
"Okatank-Project",
300
+
"Observability-Tags",
301
+
]
302
+
},
303
+
)
304
+
```
305
+
286
306
### Configuring the exporters from source code
287
307
288
308
The `StrandsTelemetry().setup_console_exporter()` and `StrandsTelemetry().setup_otlp_exporter()` methods accept keyword arguments that are passed to OpenTelemetry's [`ConsoleSpanExporter`](https://opentelemetry-python.readthedocs.io/en/latest/sdk/trace.export.html#opentelemetry.sdk.trace.export.ConsoleSpanExporter) and [`OTLPSpanExporter`](https://opentelemetry-python.readthedocs.io/en/latest/exporter/otlp/otlp.html#opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter) initializers, respectively. This allows you to save the log lines to a file or set up the OTLP endpoints from Python code:
For more information about the accepted arguments, refer to `ConsoleSpanExporter` and `OTLPSpanExporter` in the [OpenTelemetry API documentation](https://opentelemetry-python.readthedocs.io).
313
333
314
-
### Custom Attribute Tracking
315
-
316
-
You can add custom attributes to any span:
317
-
318
-
```python
319
-
agent = Agent(
320
-
system_prompt="You are a helpful assistant that provides concise responses.",
321
-
tools=[http_request, calculator],
322
-
trace_attributes={
323
-
"session.id": "abc-1234",
324
-
"user.id": "user-email-example@domain.com",
325
-
"tags": [
326
-
"Agent-SDK",
327
-
"Okatank-Project",
328
-
"Observability-Tags",
329
-
]
330
-
},
331
-
)
332
-
```
333
-
334
334
## Best Practices
335
335
336
336
1.**Use appropriate detail level**: Balance between capturing enough information and avoiding excessive data
0 commit comments