Project: SOP-to-Excel Agent
Capstone project one: an agent that reads a Standard Operating Procedure and safely updates Excel workbooks — every discipline from Stages 6–8 in one build.
▶ Watch this reelWhat you'll learn
- Parse the SOP
- Plan the changes
- Execute via Excel MCP
- Verify, approve, roll back
Remember this
- Parse: structured rule extraction with source quotes, validation of targets before planning, exception queue for the ambiguous
- Plan: cell-level diffs with formula-impact analysis and conflict detection, rendered for human approval — preview before power
- Execute: only through the guarded Excel MCP tools, write-then-verify per change, durable checkpoints, per-file audit; rollback drilled monthly; evidence package as the deliverable
Parse
- Structured rule extraction (Pydantic models) · completeness self-check.
- source_quote per rule (review = check the quote).
- Validate targets before planning · exception queue for ambiguous.
Plan
- Cell-level diffs as data · formula-impact analysis · conflict detection.
- Human review doc in consequences (what-not-which) · approval binds token to diff.
- Idempotent skips are successes.
Execute
- Excel MCP tools ONLY mutation path · backup → token write → read-back verify.
- Durable checkpoints per file · per-file audit with backup refs.
Verify & govern
- Sampled re-reads + formula recomputation vs preview.
- Rollback = backup restore, DRILLED monthly (canary).
- Deliverable: evidence package (SOP→rules→approvals→diffs→execution→verification).
Build order: MCP server → extraction recall → plan renderer (owner-approved) → execution → verification drill.
Code: The pipeline, end to end
async def sop_to_excel(sop_text: str, approver: User):
# 1 · PARSE → structured rules (with quotes, validated targets)
rules = await parse_sop(sop_text)
# 2 · PLAN → per-file diffs + formula impact + conflicts
plan = await build_plan(rules)
report = render_review(plan) # human language
token = await human_approve(report, approver) # AG-17 gate
# 3 · EXECUTE via Excel MCP (AG-09 tools only)
for fchange in plan.files: # durable, checkpointed
backup = excel.preview_write(...) # backup + dry-run
excel.write_cells(..., confirm_token=token)
assert read_back(fchange) == fchange.planned # verify
audit.log(file=fchange.name, backup=backup)
# 4 · VERIFY + package
discrepancies = sample_verify(plan)
return evidence_package(rules, plan, audit, discrepancies)