AI Co-Pilot
Beefree SDK's AI Co-Pilot is the out-of-the-box AI agent that your user can prompt to create email designs, edit layouts, generate variations, and review templates. You install it in the Developer Console, choose a supported provider, and configure your model to make it available for your end users. Hosts can also persist chat history to continue guided sessions across visits and future revisions.
Overview
Beefree SDK's AI Co-Pilot is installed as a Partner AddOn — part of the same family of ready-to-install extensions available through the Beefree SDK Partner AddOns directory.
It is installed and configured directly from the Beefree SDK Developer Console, without any changes to your integration code. For a general walkthrough of how Partner AddOns work, see Installing Partner AddOns.

The AI Co-Pilot is a ready-made conversational agent that enables advanced workflows in the Beefree SDK email builder. Your users can prompt the agent to:
create full email designs from scratch
edit existing designs, for example by adding a content block, changing the structure, or switching the color palette
generate content variations while preserving core brand elements
check an existing template for quality or accessibility issues, for example missing image links or alt text
If you'd like the Co-Pilot to follow specific brand guardrails, you can work with Brand Rules to ensure the Co-Pilot's output matches your users' brand.
Unlike the AI Writing Assistant, which targets individual content blocks, the AI Co-Pilot surfaces a "Create with AI" panel. Thanks to this, your users can generate, iterate on, and apply content across their design in a guided chat experience within the Beefree email builder embedded in your application.
End users can always manually edit any design the agent generates. That keeps the workflow collaborative: AI helps your users move faster, while they stay in control as creative directors, shaping the final result to match their vision.
Inside the builder, your users can:
open the Co-Pilot from the floating button on the stage, or from the Edit with AI (sparkle) action on the toolbar of the selected row or content block. When opened from a toolbar, the Co-Pilot keeps that row or block selected and uses it as the context of the conversation.
start from a prompt starter: when the conversation is empty, the panel shows a short list of suggested prompts. Clicking one fills the prompt input, so the user can complete it before sending. You can replace them with your own using
promptStarters.copy an answer of the agent to the clipboard, as plain text, with the copy button under the answer.

AI Co-Pilot is registered as ai-agent in the standard addOns array passed to BeePlugin.create(). Message history is surfaced through the existing onInfo callback.
Activation
You can configure AI Co-Pilot through the Beefree SDK Developer Console under AddOns → AI Co-Pilot.

Prerequisites
An API key from one of the supported AI providers.
Configure in the Developer Console
Log in to the Beefree SDK Developer Console.
Navigate to your application, then open the AddOns section.
Click on Browse AddOns and select AI Co-Pilot.
Click Install. You will then see the AI Co-Pilot available in the installed AddOn section.
Set up your AI Co-Pilot:
Select your provider.
Select your model.
Enter your API key.
Once you’ve completed the setup, toggle on Enable, then click Save.
Supported providers
Three providers are currently supported: Anthropic, OpenAI, and Gemini. Each provider offers a range of models, from faster and more economical options to higher-capability ones that produce stronger output at higher cost and latency. The Developer Console shows a recommended default for each provider and flags any models that've been deprecated or retired. You'll always find current availability and status there, rather than on this page.
Anthropic
Anthropic's Claude models prioritize safety, alignment, and high-quality conversational output — making them well-suited for creative and editorial workflows inside the builder.
OpenAI
OpenAI's GPT models offer broad language coverage and advanced text generation capabilities across a wide range of writing styles and use cases.
Gemini
Gemini models from Google DeepMind offer multimodal capabilities and competitive performance on text generation tasks.
AI Co-Pilot configuration
Add an entry with id: 'ai-agent' to beeConfig.addOns. All settings fields are optional.
Custom System Prompt
Customizing the system prompt lets you control how the AI Co-Pilot behaves in your application. Use it to define tone of voice, brand guidelines, and the kind of content the assistant should favor or avoid, so generated design and copy stays consistent with your product and your users’ expectations.
Settings reference
initialMessages
message array
No
Loads a previous conversation at panel mount. Pass back exactly what you received from onInfo as detail.messages — the shape is identical. Persist that array (e.g. in localStorage) and replay it here on the next session. Pass [] or omit to start blank.
systemPrompt
string
No
Forwarded verbatim with every chat request. Use it to inject role, tone, or brand voice instructions.
maxIterations
number
No
Caps the agent's auto-continue loop on tool-call turns. Defaults to 10. Lower it to control cost and latency.
loadingPhrases
string[]
No
Replaces the default cycling phrases shown under the loader (e.g. "Sending request", "Working"). Phrases cycle per auto-continue turn and are announced via aria-live.
brandRules
brandRules object
No
Brand Rules the Co-Pilot must follow (presets, permissions, limits). See the Brand Rules page for the full schema and logic.
reusableRows
{ entries: [...] }
No
A library of your users' saved rows the Co-Pilot can search and place instead of building them from scratch. Core plan and above. See Reusable Rows for AI for the row shape and limits.
fileManager
fileManager object
No
The folders of your user's File Manager the Co-Pilot can list and search, save files to, and delete files from. See Using the File Manager with the AI Co-Pilot.
Receiving message updates (onInfo)
The panel's chat history is broadcast through the SDK's top-level onInfo callback. Filter by code and detail.handle:
Event shape
When it fires
After each auto-continue turn (partial progress is preserved if the user closes the panel mid-iteration).
When the model finishes its full response.
When the user clicks Stop or closes the panel during active generation.
The initial emission caused by seeding the store from initialMessages is not echoed back — only real changes trigger the callback.
Opening and closing the panel programmatically
By default, end users open the AI Co-Pilot panel by clicking its icon in the builder. You can also open or close the panel programmatically using the toggleAgent Frontend Command, without requiring a click.
Each call toggles the panel's current state: calling it while the panel is closed opens it, and calling it while it's open closes it. See the Frontend Commands page for the full reference.
Tracking token usage (onInfo code 1000)
The Co-Pilot reports the tokens it uses through the same onInfo callback, with code 1000, the code the AI Writing Assistant uses for its usage reports. Use it to monitor consumption or to bill your users.
A single prompt can result in several requests to the AI provider: when the agent edits the design, it keeps working in more steps until it answers (up to maxIterations). The Co-Pilot sends one 1000 event for each request, and all the events of the same prompt share the same promptId. Add them up to get the usage of a prompt; don't keep only one event per promptId, or you lose part of the usage.
Usage event shape
code
1000
message
"Token usage for addon handle: ai-agent"
detail.handle
"ai-agent"
detail.promptId
string — the same for all the requests of one prompt
detail.usage
Token usage of this request (see below)
detail.usage
inputTokens
number
Input (prompt) tokens.
inputTokenDetails.noCacheTokens
number
Input tokens not read from the cache.
inputTokenDetails.cacheReadTokens
number
Input tokens read from the cache.
inputTokenDetails.cacheWriteTokens
number
Input tokens written to the cache.
outputTokens
number
Output (completion) tokens.
outputTokenDetails.textTokens
number
Output tokens of text.
outputTokenDetails.reasoningTokens
number
Output tokens used for reasoning.
totalTokens
number
Total tokens of the request.
Not every provider and model reports every field: a field can be missing or undefined, so treat it as 0.
Checking prompts before they are sent (aiAgentBeforeSend)
With the aiAgentBeforeSend hook, your application can check every prompt before it leaves the browser, and allow it or block it. Use it, for example, to run a DLP (data loss prevention) check on your server and keep personal or sensitive data away from Beefree and the AI provider.
Declare the hook in beeConfig.hooks. When it's configured, each time the user sends a prompt the Co-Pilot calls your handler first. Nothing reaches any Beefree backend or the AI provider until your handler allows it.
Payload
promptText
string
The text the user typed in the chat.
Response
Call resolve with an object:
allowed
boolean
Yes
true sends the prompt. false blocks it.
message
string
No
Shown to the user when allowed is false, as plain text (up to 500 characters). Omit it to show a default message.
What the user sees
Allowed: the prompt is sent as usual.
Blocked (
allowed: false): the chat shows yourmessage, or a default message if you didn't provide one. The prompt stays in the input, so the user can edit it and send it again.Check failed: the prompt is not sent and the chat shows an error with a Retry button. Retry asks your handler again. This happens when your handler calls
reject(), resolves with a response that doesn't match the shape above, or doesn't answer withinbeforeSendTimeout(30 seconds by default). A malformed response is also reported throughonError.
The check is fail-closed: if your handler can't give a verdict, the prompt is never sent.
If the hook isn't configured, the Co-Pilot sends prompts directly, without any extra round trip.
Persisting chat history
The SDK does not store the conversation itself — persistence is the host application's responsibility. The simplest approach uses localStorage:
This produces a conversation that survives page reloads and follows the user across sessions.
Full configuration example
Using Brand Rules with the AI Co-Pilot
With Brand Rules, you can attach a brandRules object when starting an AI editing session. Brand Rules act as guardrails that the Co-Pilot must work within so that the output it generates matches your (or your end users') brand.
Please check out the Brand Rules page for a full overview of the different types of Brand Rules you can set and to access the full JSON Schema for Brand Rules.
To make the Co-Pilot work with Brand Rules, you simply pass the brandRules object in the AI Agent settings section of your config file when starting an AI editing session. Check out the example above to see what that can look like.
Using Reusable Rows with the AI Co-Pilot
With Reusable Rows, you can hand the Co-Pilot a library of your users' saved rows: like brand headers, footers with legal text, signatures. When prompted to find a saved row, the Co-Pilot searches the library and places the approved row instead of generating a new one.
To enable it, pass the library as reusableRows in the AI Agent settings:
The Co-Pilot starts a new MCP session for every prompt and attaches the library to each of them, so a change to
reusableRowsapplies from the next prompt.On Core plans and above, the Co-Pilot is also told how to use the library: search before building, place rows by id, never edit a synced row.
If you set your own
systemPrompt, it replaces the default instructions, including the ones about reusable rows. The library and its tools are still available, but you need to describe how to use them in your own prompt.If the library is too large, it's trimmed, and the editor reports it through
onWarningwith code1770. If a row is invalid, the session doesn't start and the Co-Pilot shows the error. See Reusable Rows for AI.
Using the File Manager with the AI Co-Pilot
With File Manager for AI, the Co-Pilot can find, save, and delete files in your user's File Manager, only in the folders you allow. Pass the folders as fileManager in the AI Agent settings:
The Co-Pilot works in the File Manager of the
uidthe editor was started with.The folders apply to the MCP session the Co-Pilot starts for a prompt. If a session is still open, or the editor joined one with
bee.join(), the prompt runs in that session, with that session's ownfileManager.An invalid
fileManagerkeeps the session from starting, and the Co-Pilot shows an error with a Retry button. Check it with the validation endpoint, adding the editor'suid: the endpoint requires one.
See File Manager for AI for path rules, limits, and choosing folders for the agent.
Disable the AI Co-Pilot per user
To disable the AI Co-Pilot for a specific user, set enabled: false on the AddOn entry. To re-enable it, change the value to true.
Additional considerations
Only one provider can be active per application at a time. You can switch providers at any time from the Developer Console without code changes.
The
systemPromptfield is a powerful lever for brand alignment — use it to enforce tone, language, and content guardrails across all end-user sessions.Lowering
maxIterationsfrom the default of10is recommended in cost-sensitive environments, especially when using larger models such as Claude Opus or GPT-5.4.To monitor the tokens your users consume, listen to the token usage events (
onInfocode1000).To inspect or block prompts before they are sent (for example, for DLP), use the
aiAgentBeforeSendhook.For data security and privacy information, refer to the AI Providers and Data Security page.
Related resources
AI Writing Assistant AddOn — block-level AI writing, configured separately.
Configuration Reload — update AddOn settings in real time via
bee.loadConfig().
Last updated
Was this helpful?

