Skip to content

Build CI/CD pipelines

The repository includes two main workflows and one supporting workflow. Both main workflows run the same Fluent API tests but differ in how they handle failures.

Workflow 1: Test Flight Booking Fluent - Kahu

File: test_adk_flight_booking_fluent_kahu.yml

This workflow runs the agent tests and, on failure, creates a GitHub issue and triggers the Kahu SRE Agent for automated root cause analysis.

graph LR
    A[Run Tests] -->|Fail| B[Create Issue]
    B --> C["Comment @kahu investigate"]
    C --> D[Kahu SRE Agent]
    D --> E[Post RCA to Issue]

How it works

  1. Run tests with continue-on-error: true so the workflow continues past failures:

    - name: Run test_adk_flight_booking_fluent.py
      id: test
      continue-on-error: true
      env:
        MONOCLE_EXPORTER: okahu  # Send traces to Okahu Cloud
      run: |
        set -o pipefail
        pytest tests/test_adk_flight_booking_fluent.py -v 2>&1 | tee test_output.txt
    
  2. Create a GitHub issue with the full test output embedded.

  3. Comment @kahu investigate on the issue, including the GitHub run ID and app name:

    - name: Comment @kahu investigate on issue
      run: |
        BODY="@kahu investigate test failure on github_${GITHUB_RUN_ID} for app ${APP}"
        gh issue comment "${ISSUE_NUM}" --body "${BODY}"
    

    This comment triggers the Kahu SRE Agent workflow, which fetches traces from Okahu Cloud, calls the SRE Agent API, and posts the root cause analysis back as a comment.


Workflow 2: Test Flight Booking Fluent - Claude + Okahu Eval

File: test_adk_flight_booking_fluent_auto_pr_claude_okahu_eval.yml

This workflow also runs the tests and creates an issue on failure, but goes further — it assigns Claude as an AI coding agent to investigate, fix the code, and run Okahu evaluations.

graph LR
    A[Run Tests] -->|Fail| B[Create Issue]
    B --> C["Comment /kahu investigate"]
    C --> D[Assign Claude Agent]
    D --> E[Claude Investigates & Fixes]

How it works

  1. Run tests — same as Workflow 1, with traces sent to Okahu Cloud via MONOCLE_EXPORTER: okahu.

  2. Create a GitHub issue with test output.

  3. Comment /kahu investigate with constraints that tell Claude to wait for the Kahu analysis before proceeding:

    - name: Comment /kahu investigate on issue
      run: |
        BODY="/kahu investigate test failure on github_${GITHUB_RUN_ID} for app ${APP}
    
        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."
        gh issue comment "${ISSUE_NUM}" --body "${BODY}"
    
  4. Assign Claude to the issue using the GitHub GraphQL API:

    - name: Assign Claude agent
      run: |
        ISSUE_NODE_ID="$(gh api "repos/.../issues/${ISSUE_NUM}" --jq .node_id)"
        QUERY="mutation { addAssigneesToAssignable(input: {
          assignableId: \"${ISSUE_NODE_ID}\",
          assigneeIds: [\"BOT_kgDODnPHJg\"]
        }) { ... } }"
        gh api graphql -f query="$QUERY"
    

    Once assigned, Claude reads the issue, waits for Kahu's analysis, then investigates the failure using Okahu MCP tools.

Key difference

Kahu workflow Claude + Okahu Eval workflow
Failure response Automated RCA posted as comment Claude investigates, fixes code, runs evals
Agent Kahu SRE Agent (analysis only) Claude Code (analysis + code changes)
Kahu trigger @kahu (direct) /kahu (via Claude, with constraints)
Permissions contents: read contents: write, pull-requests: write

Kahu SRE Agent workflow

File: kahu_sre_agent.yml

This supporting workflow is triggered by @kahu mentions in issue bodies or comments. It is not run directly — it is invoked by the two workflows above.

What it does

  1. Extracts the query from the @kahu comment (e.g., investigate test failure on github_12345 for app my_app)
  2. Resolves trace IDs by calling the Okahu API with the GitHub run ID
  3. Calls the Kahu SRE Agent API with the query and trace context
  4. Posts the analysis back as a comment on the issue
if: |
  github.event.sender.login == github.repository_owner &&
  (
    (github.event_name == 'issues' && contains(github.event.issue.body, '@kahu')) ||
    (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@kahu'))
  )

Owner-only trigger

The workflow only fires when github.event.sender.login == github.repository_owner. This is why you must fork the repository — the workflow won't trigger for non-owners.

Running the workflows

  1. Go to the Actions tab in your forked repository
  2. Select either workflow from the left sidebar
  3. Click Run workflow to trigger it manually

Start with Kahu

Run the Kahu workflow first to see the automated RCA flow. Once you're comfortable with how traces and issues work, try the Claude + Okahu Eval workflow for the full autonomous remediation loop.