Agentic Workflow Patterns
Five practical patterns for structuring human-agent collaboration with AgentRQ. Use these as templates — adapt them to your project's needs.
The Approval Gate
The most common pattern. Claude reaches a decision point — a destructive action, a production deployment, a schema change — and needs explicit human sign-off before proceeding. The agent pauses, creates a task, and waits for a reply.
createTask("Approve: drop users table", "I need to drop the legacy users table. All data has been migrated. Approve to proceed?", assignee: "human")
updateTaskStatus(taskId, "ongoing") — marks as waiting for response
updateTaskStatus(taskId, "completed")
Instruct Claude to use this pattern in your CLAUDE.md:
## Approval Gates
Before any of the following actions, create an AgentRQ task
and wait for explicit human approval:
- DROP or TRUNCATE any database table
- DELETE operations affecting more than 10 rows
- Any deployment to production
- Modifying authentication or authorization logic
- Sending emails or notifications to external users
## Approval workflow:
1. createTask() — title: "Approve: [action]", body: full context
2. updateTaskStatus(taskId, "ongoing")
3. Wait for human reply via channel notification
4. If approved: proceed, then updateTaskStatus(taskId, "completed")
5. If rejected: stop, explain why, updateTaskStatus(taskId, "completed")
Human Review of Output
Claude finishes a chunk of work and submits it for human review before moving on. Unlike the approval gate, the work is already done — this is about quality review, not permission. The task is created as completed, and the human's reply drives next steps.
createTask("Review: auth module complete", "Here's what I built...", attachments: [diff])
updateTaskStatus(taskId, "completed") — work is done, awaiting review
ongoing (waiting before acting). In Human Review, the task status is set to completed immediately (work is done, review is async). The difference signals intent to the human reading the dashboard.
Parallel Task Delegation
Claude needs information or decisions from the human on multiple independent fronts. Instead of blocking sequentially on each, it creates multiple tasks at once and continues working on whatever it can while the human resolves them in parallel.
createTask("Provide Stripe API keys for payment integration")
createTask("Confirm DB migration window — when is safe to run?")
// Create both tasks immediately — don't wait for one before creating the other
const task1 = createTask({
title: "Provide Stripe API keys",
body: "I need STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY to wire up payments."
})
const task2 = createTask({
title: "Confirm DB migration window",
body: "Migration adds 2 new tables. Safe to run during business hours? If not, when?"
})
updateTaskStatus(task1.id, "ongoing")
updateTaskStatus(task2.id, "ongoing")
// Now continue with work that doesn't depend on these answers
Status Reporting
For long-running work (multi-hour refactors, bulk migrations, multi-phase builds), Claude creates a single progress-tracking task and posts regular updates as replies. The human can check in at any time without interrupting the agent.
createTask("Refactoring: session started", body: detailed plan of all phases)
reply(taskId, "Phase 1 complete: 12/40 files migrated")
reply(taskId, "Phase 2 starting: working on auth module")
reply(taskId, "All done. 40/40 files migrated, all tests passing.") → updateTaskStatus(taskId, "completed")
Exception Escalation
Claude encounters something unexpected — an inconsistent DB state, ambiguous requirements, a missing credential, a test suite that's completely broken for unknown reasons. Rather than guessing or halting entirely, it escalates to the human with full context.
createTask("BLOCKER: Unexpected schema state", "Found X, expected Y. What do I do?")
updateTaskStatus(taskId, "ongoing") — Claude pauses work on this branch
CLAUDE.md Best Practices
The most reliable way to get consistent human-oversight behavior from Claude is to codify the rules in your project's CLAUDE.md. Claude reads this file at the start of every session. Here's a template that covers all five patterns:
## Human Oversight (via AgentRQ)
Always use AgentRQ MCP tools for human oversight:
- Before any destructive operation (delete, drop, truncate)
- Before touching production systems
- When a decision affects more than one file/module
- When you're uncertain about scope or intent
## Workflow
1. createTask() with title and full context
2. updateTaskStatus("ongoing") immediately
3. Wait for human reply via channel notification
4. Proceed or stop based on their response
5. updateTaskStatus("completed") when resolved
## Task Title Conventions
- "Approve: [action]" → needs sign-off before proceeding
- "Review: [work done]" → finished work, wants feedback
- "BLOCKER: [issue]" → unexpected problem, need guidance
- "FYI: [update]" → status update, no action needed
## Long-Running Work
For tasks taking more than ~15 minutes:
- Create a tracking task at the start with the full plan
- Post reply updates at each phase boundary
- Mark completed when all phases are done