Install
ai and provider packages already used by your application. Sentrial’s declared compatibility window is ai >=3 <8; that range does not make every framework option interchangeable between versions.
Connect an existing call
This module accepts the same options your existinggenerateText call uses. Import runAgent at that call site and pass those options unchanged.
generateText or streamText remain unchanged. The wrapper records the available model output, usage, tool results and errors; a successful agent response alone does not prove telemetry delivery.
configureVercel({ apiKey, apiUrl, defaultAgent }) is also available for process-wide defaults. The explicit client above lets the application drain its telemetry queue. Do not put request-specific identity into mutable process-wide configuration.
User and conversation identity
Resolve authentication in your request handler first, then pass the resulting strings to a per-request wrapper. Keep using your application’s authorization checks for conversation access.undefined. Await asynchronous authentication before constructing the wrapper; an async callback returns a promise instead of a user ID. Sentrial’s convoId groups telemetry and does not provide conversation memory to the model.
Tools and multi-step agents
Pass the existingtools, stopping conditions and callbacks unchanged. Sentrial wraps tool execution and observes model steps; it does not select your tools or change the agent’s stopping policy.
For AI SDK 5, tools use inputSchema and multi-step stopping uses stopWhen. Older applications may use parameters and maxSteps. Follow the API for the version installed in your project rather than mixing those forms. See the official AI SDK 5 migration guide.
Preserve structured tool results, including receipt IDs and pending/rejected states. Converting every tool result to a success string removes the evidence a signal needs to distinguish completed work from an attempted action.
Streaming
Keep the stream alive through consumption. For a command-line application, consume the stream and flush afterward:onFinish, onError and abort behavior. A disconnected, cancelled or unfinished stream is not proof of a completed business action.
For a short-lived process, call await client.shutdown() after all its agent work finishes. Do not shut down a shared client after every request.
Structured output and providers
wrapAISDK(ai) also wraps generateObject and streamObject when those functions exist in your installed version. Keep your existing provider/model and output schema. Model availability comes from the provider; recognition in a Sentrial pricing table does not mean a retired model can still be called.
Usage and cost depend on the metadata the framework returns and Sentrial’s model pricing coverage. Missing usage or an unknown price must not be interpreted as a free call. Review captured content and your PII configuration before sending sensitive inputs.
Verify the integration
- Run an existing agent request through the wrapper, using a test tool result you can recognize.
- Open Telemetry, inspect that run, and compare its final answer, tool inputs/results and completion state with your application.
- Use the published CLI’s readback command for that session:
Document agent walkthrough
Inspect recorded model responses and source evidence from an AI SDK agent.
TypeScript SDK reference
Client options, sessions and event APIs.

