Templates / AI agent patterns / ai-prompt-chaining

AI Prompt Chaining

Splits writing an article into three model calls — outline, draft, edit — each fed the previous step's output. Between the first two sits a programmatic gate, a FEEL script that checks the outline before any more tokens are spent; an outline that fails the gate sends the brief back instead of producing a weak article.

aiprompt chainingai agent taskgatecontent
Open in editor Download .bpmn
casen template use ai-prompt-chaining
pass fail Writeoutline Checkoutline Write draft Edit fortone andlength Save to CMSas draft Return briefto requester Brief received Outline passes? Article ready Brief returned

Scenarios · 2

  • The outline passes the gate and the article is written write-outline → check-outline → write-draft → edit-draft → article-ready
  • A one-line outline fails the gate write-outline → check-outline → return-brief → brief-returned

Job types · 3

  • cms-draft-save Save to CMS as draft
  • io.camunda.agenticai:aiagent:1 Write outline, Write draft, Edit for tone and length
  • requester-notify Return brief to requester

Files · 2

Every scenario passes on @bpmnkit/engine's runScenario in the package's tests. casen template use ai-prompt-chaining [dir] writes the files above into your project — see the templates guide for running the scenarios and deploying.