Default Factory Registry
The built-in `FactoryRegistry` populated with every adapter, store, and adapter the runtime ships with.
default_factory_registry()
The built-in set of
FactoryInvokers, ready to use.
default_factory_registry() returns a FactoryRegistry pre-loaded with every Component implementation that ships in the box. It is the entry point for AgentConfig::into_extensions: the config loads, the registry is consulted for each [[components]] entry, and the corresponding Component is constructed.
The full file is src/runtime/components.rs; the convenience entry point is default_factory_registry.
What it registers
kind | Component | Required feature |
|---|---|---|
provider.openai.chat | OpenAiChatComponent | openai |
provider.openai.embedding | OpenAiEmbeddingComponent | openai |
provider.anthropic.chat | AnthropicChatComponent | anthropic |
store.session.memory | MemorySessionStoreComponent | (default) |
store.execution.memory | MemoryExecutionStoreComponent | (default) |
store.run.memory | MemoryRunStoreComponent | (default) |
store.embedding.memory | MemoryEmbeddingStoreComponent | (default) |
store.artifact.memory | MemoryArtifactStoreComponent | (default) |
context.pipeline | ContextPipelineComponent | (default) |
Additional factories are added by feature flag:
kind | Component | Feature |
|---|---|---|
provider.anthropic.chat | AnthropicChatComponent | anthropic |
store.session.redis | RedisSessionStoreComponent | redis |
store.session.postgres | PostgresSessionStoreComponent | sqlx-postgres |
store.session.mongodb | MongoSessionStoreComponent | mongodb |
store.session.surrealdb | SurrealSessionStoreComponent | surrealdb |
store.embedding.qdrant | QdrantEmbeddingStoreComponent | qdrant |
event_store.redis | RedisRuntimeEventStoreComponent | redis |
stream_adapter.redis | RedisRuntimeStreamAdapterComponent | redis |
stream_adapter.nats_jetstream | NatsJetStreamStreamAdapterComponent | nats |
event_publisher.nats | NatsEventPublisherComponent | nats + queue |
event_publisher.redis_streams | RedisStreamsPublisherComponent | redis + queue |
The exact set of registered kinds is determined at compile time. Calling kinds() on the registry returns the active set.
How to extend
The default registry is built via:
pub fn default_factory_registry() -> FactoryRegistry {
let reg = FactoryRegistry::new();
let reg = register_providers(reg);
let reg = register_memory_stores(reg);
register_context_pipeline(reg)
}
Each register_* function takes a FactoryRegistry and returns the augmented one:
pub fn register_providers(reg: FactoryRegistry) -> FactoryRegistry;
pub fn register_memory_stores(reg: FactoryRegistry) -> FactoryRegistry;
pub fn register_context_pipeline(reg: FactoryRegistry) -> FactoryRegistry;
To add a custom factory, call register on the result:
let mut reg = default_factory_registry();
reg = reg.register("mycompany.internal-chat", my_invoke);
For feature-gated backends, register_* functions are added at compile time, so the augmentation depends on the feature set.
Worked example
use behest::runtime::factory_registry::FactoryRegistry;
use behest::runtime::default_factory_registry;
use serde_json::json;
let reg: FactoryRegistry = default_factory_registry();
for kind in reg.kinds() {
println!("{kind}");
}
// default features, no `openai` or `anthropic`:
// store.session.memory
// store.execution.memory
// store.run.memory
// store.embedding.memory
// store.artifact.memory
// context.pipeline
Edge cases
- Feature off — a
kindregistered by a feature is simply absent;invokereturnsFactoryError::UnknownKind. The factory is not "disabled" — it is not compiled in. - Custom registration replaces default — if you call
reg.register("store.session.memory", my_invoke), yourmy_invokeshadows the default. There is no "extend" semantics; if you want both, register yours under a differentkindand pick the one you want in the config. - Order does not matter —
registerreturnsself; the resulting registry is identical regardless of the order in which kinds were registered.
Relationship to other components
- FactoryRegistry — the type this builds.
- Component Wrappers — the
Componentimplementations registered. - AgentConfig — the consumer that calls
default_factory_registry()to populate the runtime from TOML.
See also
- FactoryRegistry — the registry type.
- Component Wrappers — the individual
Componenttypes. - AgentConfig — the config loader that uses this.