webhook and app triggers. Mount a trigger on an agent using its instance reference.
Mount a trigger
ops to your configuration’s agents array. Use AgentConfig<typeof piece.triggers.ref> for contextual inference from the trigger’s input and output schemas. Plain AgentConfig leaves the handler’s event as unknown. The handler receives the emitted event’s data, the agent, and a request with { piece, trigger, agent } in req.context.trigger; piece is the instance slug.
Piece trigger entries have no
type; schedule triggers use type: 'schedule'. See Schedule runs.
Instance slugs default to the piece slug. Give distinct instances unique slugs when they receive webhooks, including channel mounts. You can share one instance across agents.
Routes and lifecycle
Both paths use your configured
routes.api prefix instead of /api when customized. Generated subscription URLs combine serverURL, that prefix, and the instance slug.
Boot reconciliation reuses unchanged subscriptions, replaces changed subscriptions, and cleans up removed mounts. If an instance is missing during cleanup, FrogBot retains its subscription ledger entry and logs a warning: credentials cannot be reconstructed from the database. To retry cleanup, use the instance again, with its credentials, in an agent’s triggers, channels, or tools, or in connections.
Boot reconciliation and the subscription ledger exist only while an agent declares a trigger or channel. Removing the last trigger and channel stops automatic deregistration, so delete those webhooks at the provider.
If registration succeeds but saving its state fails, FrogBot attempts provider cleanup and retains recovery state when cleanup fails. An unresolved registration blocks another enable attempt rather than creating a duplicate. A process crash before state is persisted can require manual provider cleanup.
Polling triggers and automatic subscription renewal are not supported yet.
Delivery and retries
FrogBot verifies incoming requests and queues events before running agent handlers. Each event’s requireddedupeKey is tracked for 24 hours per recipient: agent, instance, and trigger. A provider retry can enqueue failed recipients without re-enqueueing recipients whose queue and dedupe writes succeeded.
FrogBot automatically adds an all-queues job runner scheduled every minute (* * * * *), sharing the runner when agent schedules are also configured. The trigger task currently sets no automatic handler retry policy.
Delivery is not exactly once: if enqueue succeeds but persisting the dedupe marker fails, a retry can queue the event again. Make handler side effects idempotent.
Runtime subscriptions
Usefrogbot.triggers to manage mounted webhook subscriptions. It works only while an agent declares a trigger or channel; without one, its methods reject.
Subscription entries store raw input as
{ value: input }, or {} when input was omitted. Input must be JSON data; FrogBot reapplies the trigger schema before each callback so schema transforms are preserved.
enable accepts:
Runtime changes do not edit your configuration. The next boot restores declarative input and re-enables subscriptions whose mounts remain configured.