Agentic Performance Management for Production AI
This guide breaks down the anatomy of the Airbender Client and shows you what’s happening between your code and the Airbender Dashboard.
What is Wrapping a Call? A wrapper allows Airbender to intercept requests to Vercel’s LLM SDK’s like Generate Text and Stream Text to add logging and governance to each request. You’re code will control how and when Airbender intercepts requests, and allows you to override features when you need to. The following are the basic steps needed to create a Call to an AI.
There are a variety of AI Service Providers (Providers) like Open AI, Google Genini, Anthropic and many more. Each Provider offers a number of AI Models (Models) as well as several SDK’s such as Generate Text, Stream Text, Generate Object and others. To begin your AI project you must determine which combinations of these services you’ll use in your application, and setup Airbender to consume these services.
Once you connect your Client to the Airbender Dashboard, it will Populate the Providers and Models you’ve added to your project. Here you’ll be able to configure the Control Points which are returned by the fetchSession call for consumption by your code.
The FetchSession request returns both the Session ID, as well as the Settings from Airbender that control your AI Calls.
Identify the SDKs you intend to use and import the Airbender versions. For example: if you need Generate Text, you import airbenderGenerateText. For each SDK you identify if you want to disable logging on the input or output.
Because Airbender is stateless, you are responsible to keep the Settings from fetchSession. When you’re about to make the AI Call, using the API for that Provider and Model, you inject Airbender’s Settings into the Request Object giving control of your request to Airbender.
Using the Request object, make the request to the AI. Airbender’s Client will intercept the request, log the Input then complete the request to the AI, log the output, then return the request along with the Log/Event ID generated by Airbender.
It’s up to you to handle the Response in your code. Generate Text is the simplest as it can be awaited and will contain the Text, however it’s possible to integrate the response to work with Vercel AI’s useChat React Hook.
sequenceDiagram
actor A as Your Code
actor C as Client
actor D as Dashboard
actor L as LLM
A->>C: setup Airbender
A->>C: fetchSession
C->>+D: request a new Session
D->>-A: returns Session & Settings
A->>C: wrap LLM (GenerateText)
A->>+C: call the LLM
C->>+D: Log Input return Event ID
D->>-C: Airbender Modified Config
C->>L: Actual LLM Call
L->>C: LLM Response
C->>D: Log Output
D->>C: LLM response
C->>-A: LLM Response and Event ID