Browse docs

Workflow Playbooks

Pick the product workflow you are building, then copy the Mighty scan plan for that workflow.

This page answers one question: where should Mighty go in a real product flow?

Use it like a menu. Pick the workflow that matches your app, then follow the scan plan.

The Pattern

Every workflow has the same shape:

untrusted material -> Mighty scan -> product route -> trusted next step

Mighty should run before material reaches:

  • AI model context.
  • OCR or extraction.
  • Permanent storage.
  • Search or indexing.
  • Payment or approval.
  • Agent tools.
  • Human review queues.

Pick Your Workflow

If your app hasUse this playbookFirst scan goes before
A chat assistantChat appsThe model call.
Public AI answersOutput scanningThe user sees the answer.
PDF, image, or document uploadsFile intakeStorage, OCR, or extraction.
OCR or IDPOCR and IDPExtracted fields become trusted data.
Damage photosDamage photo reviewClaim, repair, or payment decisions.
Invoices or estimatesInvoice reviewApproval, payment, or AI summary.
Agents or toolsAgent tool reviewTool output enters model context.
Large batchesBatch intakeBatch automation writes state.
Human reviewersReview queuesReviewers act on scan results.

Chat Apps

Goal: stop risky prompts before the model runs, then scan public output before users see it when strict output safety matters.

Scan plan:

StepWhat to scanSettingsRoute
1Latest user messagecontent_type=text, scan_phase=input, mode=secure, focus=bothALLOW calls model. WARN reviews or adds friction. BLOCK stops.
2Assistant answer for strict routesscan_phase=output, profile=ai_safety, data_sensitivity=strictShow ALLOW. Show redacted_output when returned. Block otherwise.
3Tool output or retrieval contentscan_phase=output, profile=ai_safetyOnly clean output enters model context.

Use Vercel AI SDK Chat Guardrail when this is a Next.js AI SDK route.

File Intake

Goal: stop suspicious uploads before storage, OCR, extraction, indexing, or automation trusts them.

Scan plan:

StepWhat to scanSettingsRoute
1Original uploadcontent_type=auto, scan_phase=input, mode=secure, focus=bothALLOW continues. WARN quarantines or reviews. BLOCK stops.
2OCR text or extracted fieldscontent_type=text, same scan_group_id, data_sensitivity=tolerantKeep extracted data untrusted until scan passes.
3AI summary of the filescan_phase=output, same scan_group_idShow or store only after routing.

Use one scan_group_id for the original file and all derived scans from that file.

OCR And IDP

Goal: prevent hidden document instructions, OCR errors, and poisoned extracted text from becoming workflow facts.

Scan plan:

StepWhat to scanSettingsRoute
1Original PDF or imagecontent_type=pdf, image, or auto, focus=bothReview suspicious original evidence.
2OCR textcontent_type=text, data_sensitivity=tolerantWARN marks fields untrusted. BLOCK stops automation.
3Structured fields or summaryscan_phase=output if generated by extraction or AIStore only routed output.

Common mistake: scanning only the extracted text. Scan the original file first when possible.

Damage Photo Review

Goal: flag suspicious image evidence before it drives a claim, repair, or payment decision.

Scan plan:

StepWhat to scanSettingsRoute
1Damage photocontent_type=image, scan_phase=input, focus=both, profile=strictALLOW continues. WARN reviews. BLOCK stops automation.
2High-value or suspicious photomode=comprehensive, async=trueShow pending review until final result.
3AI-generated damage summaryscan_phase=output, same scan_group_idDo not trust generated summary without output routing.

Say Mighty flagged suspicious evidence. Do not say Mighty proved fraud.

Invoice And Estimate Review

Goal: check invoices and repair estimates before approval, payment, or AI summarization.

Scan plan:

StepWhat to scanSettingsRoute
1Invoice PDF, estimate PDF, or imagecontent_type=auto, scan_phase=input, data_sensitivity=tolerantWARN queues review. BLOCK stops approval.
2Extracted line itemscontent_type=text, same scan_group_idDo not write risky fields to payment workflow.
3AI comparison or recommendationscan_phase=output, profile=strictReview WARN, BLOCK, and indeterminate.

Use metadata such as workflow=invoice_review, vendor_id, claim_id, and invoice_id when available.

Agent Tool Review

Goal: keep unsafe tool output, retrieved documents, and browser content out of the next model step.

Scan plan:

StepWhat to scanSettingsRoute
1User promptscan_phase=input, focus=bothOnly ALLOW starts the agent.
2Retrieved documents or tool outputscan_phase=output, profile=ai_safety or code_assistantALLOW can enter context. WARN needs constrained handling. BLOCK stays out of context.
3Final answer or planscan_phase=output, same session_idScan before user or tools act on it.

Agents are multistep. Use one session_id for the agent run. Use scan groups for related prompt, retrieval, tool output, and final answer chains.

Batch Intake

Goal: scan many records or files without losing traceability.

Scan plan:

StepWhat to scanSettingsRoute
1Each itemOne scan per item, unique request_idDo not use one result for the whole batch.
2Batch sessionOne session_id for the batchUse one scan_group_id per item.
3Failures and limitsHandle 402, 413, 429Retry with backoff or route item to review.

Common mistake: one scan_group_id for the whole batch. Use one group per item.

Human Review Queues

Goal: give reviewers enough context to decide what happens next.

Store:

FieldWhy
scan_idLink to the scan result.
request_idDebug request and retry behavior.
scan_group_idShow the evidence chain for one item.
session_idShow the wider claim, chat, case, batch, or agent run.
action, risk_score, risk_level, threatsExplain why the item was routed.
content_type_detected, authenticity, forensicsShow modality-specific evidence when returned.
Human decisionKeep final review outcome separate from Mighty scan result.

Mighty routes risk. Your team makes the final business decision.

Default Routing

Three response fields drive workflow decisions, and each comes from a different part of the response.

action — the routing decision. Switch on this:

actionDefault product route
ALLOWContinue. Store IDs.
WARNReview, add friction, constrain model, or request more evidence.
BLOCKStop automation. Use redacted_output only when returned and policy allows it.

scan_status — async lifecycle. Only meaningful for mode=comprehensive + async=true:

scan_statusDefault product route
pendingKeep pending, poll GET /v1/scan/<scan_id>, or wait for the webhook.
completeThe action field is final — apply routing.
failedHigh-risk workflows go to review. Low-risk workflows can retry once.

authenticity.verdict — forensics finding on file content (image / PDF), distinct from routing:

authenticity.verdictMeaning
likely_realCamera capture or signed-document signals match.
likely_ai_generatedMid-confidence synthetic-content signals — usually pairs with WARN.
ai_generatedHigh-confidence synthetic — usually pairs with BLOCK.
indeterminateEvidence is weak or conflicting. Route to manual review.
Next step

Ready to scan real traffic?

Create an API key, keep it on your server, then wire Mighty into the workflow that handles untrusted material.

AI-Agent Prompt

AI-ready prompt
Implement the right Mighty workflow

Paste this into Cursor, Codex, Claude Code, or Windsurf.

Choose the Mighty workflow for this product and implement it.

First identify the workflow:
- chat app
- public AI output
- file upload
- OCR or IDP
- damage photo review
- invoice or estimate review
- agent tool review
- batch intake
- human review queue

For each workflow:
- Put POST /v1/scan before the first trust boundary.
- Use scan_phase=input for submitted material.
- Use scan_phase=output for generated, extracted, summarized, or tool-created material.
- Choose content_type from text, image, pdf, document, or auto.
- Use mode=secure by default.
- Use mode=comprehensive and async=true for high-value image or PDF review.
- Use focus=both when AI will consume the material or authenticity matters.
- Use data_sensitivity=tolerant when normal business PII is expected.
- Use data_sensitivity=strict for public AI output.
- Store scan_id, request_id, scan_group_id, session_id, action, risk_score, and risk_level.
- Route ALLOW, WARN, BLOCK, indeterminate, pending, and failed.

Acceptance criteria:
- Every workflow has a clear scan point before trust.
- Derived OCR, extraction, model, and tool output scans reuse the correct scan_group_id.
- Review wording says Mighty flagged risk, not that Mighty proved fraud.
- Tests cover ALLOW, WARN, BLOCK, scan failure, and output scanning.