Skip to main content

Bridges

A bridge is the thing the body calls when local layers cannot answer. All bridges extend SCPBridge and implement call(prompt, tools).

OllamaBridge

Free, local, no API key. Default for getting started.
OllamaBridge.isAvailable() is a quick health check that returns a boolean and never throws.

BedrockBridge

Wraps the AWS SDK Converse API. @aws-sdk/client-bedrock-runtime is an optional peer dep.
Credentials follow the standard AWS chain (env, shared file, EC2 role).

OpenAIBridge

Raw node:https. No SDK dependency.

Writing a custom bridge

Subclass SCPBridge. Implement call(prompt, tools). Return whatever shape your body expects.
The base class tracks callCount, errorCount, totalDurationMs, and lastCallMs. Read them via bridge.stats().

Cost comparison

Sample run: 100 brain calls during a 10-minute session, ~400 tokens per call. After the cache learns the typical situations, brain calls drop to a handful per minute and the numbers above shrink proportionally.