Agent classes provided by Vercel’s ai SDK.
The signature of this class has evolved between major ai versions (5 -> 6);
as a result, Handlebar provides different client packages to support the different major versions
of ai.
Prerequisites
- A Handlebar account
- Handlebar API key (created on the platform)
v5
package:@handlebar/ai-sdk-v5supported versions:
^5.0.0
Basic setup
The primary component of the Handlebar SDK is theHandlebarAgent class,
which is a wrapper around Vercel’s Experimental_Agent.
ai-sdk-agent.ts
HANDLEBAR_API_KEY environment variable
to one of the keys you created on the platform.
After that, you’re good to go!
Handlebar will automatically start sending audit logs
(actions the agent is taking)
to the Handlebar api.
Agent identity
Registering an agent identity will allow you to apply rules to specific agents. You can configure agent identity while initialising theHandlebarAgent class.
ai-sdk-agent.ts
Enduser identity
It’s often important to know which person/entity the agent is acting on behalf of, an “enduser” in Handlebar terms. You can provide unique identifiers for each of your users to Handlebar- typically this would be user IDs used within your system -
- and Handlebar will attach the logs and agent actions to the enduser. This allows you to apply rules to specific endusers, or groups of endusers based on their metadata, and apply consequences such as lockdown to subgroups of your users.
ai-sdk-agent.ts
v6
Suppoert for Vercel AI v6 is coming soon!Please email
contact@gethandlebar.com to report security issues relating to Handlebar and client packages.