Downcity
PluginsHooksExamples

One Full Message Flow

Connect pipeline, guard, and effect in one scenario so the runtime sequence becomes obvious

One Full Message Flow

This page stops looking at one point in isolation and instead connects three hook types into one runtime path.

Scenario

You have one inbound message and want it to go through three steps:

  1. enrich it with source and page information
  2. check whether it was reviewed
  3. record one observation log

Host code

const enriched = await agent.plugins.pipeline("chat.enrich_message", {
  text: "Please summarize this page",
});

await agent.plugins.guard("review.require_checked", enriched);

await agent.plugins.effect("audit.observe", enriched);

The corresponding plugins

MessageAugmentPlugin

Owns the pipeline step:

  • add fields to the input

ReviewGuardPlugin

Owns the guard step:

  • decide whether the flow may continue

AuditEffectPlugin

Owns the effect step:

  • record what happened

Why these should not be merged into one point

Because they answer three different questions:

  • pipeline: should the value change
  • guard: may the flow continue
  • effect: should something be recorded

Once these are mixed into one point, the runtime meaning usually becomes harder to follow.

Main takeaway

Hooks do not mean "a plugin decides when it runs."

They mean:

  • the host defines the sequence
  • plugins participate at named points in that sequence