Superagent

Superagent is a safety guardrails platform that provides guard, redact, scan, and test operations for LLM applications. Respan’s Superagent exporter wraps these calls to capture them as tool spans, giving you full observability over every safety check — and gateway routing through the OpenAI-compatible Respan endpoint.

Create an account at platform.respan.ai and grab an API key. For gateway, also add credits or a provider key.

Run npx @respan/cli setup to set up with your coding agent.

Setup

1

Install packages

$pip install respan-exporter-superagent safety-agent
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

RESPAN_API_KEY is used to export traces to Respan.

3

Use the Respan-instrumented client

1import os
2import asyncio
3from respan_exporter_superagent import create_client
4
5client = create_client(api_key=os.environ["RESPAN_API_KEY"])
6
7async def main():
8 result = await client.guard(
9 respan_params={"customer_identifier": "user-123"},
10 input="Check this content for safety",
11 )
12 print(result)
13
14asyncio.run(main())
4

View your trace

Open the Traces page to see your Superagent safety operations as tool spans.

Configuration

ParameterTypeDefaultDescription
api_keystrRESPAN_API_KEY env varRespan API key.
base_urlstr | NoneNoneAPI base URL.

See the Superagent Exporter SDK reference for the full API.

Attributes

Pass Respan-specific params to each operation.

1result = await client.guard(
2 respan_params={
3 "customer_identifier": "user-123",
4 "metadata": {"source": "api", "version": "2.0"},
5 },
6 input="Check this content",
7)
AttributeDescription
customer_identifierUser/customer identifier.
metadataCustom key-value pairs.
disable_logSet True to skip logging this call.