Creates a new Brick instance.
The options for creating a Brick.
OptionalaiThe intelligence of the Brick instance. This is used to manage the AI capabilities of the Brick.
The key-value store of the Brick instance.
The event emitter of the Brick instance. This is used to emit events that occur in the Brick, such as the running of a program.
The unique identifier of the Brick instance.
The logger used by the Brick instance. This is used to log information about the operation of the Brick.
The name of the Brick instance.
OptionalstructureThe parent Structure of the Brick instance, if any.
Accumulates token usage/cost across every ask() call on this Brick.
Starts as a .child() of this.ai.usage when an Intelligence is
configured (so totals also roll up there), or standalone otherwise.
Rebound as a .child() of the parent Structure's usage when added
to one via Structure.add().
Returns the private map of programs.
Runs a prompt through this Brick's ai, offering its programs (via
Brick.tools) plus any tools attached via Brick.use.
Removes a program from the private map of programs by its name.
The name of the program to remove.
Toggles the keep alive flag of the Brick instance, which will prevent the Node process from exiting
A boolean indicating whether to turn the keep alive flag on or off.
Adds a program to the private map of programs.
The program to add.
Runs a program by its name with a given payload.
The name of the program to run.
The payload to pass to the program.
The result of the program.
The scheduled task.
Exposes every registered program as a ToolDefinition, each
execute calling this.run(program.name, input).
Every tool this Brick offers: its programs (via Brick.tools) plus anything attached via Brick.use.
Attaches external tool arrays (e.g. MCP-sourced tools) to this Brick,
included whenever ask() builds its tool list.
A Brick is the core of the framework. It encapsulates various functionality such as AI, data storage and retrieval, processing, and logging. Many Bricks can be combined to form a Structure, which may be easily passed around your application.