Custom AI agents
Connect your custom AI agent.
Built it yourself, with Claude Code, OpenAI Codex, Grok or no assistant at all? Running on Claude, GPT, Gemini, Grok or an open model? Alalvera connects to your chatbot application or its conversation data, not to a particular AI model.
Part of the Alalvera subscription, not included in the 100 free audits. The SDK works today, with a key you make in the dashboard. It is Available
Built with
Whatever wrote the code.
- Claude Code
- OpenAI Codex
- Grok
- Another assistant
- Your own editor
Your chatbot application
Where the conversations happen. This is what we connect to.
- Claude
- GPT
- Gemini
- Grok
- Open source models
- Any other
conversation endsalalvera.sendConversation()
Alalvera
Checks every answer against your own rules.
- Proven errors
- Evidence
- Alerts
The model does not matter. The application does. What decides whether we can audit your agent is what your application can send, not what it runs on.
Any model
We read what your bot told the customer, word for word. Which model wrote it changes nothing in how it is checked.
Any coding assistant
Your account gives you the code for your stack and a prompt. Paste the prompt into the assistant you already use and review the diff it shows you.
One requirement
Your application runs server code where a conversation ends: JavaScript, TypeScript or Python for the SDK, or any language for the REST API. A chatbot that lives only inside a closed platform may not.
With an active subscription
From subscription to first audited conversation.
- In your account
Open Custom AI agent
It unlocks once your subscription is active. Our servers check that on every request, not only the page.
Pick your language and framework
JavaScript or TypeScript (any server code, Express, Next.js) or Python (any server code, FastAPI, Flask).
Create your integration key
It is shown once. Store it as
ALALVERA_API_KEYon your server, never in code, in git, in a browser or in a chat with an assistant.- In your code
Take the code and the prompt for your assistant
Both are written for the SDK version we support. Neither contains the key: the code reads it from the environment.
Review and implement
You or your assistant add one call where a conversation ends. It returns at once, sends in the background and never changes how your bot answers.
- Back in your account
Run the connection test
One command with the key set: the SDK's
test(). Your account shows the integration as connected, or the command says why not. Connected
From then on every finished conversation is audited, and proven errors reach you with their evidence.
What the code looks like. The code your account gives you: one call when a conversation ends.
// alalvera.ts: one Alalvera client for the whole server process.
import { Alalvera, type Role } from "@alalvera/sdk";
// The key comes only from the environment. Without it every call does
// nothing, so local development and tests need no key.
export const alalvera = new Alalvera({ apiKey: process.env.ALALVERA_API_KEY });
// Your stored messages use your own roles; map them to Alalvera's three.
// System prompts, tool calls and tool results are never sent.
function toAlalveraRole(role: string): Role | null {
if (role === "user") return "customer";
if (role === "assistant") return "bot";
if (role === "agent") return "human_agent";
return null;
}
interface StoredConversation {
id: string;
messages: { id: string; role: string; text: string; createdAt: Date }[];
}
// Call once per conversation, when it is finished (closed, resolved or timed
// out), after the bot's last reply. Returns at once: it sends in the
// background, retries on its own and never throws. Never await it on the path
// that answers the customer.
export function conversationFinished(conversation: StoredConversation): void {
alalvera.sendConversation({
externalId: conversation.id,
endedAt: new Date(),
messages: conversation.messages.flatMap((message) => {
const role = toAlalveraRole(message.role);
return role === null ? [] : [{ id: message.id, role, text: message.text, sentAt: message.createdAt }];
}),
});
}
// Or record the conversation as it happens:
// const recording = alalvera.conversation(conversationId);
// recording.customer(customerText); // when the customer writes
// recording.bot(replyText); // after your bot's reply is produced
// recording.end(); // when the conversation is finished
// Scripts, queue workers and serverless functions, before the process ends:
// await alalvera.flush();
# alalvera_client.py: one Alalvera client for the whole process.
import os
from datetime import datetime, timezone
from alalvera import Alalvera
# The key comes only from the environment. Without it every call does
# nothing, so local development and tests need no key.
alalvera = Alalvera(api_key=os.environ.get("ALALVERA_API_KEY"))
# Your stored messages use your own roles; map them to Alalvera's three.
# System prompts, tool calls and tool results are never sent.
ROLES = {"user": "customer", "assistant": "bot", "agent": "human_agent"}
def conversation_finished(conversation):
"""Call once per conversation, when it is finished (closed, resolved or
timed out), after the bot's last reply. Returns at once: a background
thread sends it, retries on its own and never raises."""
alalvera.send_conversation(
external_id=conversation.id,
ended_at=datetime.now(timezone.utc),
messages=[
{"id": m.id, "role": ROLES[m.role], "text": m.text, "sent_at": m.created_at}
for m in conversation.messages
if m.role in ROLES
],
)
# Or record the conversation as it happens:
# recording = alalvera.conversation(conversation_id)
# recording.customer(customer_text) # when the customer writes
# recording.bot(reply_text) # after your bot's reply is produced
# recording.end() # when the conversation is finished
# Scripts, task workers and serverless functions, before the process ends:
# alalvera.flush()
npm install @alalvera/sdk@0.1.0 or pip install alalvera==0.1.0. The key is read from ALALVERA_API_KEY; it is never in the code. Express, Next.js, FastAPI and Flask versions are in your account.
A prompt for your coding assistant.
Paste it into Claude Code, Codex, a Grok based assistant or any other. It asks for the smallest change, tells the assistant not to touch your bot's model or prompts, and to show you the full diff before anything is committed.
I want to connect my customer-service chatbot to Alalvera, an independent service that audits what the bot tells customers. Make the smallest change that does this, then stop and show me the full diff. I will review it myself before anything is committed or deployed.
What to do:
1. Add the official SDK, version 0.1.0: npm install @alalvera/sdk@0.1.0. It has no dependencies and works in TypeScript and JavaScript (ES modules, Node 18 or newer, Bun, Deno and edge runtimes).
2. Create one client per server process, at module level: new Alalvera({ apiKey: process.env.ALALVERA_API_KEY }). The key is read only from the ALALVERA_API_KEY environment variable. If the project has an example env file (such as .env.example), add ALALVERA_API_KEY to it with an empty value.
3. Find where a customer conversation ends in this code: the customer closes the chat, a human agent resolves it, or the session expires. If there is no such point, add one that fits the existing design, for example ending a conversation after 30 minutes without a new message.
4. At that point, after the bot's last reply has been produced and sent, call alalvera.sendConversation({ externalId, endedAt, messages }) once, with every message of the conversation in order: the customer's messages as role "customer", the bot's replies as "bot", a human agent's as "human_agent", each with its id, text and time (sentAt). Use the conversation's own stable id as externalId.
5. Do not await the call and do not put it on the code path that answers the customer: it returns at once, sends in the background, retries on its own and never throws.
6. Send each conversation once. Sending the same id again is ignored as a duplicate, so sending after every reply would audit only the first part of the conversation.
7. If this code runs as a script, a queue worker or a serverless function, await alalvera.flush() before it ends. If the app already handles SIGTERM, await alalvera.flush(5000) there; do not add a new signal handler otherwise.
Do not:
- change the bot's AI model, provider, prompts, system prompt, tools, temperature or any other model setting, or how replies are produced;
- send system prompts, tool calls, tool results, internal notes, customer profiles or any field other than the conversation's messages;
- print, log, hard-code or commit the key, or expose it to browser code;
- wrap the SDK in your own retries, queues or error handling; it already handles failures and never throws;
- change unrelated code or formatting.
When you are done:
- list the files you changed and why;
- tell me how to check it: with ALALVERA_API_KEY set in the shell, run node --input-type=module -e "import { Alalvera } from '@alalvera/sdk'; console.log(await new Alalvera({ apiKey: process.env.ALALVERA_API_KEY }).test())". Expected: { ok: true, status: 200 }. "invalid_api_key" means the key is wrong or revoked, "subscription_inactive" that the Alalvera subscription is not active, "disabled" that ALALVERA_API_KEY is not set.
The key is not in it. The prompt names the environment variable; the value stays on your server.
Your account always says where the connection stands. No guessing whether it worked.
The usual path
- Subscription requiredCustom agents unlock with the subscription.
- Ready to configureName the integration, pick your stack, create a key.
- Key createdShown once. Store it, then take the code.
- Waiting for testRun the SDK's test once with the key set.
- ConnectedConversations arrive and are audited.
Other states
- Connection failedThe test says why: a wrong or revoked key, an inactive subscription, or no key set.
- PausedThe subscription stopped. Findings stay; conversations go after your retention period, as always.
- Key revokedRefused at once. Create a new one any time.
Activate your Alalvera subscription to connect a custom AI agent.
$99 a month plus $0.15 per conversation for the first 1,000 and $0.05 after that. The 100 free audits cover uploads and, once they are live, ready made connectors, but not custom agents.
Questions developers ask
Do you need our model provider's API key?
No. We never call your model and never see its keys. The SDK sends the finished conversation and nothing else: no system prompt, model setting or customer profile.
Which languages are supported?
The SDK is for JavaScript or TypeScript (Node 18 or newer, Bun, Deno and edge runtimes) and for Python 3.8 or newer, with code for Express, Next.js, FastAPI and Flask. Other languages can call our REST API with the same key. The SDK's status is on the integrations page.
Is this part of the 100 free audits?
No. Connecting a custom AI agent is part of the subscription. You can still use the free audits with a supported helpdesk or trial method first.
What exactly do you receive?
For each finished conversation: its id, when it ended, and each message's id, role (customer, bot or a person on your team), text and time. Before anything leaves your server, the SDK replaces email addresses, card numbers and phone numbers. Prices, day counts and percentages stay, because the audit checks exactly those.
What if a key leaks?
Revoke it in your account: it stops working at once. Or rotate it: you get a new key, and the old one keeps working for 24 hours while you swap it.
Does the integration change how our bot answers?
No. It reports what was said after the conversation ends, in the background, and never throws into your code. Findings come with recommendations, and you decide what to change.