Skip to content

Auto-remediation workflow

The Claude + Okahu Eval workflow creates an autonomous remediation loop: tests fail, traces are captured, an AI agent investigates, and findings are posted back to the issue.

The full flow

sequenceDiagram
    participant GHA as GitHub Actions
    participant Test as Pytest + Monocle
    participant GH as GitHub Issues
    participant Kahu as Kahu SRE Agent
    participant Claude as Claude Code

    GHA->>Test: Run agent tests
    Test->>Test: Capture Monocle traces to Okahu Cloud
    Test-->>GHA: Tests fail
    GHA->>GH: Create issue with test output
    GHA->>GH: Comment /kahu investigate
    GHA->>GH: Assign Claude agent
    GH->>Kahu: @kahu triggers SRE Agent workflow
    Kahu->>Kahu: Fetch traces from Okahu API
    Kahu->>Kahu: Call SRE Agent API
    Kahu->>GH: Post root cause analysis
    Claude->>GH: Read issue + Kahu analysis
    Claude->>Claude: Investigate using Okahu MCP tools
    Claude->>GH: Post findings as comment

What the AI agent receives

The auto-created GitHub issue contains:

  1. Test output — the full pytest output showing which assertions failed
  2. Kahu analysis — root cause analysis from the SRE Agent, posted as a comment
  3. Constraints — instructions telling Claude to wait for Kahu's response before proceeding

Okahu MCP tools available to Claude

When Claude investigates the issue, it can use these Okahu MCP tools:

Tool Purpose
okahu/get_traces Fetch traces for the failing run
okahu/get_trace_spans Get detailed span data
okahu/analyze_error_with_ai AI-powered root cause analysis
okahu/get_eval_templates List available evaluation types
okahu/execute_eval_from_okahu Run evaluations on traces
okahu/get_app_error_groups Find recurring error patterns

The Kahu → Claude handoff

The /kahu investigate comment includes constraints that enforce a specific order:

Constraints:
- You must wait for the return response of /kahu before calling other MCPs.
- Then quote the response so the analysis is recognized from /kahu itself.
- Do NOT create a PR.
- Do NOT push commits.
- Only investigate and post findings as an issue comment.

This ensures Claude doesn't start investigating before the SRE Agent has provided its trace-based analysis. Claude builds on Kahu's findings rather than starting from scratch.

Start simple

You don't need the full autonomous loop on day one. Start with the Kahu workflow to see automated root cause analysis. Add the Claude + Okahu Eval workflow when your team is ready for AI-assisted investigation.