Create a new Agent Builder. If any options are missing, the default will be applied:
forestServerUrl: 'https://api.forestadmin.com',
logger: (level, data) => console.error(level, data),
prefix: 'api/v1',
schemaPath: '.forestadmin-schema.json',
permissionsCacheDurationInSeconds: 15 * 60,
options
ProtectedaiProtectedcustomizationProtectedcustomizerProtectednocodeProtectedoptionsProtected ReadonlyprefixProtectedschemaEnable AI features for your Forest Admin panel.
All AI requests from Forest Admin are forwarded to your agent and processed locally. Your data and API keys never transit through Forest Admin servers, ensuring full privacy.
The AI provider configuration
A unique name to identify this AI configuration
The AI provider to use ('openai')
Your API key for the chosen provider
The model to use (e.g., 'gpt-4o')
The agent instance for chaining
Create a new API chart
name of the chart
definition of the chart
Add a datasource
the datasource to add
Optionaloptions: DataSourceOptionsthe options
Allow to interact with a decorated collection
the name of the collection to manipulate
a function that provide a collection builder on the given collection name
ProtectedgetProtectedmountMount the agent on an express app.
instance of the express app or router.
Mount the agent on a fastify app
instance of the fastify app, or of a fastify context
Mount the agent on a koa app
instance of a koa app or a koa Router.
Mount the agent on a NestJS app
instance of a NestJS application
Expose the agent on a given port and host
Optionalport: numberport that should be used, defaults to 3351 or to the PORT environment variable.
O will be set a random available port and the port will be available in the standaloneServerPort property.
Optionalhost: stringhost that should be used, default to the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise.
ProtectedremountRemove collections from the exported schema (they will still be usable within the agent).
the collections to remove
Restart the agent at runtime (remount routes).
ProtectedsendProtectedsetSet the MCP HTTP callback. Call this before mount() or remount().
Start the agent.
Stop the agent.
Update the typings files generated from your datasources
the path at which to write the new file
the max depth of relation typings
Allow to create a new Forest Admin agent from scratch. Builds the application by composing and configuring all the collection decorators.
Minimal code to add a datasource
Example