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 Okahu as Okahu Cloud
    participant Kahu as Kahu SRE Agent
    participant GH as GitHub Issues
    participant Claude as Claude Code

    GHA->>Test: Run agent tests
    Test->>Okahu: Send Monocle traces
    Test-->>GHA: Tests fail
    GHA->>Okahu: Resolve trace IDs for this run
    Okahu-->>GHA: Trace IDs
    GHA->>Kahu: Call SRE Agent API with trace IDs
    Kahu-->>GHA: Root cause analysis
    GHA->>GH: Create issue (test output + Kahu analysis embedded)
    GHA->>GH: Assign Claude agent
    Claude->>GH: Read issue with embedded Kahu analysis
    Claude->>Okahu: Investigate using 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, embedded directly in the issue body at creation time

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 workflow calls the Kahu SRE Agent directly (via scripts/kahu_call_agent.py) before creating the issue. The Kahu analysis is embedded in the issue body at creation time by scripts/create_failure_issue.py, so Claude sees the full root cause analysis as soon as it is assigned.

Claude reads the issue, builds on Kahu's trace-based findings, and uses Okahu MCP tools to investigate further — then posts its findings as a comment on the issue.

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.