Overview
Userespan-exporter-superagent to wrap the Superagent Python SDK (safety-agent). Each call to guard, redact, scan, or test is executed as usual and a log is exported to Respan Traces so you can observe safety checks in your Respan dashboard.
Quickstart
Step 1: Get a Respan API key
Create an API key in your Respan dashboard.Step 2: Install packages
Step 3: Set environment variables
Create a.env or export environment variables:
.env
Step 4: Create a client and call Superagent
Usecreate_client from respan_exporter_superagent instead of safety_agent. The client supports the same methods as the Superagent SDK; each call is logged to Respan when respan_params is provided (or when you rely on defaults).
Step 5: View your trace
Open the Traces page in your Respan dashboard. Logs appear as tool spans withintegration: superagent and method: guard (or redact, scan, test) in metadata.
Supported methods
The Respan Superagent client wraps the same methods as the Superagent SDK:| Method | Description |
|---|---|
guard | Run guard model on input (e.g. content safety). |
redact | Redact PII/sensitive data. |
scan | Scan content. |
test | Run tests. |
model, text, repo) as keyword arguments; pass respan_params to control how the call is logged to Respan.
Respan parameters
Userespan_params on any method to set span and trace fields in Respan:
- span_workflow_name – Workflow name (default:
"superagent"). - span_name – Span name (default:
"superagent.<method>"). - customer_identifier – User or tenant ID for filtering.
- disable_log – Set to
Trueto skip sending this call to Respan. - log_type – Log type (default:
"tool"). - trace_unique_id, trace_name, span_unique_id, span_parent_id, session_identifier, metadata – Optional trace/span and metadata fields.
Disable logging for a call
To call Superagent without exporting to Respan for that call:Using an existing Superagent client
You can wrap an existingsafety_agent client so only Respan export is added: