Skip to main content

Using RPI Agents Together

This guide walks through a complete RPI workflow, showing how the four custom agents work together to transform a complex task into validated code.

The Complete Workflow

┌─────────────────┐   Handoff    ┌─────────────────┐   Handoff    ┌─────────────────┐   Handoff    ┌─────────────────┐
│ Task Researcher │ ──────────→ │ Task Planner │ ──────────→ │ Task Implementor│ ──────────→ │ Task Reviewer │
│ │ 📋 Create │ │ ⚡ Implement │ │ ✅ Review │ │
│ Uncertainty │ Plan │ Knowledge │ │ Strategy │ │ Working Code │
│ ↓ │ │ ↓ │ │ ↓ │ │ ↓ │
│ Knowledge │ │ Strategy │ │ Working Code │ │ Validated Code │
└─────────────────┘ └─────────────────┘ └─────────────────┘ └─────────────────┘
↓ ↓ ↓ ↓
research.md plan.md + details.md code + changes.md review.md + findings
↑ ↑
└────────────────────────────────┴──────────────── 🔬 Research More / 📋 Revise Plan ────────────────────────┘

Critical Rule: Clear Context

🔴 Use /clear or start a new chat between EVERY phase.

Why this matters:

  • Each agent has different instructions and behaviors
  • Accumulated context causes confusion and errors
  • Research findings are in files, not chat history
  • Clean context lets each agent work optimally

For the deeper explanation of how LLM context affects agent behavior, see Context Engineering.

Walkthrough: Adding Azure Blob Storage

Let's walk through adding Azure Blob Storage to a Python data pipeline.

Phase 1: Research

  1. Use /task-research with your topic to start research (this automatically selects Task Researcher):
/task-research Azure Blob Storage integration for Python data pipeline
  1. Provide additional context in your message:
I need to add Azure Blob Storage integration to our Python data pipeline.
The pipeline currently writes to local disk in src/pipeline/writers/.

Research:
- Azure SDK for Python blob storage options
- Authentication approaches (managed identity vs connection string)
- Streaming uploads for files > 1GB
- Error handling and retry patterns

Focus on approaches that match our existing patterns in the codebase.
  1. Wait for completion (20-60 minutes). Task Researcher will:

    • Search your codebase for existing patterns
    • Research Azure SDK documentation
    • Evaluate authentication options
    • Create a research document with recommendations
  2. Review the output:

## 🔬 Task Researcher: Azure Blob Storage Integration

✅ Research document created at:
.copilot-tracking/research/2025-01-28-blob-storage-research.md

Key findings:
- Recommended: azure-storage-blob SDK with async streaming
- Authentication: Managed identity for production, connection string for dev
- Existing pattern: WriterBase class in src/pipeline/writers/base.py

Phase 2: Plan

  1. Clear context: /clear

  2. Use /task-plan with the research file open (this automatically selects Task Planner):

    /task-plan
  3. Provide additional planning guidance:

    /task-plan
    Focus on:
    - The streaming upload approach recommended in the research
    - Phased rollout: storage client first, then writer class, then integration
    - Include error handling and retry logic
  4. Review the output. Task Planner creates two files:

    .copilot-tracking/plans/2025-01-28-blob-storage-plan.instructions.md
    .copilot-tracking/details/2025-01-28-blob-storage-details.md
  5. Verify the plan structure:

### [ ] Phase 1: Storage Client Setup
* [ ] Task 1.1: Create BlobStorageClient class
* [ ] Task 1.2: Add configuration schema

### [ ] Phase 2: Writer Implementation
* [ ] Task 2.1: Create BlobWriter extending WriterBase
* [ ] Task 2.2: Implement streaming upload

### [ ] Phase 3: Integration
* [ ] Task 3.1: Update pipeline factory
* [ ] Task 3.2: Add integration tests

Phase 3: Implement

  1. Clear context: /clear

  2. Use /task-implement to start implementation (automatically switches to Task Implementor):

    /task-implement

    Or use the generated prompt for a specific plan:

    /implement-blob-storage
  3. Review at each phase. After Phase 1 completes:

Phase 1 complete. Changes:
- Added: src/storage/blob_client.py
- Modified: src/config/schema.py

Ready for review. Continue to Phase 2?

Check the code, run linters, then continue.

  1. Final output:

When all phases complete:

Implementation complete!

Changes log: .copilot-tracking/changes/2025-01-28-blob-storage-changes.md

Files created (3):
- src/storage/blob_client.py
- src/pipeline/writers/blob_writer.py
- tests/integration/test_blob_writer.py

Files modified (2):
- src/config/schema.py
- src/pipeline/factory.py

Ready for review.

Phase 4: Review

  1. Clear context: /clear

  2. Use /task-review to validate the implementation (automatically switches to Task Reviewer):

    /task-review
  3. Task Reviewer validates against specifications:

    • Locates research, plan, and changes artifacts
    • Extracts implementation checklist from source documents
    • Validates each item with evidence from the codebase
    • Runs validation commands (lint, build, test)
  4. Review the findings:

## ✅ Task Reviewer: Blob Storage Integration

| 📊 Summary | |
|-----------------------|-------------------------------------------------------------|
| **Review Log** | .copilot-tracking/reviews/2025-01-28-blob-storage-review.md |
| **Overall Status** | Complete |
| **Critical Findings** | 0 |
| **Major Findings** | 0 |
| **Minor Findings** | 2 |
| **Follow-Up Items** | 1 |

Minor findings:
- Missing docstring on BlobStorageClient.upload_stream()
- Consider adding retry count to configuration schema

Follow-up item:
- Add performance benchmarks for large file uploads (deferred from research)

Ready for commit.
  1. Address findings and commit:

    • Fix Minor findings if desired (optional for commit)
    • Address Critical and Major findings before committing
    • Note Follow-Up items for future RPI cycles

Artifact Summary

After completing RPI, you have:

ArtifactLocationPurpose
Research.copilot-tracking/research/Evidence and recommendations
Plan.copilot-tracking/plans/Checkboxes and phases
Details.copilot-tracking/details/Task specifications
Changes.copilot-tracking/changes/Change log
Review.copilot-tracking/reviews/Validation findings
CodeYour source directoriesWorking implementation

Common Patterns

Iterating on Research

If implementation reveals missing research:

  1. Note the gap in your current session
  2. Clear context
  3. Return to Task Researcher
  4. Research the specific gap
  5. Update plan if needed
  6. Continue implementation

Handling Complex Tasks

For very large tasks:

  1. Break into multiple RPI cycles
  2. Each cycle handles one component
  3. Use research from previous cycles
  4. Build incrementally

Team Handoffs

RPI artifacts support handoffs:

  • Research doc explains decisions
  • Plan shows remaining work
  • Changes log shows what's done
  • Review log shows validation status

Iteration Loops

The Review phase can trigger iteration back to earlier phases when findings reveal gaps.

Iteration Paths

Review StatusActionTarget Phase
CompleteCommit changesDone
Needs ReworkFix implementation issuesImplement
Research GapInvestigate missing contextResearch
Plan GapAdd missing scopePlan

Rework Flow

When Task Reviewer identifies Critical or Major findings:

  1. Clear context: /clear
  2. Open the review log in your editor
  3. Use /task-implement to address findings
  4. Task Implementor uses the review log to guide fixes
  5. Return to review: /task-review

Escalation Flow

When Task Reviewer identifies research or planning gaps:

  1. Clear context: /clear
  2. Open the review log in your editor
  3. Choose the appropriate phase:
    • /task-research for missing technical context
    • /task-plan for scope additions
  4. Complete the phase and continue through the workflow

Quick Reference

PhaseInvoke WithAgentOutput
Research/task-research <topic>Task Researcherresearch.md
Plan/task-plan [research-path]Task Plannerplan.md, details.md
Implement/task-implementTask Implementorcode + changes.md
Review/task-review [scope]Task Reviewerreview.md

TIP

/task-research, /task-plan, /task-implement, and /task-review all automatically switch to the appropriate custom agent.

Remember: Always /clear between phases!

Handoff Buttons

RPI agents include handoff buttons that streamline transitions between workflow phases. When an agent completes its work, handoff buttons appear in the chat interface.

Available Handoffs

From AgentHandoff ButtonTarget AgentAction
Task Researcher📋 Create PlanTask PlannerStarts planning with research
Task Planner⚡ ImplementTask ImplementorExecutes the plan
Task Implementor✅ ReviewTask ReviewerReviews implementation
Task Reviewer🔬 Research MoreTask ResearcherResearches identified gaps
Task Reviewer📋 Revise PlanTask PlannerUpdates plan based on findings

Using Handoff Buttons

  1. Complete work in current agent
  2. Click the handoff button in the chat interface
  3. The target agent activates with the appropriate prompt pre-filled
  4. Conversation context carries over automatically

When to Use Manual Transitions

Use /clear and manual /task-* commands instead of handoffs when:

  • You need to reset conversation context completely
  • You want to provide custom parameters to the next agent
  • The handoff button doesn't match your intended workflow

TIP

Use /compact when you want to reduce conversation length without losing all context. Unlike /clear, /compact summarizes the conversation history rather than removing it. This is useful mid-phase when context grows long but you want to continue the current task.

RPI Agent: When Simplicity Fits

For tasks that don't require strict phase separation, rpi-agent provides autonomous execution with subagent delegation. Use it when the scope is clear and you don't need the deep iterative research that comes from constraint-based separation.

Quick Decision Guide

Choose Strict RPI when...Choose rpi-agent when...
Deep research is criticalScope is clear and straightforward
Multi-file pattern discoveryMinimal external research needed
Team handoff neededQuick iteration during development
Compliance or security workExploratory or prototype work

Escalation Path

You don't have to decide upfront. Start with rpi-agent for speed, and if the task reveals hidden complexity, it can hand off to Task Researcher. This hybrid approach gives you speed for simple tasks and the verified truth that comes from constraint-based research when you need it.

TIP

For the full explanation of why constraints change AI behavior, see Why the RPI Workflow Works.

See Agents Reference for rpi-agent implementation details.


🤖 Crafted with precision by ✨Copilot following brilliant human instruction, then carefully refined by our team of discerning human reviewers.