.do
Patterns

Agent-Based Patterns

CLI patterns for deploying autonomous agents that perform occupation-based work

Agent-Based CLI Patterns

Agent-based patterns are for deploying autonomous agents that perform occupation-based work. Use these for 24/7 autonomous operation, role-based work, and learning/adaptive systems.

Pattern Structure

Domain:

  • Named agents: {name}.do[/{occupation}]
  • Role agents: {occupation}.do

Semantic Triple: $.{Agent}.performs.{Role}

CLI Command: do agent {command} [options]

Core Concept

Agent-based patterns deploy autonomous workers that can:

  • Operate 24/7 without supervision
  • Learn and adapt over time
  • Perform complex multi-step workflows
  • Make decisions based on context

Key Distinction:

  • Named agents (amy.do, tom.do): Persistent identity, personality, context
  • Role agents (sdr.do, cfo.do): Generic workers, disposable, scalable
graph TB Deploy[Deploy Agent] --> Type{Agent Type?} Type -->|Named| Named[Create Named Agent<br/>amy, tom, cody] Type -->|Role| Role[Create Role Agent<br/>sdr, cfo, engineer] Named --> Identity[Persistent Identity] Role --> Pool[Agent Pool] Identity --> Config[Configure Agent<br/>personality, goals, skills] Pool --> Scale[Scale Pool Size] Config --> Ready[Agent Ready] Scale --> Ready Ready --> Tasks[Receive Tasks] Tasks --> Analyze[Analyze Task] Analyze --> Decide[Make Decision] Decide --> Execute[Execute Actions] Execute --> Learn[Learn from Results] Learn --> Update[Update Context] Update --> Monitor[Monitor Performance] Monitor --> Metrics[Track Metrics<br/>success rate, cost, speed] Metrics --> Feedback[Receive Feedback] Feedback --> Learn

CLI Commands

Deploy Agent

# Deploy named agent
do agent deploy {name} --role {occupation}

# Deploy role agent
do agent deploy --role {occupation} --count {number}

# Deploy with configuration
do agent deploy {name} --role {occupation} --config '{json}'

Manage Agents

# List agents
do agent list

# Get agent details
do agent get {agent-id}

# Update agent
do agent update {agent-id} --config '{json}'

# Delete agent
do agent delete {agent-id}

# Stop agent temporarily
do agent pause {agent-id}

# Resume agent
do agent resume {agent-id}

Assign Tasks

# Assign task to agent
do agent assign {agent-id} {task-type} '{task-data}'

# Assign to role (any available agent)
do agent assign --role {occupation} {task-type} '{task-data}'

# Batch assign tasks
do agent assign-batch --role {occupation} --tasks tasks.json

Named Agents

Named agents have persistent identity and context:

Amy (Sales Development Representative)

# Deploy Amy as SDR
do agent deploy amy --role sdr '{
  "name": "Amy",
  "personality": "professional and friendly",
  "goals": ["qualify leads", "book meetings", "maintain pipeline"],
  "workingHours": "9am-5pm EST",
  "language": "en-US"
}'

# Assign lead qualification
do agent assign amy qualify-lead '{
  "lead": {
    "name": "John Doe",
    "company": "Acme Corp",
    "email": "[email protected]",
    "phone": "+1-555-0123",
    "source": "website-demo-request"
  }
}'

# Schedule meeting
do agent assign amy schedule-meeting '{
  "leadId": "lead-123",
  "duration": 30,
  "availableSlots": [
    "2025-10-28T14:00:00Z",
    "2025-10-28T15:00:00Z",
    "2025-10-29T10:00:00Z"
  ]
}'

# Send follow-up
do agent assign amy send-followup '{
  "leadId": "lead-123",
  "type": "meeting-recap",
  "customMessage": "Thanks for the great conversation!"
}'

# View Amy's activity
do agent activity amy --period today

# View Amy's pipeline
do agent pipeline amy

Tom (Account Executive)

# Deploy Tom as AE
do agent deploy tom --role account-executive '{
  "name": "Tom",
  "personality": "consultative and strategic",
  "goals": ["close deals", "upsell", "maintain relationships"],
  "territory": "enterprise-west",
  "quota": 500000
}'

# Assign deal
do agent assign tom manage-deal '{
  "dealId": "deal-456",
  "account": "Acme Corp",
  "value": 150000,
  "stage": "proposal",
  "priority": "high"
}'

# Create proposal
do agent assign tom create-proposal '{
  "dealId": "deal-456",
  "products": ["enterprise-plan", "premium-support"],
  "customization": "Include integration services",
  "deadline": "2025-11-01"
}'

# Handle objection
do agent assign tom handle-objection '{
  "dealId": "deal-456",
  "objection": "Price is too high",
  "context": "Comparing with competitor"
}'

# View Tom's quota attainment
do agent metrics tom --metric quota-attainment

Cody (Software Engineer)

# Deploy Cody as engineer
do agent deploy cody --role software-engineer '{
  "name": "Cody",
  "personality": "detail-oriented and efficient",
  "skills": ["typescript", "react", "python", "sql"],
  "specialization": "full-stack",
  "workload": "medium"
}'

# Assign bug fix
do agent assign cody fix-bug '{
  "issueId": "issue-789",
  "title": "Login button not working",
  "repository": "github.com/company/app",
  "priority": "high",
  "assignedBy": "user-manager-123"
}'

# Assign feature implementation
do agent assign cody implement-feature '{
  "featureId": "feature-456",
  "title": "Add dark mode toggle",
  "requirements": "docs/features/dark-mode.md",
  "repository": "github.com/company/app",
  "branch": "feature/dark-mode"
}'

# Code review
do agent assign cody review-pr '{
  "prNumber": 123,
  "repository": "github.com/company/app",
  "focus": ["security", "performance", "tests"]
}'

# View Cody's commits
do agent activity cody --type commits --period week

Priya (Project Manager)

# Deploy Priya as PM
do agent deploy priya --role project-manager '{
  "name": "Priya",
  "personality": "organized and proactive",
  "methodology": "agile-scrum",
  "teamSize": 8,
  "projects": ["project-alpha", "project-beta"]
}'

# Assign project planning
do agent assign priya plan-sprint '{
  "projectId": "project-alpha",
  "sprint": 12,
  "duration": 14,
  "teamCapacity": 80,
  "priorities": ["feature-456", "bug-789", "tech-debt-cleanup"]
}'

# Run standup
do agent assign priya run-standup '{
  "projectId": "project-alpha",
  "time": "9:00am",
  "participants": ["cody", "user-dev-2", "user-dev-3"],
  "format": "async-slack"
}'

# Track project status
do agent assign priya track-status '{
  "projectId": "project-alpha",
  "reportTo": ["user-cto", "user-ceo"],
  "frequency": "weekly"
}'

# View Priya's projects
do agent projects priya

Quinn (Quality Assurance)

# Deploy Quinn as QA
do agent deploy quinn --role qa-engineer '{
  "name": "Quinn",
  "personality": "thorough and detail-focused",
  "testing": ["functional", "regression", "performance"],
  "automation": true,
  "tools": ["playwright", "jest", "k6"]
}'

# Assign test suite
do agent assign quinn run-tests '{
  "suite": "regression",
  "target": "staging",
  "parallel": true,
  "screenshot": true
}'

# Create test plan
do agent assign quinn create-test-plan '{
  "featureId": "feature-456",
  "requirements": "docs/features/dark-mode.md",
  "coverage": ["unit", "integration", "e2e"]
}'

# Review test results
do agent assign quinn review-results '{
  "testRunId": "run-123",
  "createBugs": true,
  "notify": ["cody", "priya"]
}'

# View Quinn's test coverage
do agent metrics quinn --metric coverage

Role Agents

Role agents are generic workers assigned to occupations:

SDR Agent

# Deploy SDR agents (scalable pool)
do agent deploy --role sdr --count 5 '{
  "workingHours": "24/7",
  "languages": ["en-US", "es-ES"],
  "maxConcurrentLeads": 10
}'

# Assign lead to any available SDR
do agent assign --role sdr qualify-lead '{
  "lead": {...}
}'

# List SDR agents
do agent list --role sdr

# Scale SDR pool
do agent scale --role sdr --count 10

CFO Agent

# Deploy CFO agent
do agent deploy --role cfo '{
  "responsibilities": [
    "financial-planning",
    "budgeting",
    "reporting",
    "compliance"
  ],
  "reportingPeriod": "monthly"
}'

# Assign financial analysis
do agent assign --role cfo analyze-financials '{
  "period": "2025-Q4",
  "focus": ["revenue", "costs", "cashflow"],
  "format": "executive-summary"
}'

# Generate budget
do agent assign --role cfo create-budget '{
  "year": 2026,
  "departments": ["engineering", "sales", "marketing"],
  "growthTarget": 50
}'

# Monitor cash flow
do agent assign --role cfo monitor-cashflow '{
  "alertThreshold": 100000,
  "frequency": "daily",
  "notify": ["user-ceo"]
}'

Customer Support Agent

# Deploy support agents
do agent deploy --role customer-support --count 3 '{
  "channels": ["email", "chat", "phone"],
  "languages": ["en-US", "es-ES", "fr-FR"],
  "maxConcurrentTickets": 5,
  "escalationRules": {
    "urgent": "human-agent",
    "technical": "engineering",
    "billing": "finance"
  }
}'

# Assign ticket
do agent assign --role customer-support resolve-ticket '{
  "ticketId": "ticket-789",
  "channel": "email",
  "priority": "high",
  "category": "technical"
}'

# View support metrics
do agent metrics --role customer-support --metric response-time

Content Writer Agent

# Deploy content writer
do agent deploy --role content-writer '{
  "style": "professional-conversational",
  "expertise": ["technology", "business", "saas"],
  "seoOptimized": true,
  "plagiarismCheck": true
}'

# Assign article
do agent assign --role content-writer write-article '{
  "topic": "10 Ways to Automate Your Business",
  "length": 2000,
  "keywords": ["automation", "business", "productivity"],
  "tone": "informative",
  "audience": "small-business-owners"
}'

# Create social media posts
do agent assign --role content-writer create-social-posts '{
  "article": "article-123",
  "platforms": ["linkedin", "twitter", "facebook"],
  "variants": 3
}'

Agent Coordination

Team Formation

# Create agent team
do agent team create sales-team '{
  "roles": [
    {"agent": "amy", "role": "sdr"},
    {"agent": "tom", "role": "account-executive"},
    {"agent": "user-sales-manager", "role": "manager"}
  ],
  "territory": "west-region",
  "quota": 1000000
}'

# Assign team goal
do agent team assign sales-team achieve-quota '{
  "target": 1000000,
  "deadline": "2025-12-31",
  "incentives": "commission-plan-2025"
}'

# View team performance
do agent team metrics sales-team

Agent Collaboration

# Assign collaborative task
do agent collaborate '{
  "task": "launch-product",
  "agents": [
    {"agent": "priya", "role": "project-manager"},
    {"agent": "cody", "role": "software-engineer"},
    {"agent": "quinn", "role": "qa-engineer"},
    {"agent": "content-writer-1", "role": "content-writer"},
    {"agent": "amy", "role": "sdr"}
  ],
  "deadline": "2025-11-15"
}'

# Monitor collaboration
do agent collaboration status launch-product

Handoffs

# Configure handoff rules
do agent handoff configure '{
  "from": "sdr",
  "to": "account-executive",
  "trigger": "lead-qualified",
  "context": ["lead-score", "conversation-history", "notes"]
}'

# Manual handoff
do agent handoff amy tom lead-123 '{
  "reason": "qualified",
  "priority": "high",
  "notes": "Very interested in enterprise plan"
}'

Agent Learning

Training

# Train agent on examples
do agent train amy --examples training-data.json

# Fine-tune agent behavior
do agent tune amy --parameter temperature --value 0.7

# Update agent knowledge
do agent knowledge update amy --source company-knowledge-base.md

Feedback

# Provide feedback on agent action
do agent feedback amy action-123 '{
  "rating": 5,
  "comment": "Great job qualifying the lead",
  "improvements": []
}'

# Review agent performance
do agent review amy --period month

# Set performance goals
do agent goals amy '{
  "leadsQualified": 50,
  "meetingsBooked": 20,
  "responseTime": "<2h"
}'

Monitoring & Analytics

Activity Logs

# View agent activity
do agent activity amy --period today

# Filter by action type
do agent activity amy --action send-email --period week

# Export activity log
do agent activity amy --period month --export activity-log.json

Performance Metrics

# View agent metrics
do agent metrics amy

# Specific metric
do agent metrics amy --metric conversion-rate

# Compare agents
do agent compare amy tom --metric meetings-booked

# Generate performance report
do agent report --role sdr --period quarter --output sdr-report.pdf

Cost Tracking

# View agent costs
do agent costs amy --period month

# Budget limits
do agent budget amy --limit 1000 --period month

# Cost optimization
do agent optimize-costs --role sdr --target 20-percent-reduction

Advanced Features

Agent Workflows

# Create workflow for agent
do agent workflow create amy onboard-lead '{
  "steps": [
    {"action": "send-welcome-email"},
    {"action": "schedule-call"},
    {"action": "qualify-needs"},
    {"action": "create-proposal"},
    {"action": "follow-up"}
  ],
  "triggers": ["lead.created"]
}'

# View agent workflows
do agent workflow list amy

# Execute workflow
do agent workflow run amy onboard-lead lead-123

Agent Permissions

# Set agent permissions
do agent permissions amy '{
  "can": [
    "read:leads",
    "create:meetings",
    "send:emails",
    "update:deals"
  ],
  "cannot": [
    "delete:leads",
    "update:pricing"
  ]
}'

# Check permission
do agent permissions check amy update:deals

Agent Scheduling

# Set agent schedule
do agent schedule amy '{
  "workingHours": {
    "monday": "9am-5pm",
    "tuesday": "9am-5pm",
    "wednesday": "9am-5pm",
    "thursday": "9am-5pm",
    "friday": "9am-3pm"
  },
  "timezone": "America/New_York",
  "holidays": ["2025-12-25", "2025-01-01"]
}'

# Set PTO
do agent pto amy --start 2025-12-20 --end 2025-12-27

# View availability
do agent availability amy --period week

SDK Equivalents

Every CLI command maps directly to SDK calls:

# CLI
do agent deploy amy --role sdr
// SDK
const amy = await $.Agent.create({
  name: 'amy',
  role: 'sdr',
})
# CLI
do agent assign amy qualify-lead '{...}'
// SDK
await amy.performs.SDRRole({
  action: 'qualify-lead',
  data: {...}
})

Use Cases

✅ Use Agent-Based Patterns When:

  • Autonomous 24/7 operation needed
  • Role-based work (O*NET occupations)
  • Multi-step workflows
  • Learning/adaptation over time
  • Complex decision-making
  • Human-like interaction
  • Scalable workforce

❌ Don't Use When:

  • One-off actions → Use verb-based patterns
  • Simple data processing → Use noun-based or verb-based patterns
  • Read-only transformations → Use view-based patterns
  • Stateless operations → Use functions

References