Deploy your application
Deploy the same agent and tool code with HTTP callbacks and automatic initialization.
Deploy your application and its tool and hook handlers to your chosen host, including a serverless host. Cereal continues to operate the session runtime.
Configure the target
Set CEREAL_API_KEY to a key with read, data and control in the intended
production environment. Declarative agents use control to register providers,
connections and versions when a new process initializes.
Use NODE_ENV=production and set CEREAL_PUBLIC_URL to your application's public
HTTPS origin. The SDK selects HTTP callbacks automatically. Provide model credentials referenced by your provider declarations,
or omit a provider secret to preserve a credential already stored in that environment.
Create any stored secrets named by third-party MCP configuration before initialization.
The API key tells the SDK which organization and environment it serves. Each new function or server process learns that context before verifying incoming callbacks.
Serve and initialize
Mount agent.fetch, agent.handlers or the same agent router used by your application.
Preserve callback paths and the original signed body bytes. Use the
framework integrations for your server.
The first agent action initializes its definitions. You can initialize early in an application startup step:
await agent.init()A deployment process can also call agent.sync() to inspect the registered version
and target environment. It registers configuration; it does not upload application
code, and another process still initializes its own runtime on first use.
Applications using only the direct API client against existing resources may use narrower credentials according to their operations. That client does not automatically register local definitions. See API client behavior.
Check the deployment
Start a session, invoke a tool, refresh the browser stream and answer an approval. Inspect the target environment's trace. Verify that a different customer cannot read, write or mint a token for the session. Stop the development channel first so it cannot conceal a missing production callback.
Sessions pin definition versions but use the code served by the callback URL. Keep old tool inputs compatible, or use versioned callback URLs for breaking changes. To roll back, deploy compatible tool code and register the earlier definition.
Deploy the same release with a separate CEREAL_API_KEY for each environment.
The SDK registers the code-defined agents directly in that key's environment.
An old application instance can register an older definition when it initializes;
coordinate rolling releases so old and new instances do not overwrite the same slug.
See the research app deployment.