Skip to main content
Not using an agent framework? Benchspan still works. Wrap the function that calls OpenAI with a decorator (Python) or the wrapCall helper (TypeScript). The wrapper scans your messages before the OpenAI request goes out.

Python

1

Install

2

Decorate the call

llm.py
Use @guard.wrap_async for an async def function.

TypeScript

1

Install

2

Wrap the call

llm.ts

Message format

Benchspan expects messages in standard chat shape:
  • system and assistant messages → skipped
  • user and tool messages → scanned (content must be a string)
  • The name field, if present, is passed as source to the dashboard

Want the raw scan without wrapping?

Python
TypeScript