FabricFabricHarness
Reference

Triggers and Public Route Gating

How agents are invoked once deployed.

Triggers are agent metadata that tell generated servers which entrypoints should expose an agent. Put triggers inside the agent({...}) definition.

Declaring triggers

import { agent } from '@fabric-harness/sdk';

export default agent({
  name: 'webhook-triage',
  triggers: {
    webhook: true,
    // schedule: '*/15 * * * *',  // designed-for
  },
  async run({ input }) {
    return input;
  },
});

Default behavior

  • webhook: truePOST /agents/:agent/:id is enabled on the Node and Cloudflare server targets.
  • Without triggers.webhook, an agent is CLI-only in production HTTP deployments. fh run and fh dev can drive it, but the deployed server returns 404 for POST /agents/:agent/:id when production route gating is enabled.

Public route gating

For Node/Cloudflare deployments, gate the public route with:

  • --auth-token-env <var> (CLI / env) requiring a bearer token.
  • --max-body-bytes to cap body size.
  • --rate-limit-window-ms + --rate-limit-max for per-IP rate limits.

For Cloudflare, prefer route-level rules (e.g. only expose /agents/<name>/* for the agents you want public).

Schedule triggers

A schedule trigger is roadmap. For now, drive scheduled invocations from your existing cron / scheduler hitting POST /agents/:agent/:id.