Cereal docs
Build a research agent

Deploy the research application

Deploy the same research app with HTTP callbacks and a production environment credential.

Development uses an outbound channel; production uses signed HTTPS callbacks. The agent and session code stay the same. Cereal runs sessions in both environments.

Configure the application host

Create a production environment in the console and a key with read,data,control. Declarative initialization needs control for provider, connection and agent upserts. Configure these values on your application host:

VariableValue
CEREAL_API_KEYThe production environment key with read,data,control
NODE_ENVproduction (automatically selects HTTP callbacks)
CEREAL_PUBLIC_URLYour application's HTTPS origin, such as https://research.example.com
AI_GATEWAY_API_KEYYour model provider credential, unless already stored in this environment
RESEARCH_PROVIDERProvider name, gateway by default
RESEARCH_MODELA model enabled for your provider account
ADA_PASSWORD, GRACE_PASSWORDDifferent private passwords for the fixture members

The SDK learns the organization and environment from the Cereal key. No separate tenant configuration is needed. The sample sign-in is for fixture accounts; integrate your own authentication before serving real customers.

Build and start

pnpm install --frozen-lockfile
pnpm --filter @trycereal/sdk build
pnpm --filter research-agent build

Use examples/research-agent as the host's working directory. With a local .env, run pnpm start. If the host injects environment variables directly:

node --import tsx src/server.ts

The process serves browser assets and /api/cereal/mcp and /api/cereal/hooks. The first agent action initializes the provider, registers the HTTP connection and agent, then starts the session. Concurrent requests share initialization. A fresh serving process learns the verification tenant automatically.

For early registration, optionally run the same release's sync script:

node --import tsx src/sync.ts

It prints the target environment. Registration does not upload or deploy application code; serve the same release at the configured origin. Application instances still initialize their own runtime on first use.

Smoke-test production

Sign in as Ada over HTTPS. Research the Orion launch, refresh the conversation, request publication of the brief and answer its approval. Inspect the production trace. In a private window as Grace, confirm Ada's session returns 404. Stop the local development process to establish that production callbacks work independently.

Use a different Cereal key for each environment. Deploy the same release and let the SDK register its definitions in the target environment. Keep tool handlers compatible with older sessions. During rolling releases, coordinate initialization so an older instance does not overwrite a newer definition under the same slug.

Next: compare changes with evaluations.

On this page