Agentic Workflows
Agentic Workflows
Section titled “Agentic Workflows”Single prompts are good for tasks. Agentic workflows are required for processes.
Core Patterns
Section titled “Core Patterns”1. The Reflection Pattern
Section titled “1. The Reflection Pattern”The agent reviews its own work before showing it to you.
sequenceDiagram
participant User
participant Generator
participant Critic
User->>Generator: "Write a blog post about AI."
Generator->>Critic: "Here is the draft."
Critic->>Generator: "Too generic. Add more examples."
Generator->>Critic: "Here is v2."
Critic-->>User: "Final Draft."
2. The Tool Use Pattern
Section titled “2. The Tool Use Pattern”The agent knows when it doesn’t know, and uses a tool to find out.
- Trigger: “What is the stock price of Apple?”
- Action: Agent pauses, calls
get_stock_price('AAPL'), receives$150. - Response: “Apple is trading at $150.”
3. The Planning Pattern
Section titled “3. The Planning Pattern”Breaking a goal into steps.
- Goal: “Research competitor X and write a summary.”
- Plan:
- Search Google for “Competitor X features”.
- Search Google for “Competitor X pricing”.
- Read top 3 results.
- Synthesize findings.
Enterprise Automation Examples
Section titled “Enterprise Automation Examples”Automated Onboarding
Section titled “Automated Onboarding”- Trigger: New employee added to HR system.
- Workflow:
- Agent A: Generates email account.
- Agent B: Invites to Slack channels based on department.
- Agent C: Schedules welcome meeting with manager.
- Agent D: Sends hardware request to IT.
Code Migration
Section titled “Code Migration”- Trigger: “Migrate this repository from Python 2 to 3.”
- Workflow:
- Scanner Agent: Identifies all files needing change.
- Coder Agent: Rewrites file X.
- Tester Agent: Runs tests. If fail, send back to Coder Agent.
- Manager Agent: Tracks progress and opens PR when 90% tests pass.
Human-in-the-loop
Section titled “Human-in-the-loop”For high-stakes workflows, the agent should pause for approval.
graph TD
A[Agent Drafts Email] --> B{Risk Check}
B -- Low Risk --> C[Send]
B -- High Risk --> D[Human Approval]
D -- Approve --> C
D -- Reject --> A