Skip to content

Tutorial: Deep Review

In this tutorial, you'll build a script that runs a multi-pass deep code review on a directory of your choice. When the script finishes, you'll have a consolidated report covering security findings, code quality issues, and test gaps — each ordered by severity and tied to specific file paths and line numbers.

What you are building

A short Python script that invokes DeepReviewAgentSDKWorkflow against a real codebase path and prints the consolidated review report. By the last step, you'll understand how the orchestrator coordinates three specialized subagents and why the result arrives as a single structured document rather than three separate outputs.

Prerequisites

  • Python 3.10 or newer
  • The attune package installed in your environment
  • A local directory you want to review (any Python project works)

Step 1 — Import the workflow class

The DeepReviewAgentSDKWorkflow class lives in the workflows.deep_review module. Import it directly — no intermediate package needed.

from workflows.deep_review import DeepReviewAgentSDKWorkflow

Verify: Run python -c "from workflows.deep_review import DeepReviewAgentSDKWorkflow; print('ok')" in your terminal. You should see ok with no import errors.


Step 2 — Create a workflow instance

Instantiate the class with no arguments. The constructor sets up the three specialized subagents — security-reviewer, quality-reviewer, and test-gap-reviewer — that will each analyze the codebase independently.

workflow = DeepReviewAgentSDKWorkflow()

Verify: print(type(workflow)) should output <class 'workflows.deep_review.DeepReviewAgentSDKWorkflow'>.


Step 3 — Run the review against a path

Call execute with the path keyword argument pointing at the directory you want to review. This is where the orchestration happens: the three subagents run their focused passes, then their findings are synthesized into one report.

result = workflow.execute(path="./my_project")

The path you supply can be a directory or a single file. Use a real path on your machine so the output is meaningful.

Verify: result should be a WorkflowResult. Print it — you should see sections titled Summary, Security, Quality, Test Gaps, and Suggestions.


Step 4 — Read the consolidated report

The report structure is predictable because the orchestrator always produces the same five sections. Print each section to confirm the subagents ran and contributed findings.

print(result)

Look for the Summary section first — it contains an overall code health score (0–100) and a count of findings by severity. If the score is present, all three subagents completed successfully.

Verify: You see a numeric score in the Summary and at least one finding under Security, Quality, or Test Gaps.


Putting it together

Here is the complete script you've built step by step:

from workflows.deep_review import DeepReviewAgentSDKWorkflow

workflow = DeepReviewAgentSDKWorkflow()
result = workflow.execute(path="./my_project")
print(result)

Run it. You should have a full multi-pass review report in your terminal within a few moments.


What you learned

  • Step 1 — The correct import path for DeepReviewAgentSDKWorkflow is from workflows.deep_review import DeepReviewAgentSDKWorkflow.
  • Step 2 — Instantiating the class wires up three independent subagents: security-reviewer, quality-reviewer, and test-gap-reviewer.
  • Step 3execute(path="...") is the single entry point; it accepts a directory or file path and coordinates all three subagents before returning.
  • Step 4 — The returned WorkflowResult always contains the same five sections (Summary, Security, Quality, Test Gaps, Suggestions), so you can parse or display them reliably.

Next steps

Use inspect.signature(DeepReviewAgentSDKWorkflow.execute) to see every parameter execute accepts, and read src/attune/workflows/deep_review.py directly to understand the severity scale used in findings and how to call deep_review from an MCP tool context instead of directly from Python.

Unresolved references

Auto-generated by attune-author fact-check. Review and either fix the source code, fix this doc, or add an override.

Location Severity Issue
Line 28 (code fence) error from workflows.deep_review import … — module not importable
Line 101 error [Deep Review tool reference](references/tool-deep-review.md) — target does not exist
Line 41 (python fence) error Name "DeepReviewAgentSDKWorkflow" is not defined [name-defined]
Line 53 (python fence) error Name "workflow" is not defined [name-defined]
Line 67 (python fence) error Name "result" is not defined [name-defined]