Skip to main content
FrogBot reads frogbot.config.ts, frogbot.config.mjs, or frogbot.config.js from the current directory or a parent. Set FROGBOT_CONFIG_PATH to use another location.

Create the file

Export the result of buildConfig from your project root.
buildConfig validates the FrogBot surface, runs plugins, and returns a sanitized configuration. Run type generation to add configured agent slugs to GeneratedTypes.

Set core options

FrogBotConfig requires secret, db, and collections. globals are forbidden; use collections instead.

Routes

Query presets


Key-value store

frogbot.kv stores JSON values by key. The default databaseKVAdapter() uses a collection in your database. Use redisKVAdapter() from @frogbotai/kv-redis to keep keys in Redis instead.
databaseKVAdapter() options (imported from frogbot/kv) redisKVAdapter() options

Assemble an app

Keep collections and agents in separate modules and import them into the config.
admin.meta takes the page metadata type from next, so apps that install next get its full autocomplete. In a package without next, admin.meta is untyped when skipLibCheck is true, and TypeScript reports Cannot find module 'next' when it is false. agents is an array of AgentConfig objects, not a directory path. FrogBot v0 does not scan AGENT.md files or upsert them into a collection. Configuring an agent also enables chat persistence. FrogBot injects owner-scoped chats and messages collections unless you adopt those roles with chat: true and message: true. See Chat persistence.

Configure inference

Provider credentials are converted into an embedded gateway during initialization. Aliases map one slug to one provider-prefixed model ID and do not add fallback or per-alias access rules.
See AI for operation signatures, AI SDK v7 output, hooks, and the authenticated /api/v1/* mount. Every option of a custom endpoint and its models is listed in Custom provider options.

Register workers

Each entry supplies a URL-safe slug, model or alias, instructions, optional tools, an optional stop condition, and optional access.
An ai block is required when agents is present. See Agents for tools and invocation.

Add endpoints

Root endpoint handlers receive FrogBotRequest, including req.frogbot.
FrogBot reserves /agents and /agents/* for its agent API. A collection cannot use the agents slug.

Run plugins

Plugins receive and return FrogBotConfig, synchronously or asynchronously. They run one at a time before sanitization, by order, lowest first; plugins with the same order run in array order. See Order, slug, and options.
A plugin failure stops the build and reports its array index. Plugins that need initialization should append a callback instead of wrapping an existing one.

Run initialization steps

Pass one callback or an array to onInit. Array callbacks are awaited sequentially in declared order, and each receives the initialized FrogBot instance. If a callback throws or rejects, startup fails immediately and later callbacks do not run. An empty array is a no-op.

Follow startup

Startup applies the configuration in this order.
  1. Validate secret, db, collections, and the absence of globals.
  2. Run plugins serially.
  3. Resolve chat collection roles and inject any missing defaults.
  4. Sanitize collections, endpoints, AI, and workers.
  5. Initialize FrogBot and attach req.frogbot to supported request paths.
  6. Create the embedded gateway and register optional AI telemetry.
  7. Build the typed worker registry.
  8. Run configured onInit callbacks.
When workers are configured, sanitization also mounts GET /api/agents and POST /api/agents/:slug. The standalone server mounts authenticated gateway traffic under /api/v1/* before forwarding other /api/* requests to FrogBot.