Skip to content

Signals and Signal Sources: What Brezel provides

Back to Signals and Signal Sources.

  • SignalSources: a module capability for driver selection, configuration, cursor state, and polling health.
  • Signals: a module capability for normalized payloads, classifications, audit state, and case references.
  • Cases: a capability for generated decisions or cases.
  • CaseWorkItems: a capability for reviewable, releasable work derived from a case.
  • SignalDriver: the PHP contract used to add channels other than IMAP.
  • imap: the built-in driver, implemented with directorytree/imapengine.
  • webhook: the built-in push driver for external applications. It provisions a token-authenticated source URL and sends received payloads through the same signal classification pipeline as polled sources.
  • signal-filter: an automatically provisioned small-model agent.
  • signal-case-builder: an automatically provisioned large-model agent.

Capabilities generate their canonical fields during Bakery planning. A new module can therefore use "fields": []. Explicit fields are only needed for presentation data, driver-specific configuration, or an existing schema that should be mapped to a capability.

Before enabling a source, make sure that:

  1. The API version containing the signal jobs and capability classes is deployed.
  2. Tenant migrations have been applied with php bakery migrate --force.
  3. The target system has a global client.
  4. AI provider credentials and the small and large default models are configured.
  5. The system scheduler runs every minute.
  6. A queue worker processes the system’s workflow queue.
  7. The four capability-backed modules described below have been applied.

For local queue processing:

Terminal window
php bakery work example

For a typical server, invoke Laravel’s scheduler every minute. The exact PHP path depends on the deployment:

* * * * * cd /path/to/brezel-api && php artisan schedule:run >/dev/null 2>&1

Set both defaults in the API environment:

OPENAI_API_KEY=sk-...
AI_DEFAULT_SMALL_MODEL=gpt-5.4-mini
AI_DEFAULT_LARGE_MODEL=gpt-5.4

AI_DEFAULT_MODEL remains the legacy fallback for the large tier. Model resolution follows this order:

  1. Explicit model on the agent.
  2. Provider-specific tier configuration, when present.
  3. AI_DEFAULT_SMALL_MODEL or AI_DEFAULT_LARGE_MODEL.
  4. Legacy AI_DEFAULT_MODEL fallback.

The signal filter uses small; the case builder uses large. If an agent with the reserved identifier already exists, Brezel uses that agent unchanged. This makes it possible to customize the provider, model, and instructions before the first signal arrives:

Terminal window
php bakery agent create example signal-filter \
--name="Signal Filter" \
--provider=openai \
--model-tier=small \
--background
php bakery agent create example signal-case-builder \
--name="Signal Case Builder" \
--provider=openai \
--model-tier=large \
--background

An explicit --model overrides --model-tier. Provider credentials and budgets are configured by the operator of the instance.

The generic SignalSources capability generates these fields:

FieldPurpose
source_identifierStable source identity used in deduplication keys.
driverRegistered driver identifier. Defaults to imap.
enabledWhether the scheduler should poll the source.
configurationDriver configuration not represented by dedicated fields.
cursorDriver-owned incremental polling state.
webhook_urlRead-only URL generated for a source using the webhook driver.
webhook_tokenRead-only secret token storage. The token is hashed; use the generated URL as the integration credential.
statusidle, active, or error.
last_polled_atTime of the last successful poll.
last_errorLast polling error, capped at 2,000 characters.

For an IMAP source, add editable IMAP fields and map them into the driver’s configuration:

[
{
"resource_module": "signal_sources",
"resource": {
"identifier": "signal_sources",
"title": "name",
"options": {
"capabilities": [
{
"identifier": "SignalSources",
"options": {
"field_mapping": {
"host_field": "imap_host",
"port_field": "imap_port"
}
}
}
]
}
}
}
]

The capability generates dedicated IMAP fields. Use field_mapping with capability roles such as host_field, port_field, username_field, password_field, encryption_field, validate_cert_field, folders_field, bootstrap_days_field and max_messages_per_poll_field. Dedicated fields override matching keys in the generic configuration field. Folders is a list of objects with a value field, not a list of strings.

The capability also accepts:

OptionDefaultPurpose
drivers["imap", "module", "webhook"]Choice values offered by the generated driver field. Add custom driver identifiers here.
field_mappingcanonical namesMaps capability roles to fields in an existing module.