Skip to content

docs: add curl/REST API respond-to-comment example workflow#28

Closed
captainsafia wants to merge 1 commit into
mainfrom
oz-agent/respond-to-comment-rest-api-example
Closed

docs: add curl/REST API respond-to-comment example workflow#28
captainsafia wants to merge 1 commit into
mainfrom
oz-agent/respond-to-comment-rest-api-example

Conversation

@captainsafia

Copy link
Copy Markdown
Collaborator

Summary

Adds a self-contained example GitHub Actions workflow,
examples/respond-to-comment-rest-api.yml, that triggers whenever a comment
mentioning @oz-agent is posted on a PR. Unlike the existing
respond-to-comment.yml, this example does not use the
warpdotdev/oz-agent-action action — it talks to the Oz REST API directly with
curl and spawns a cloud agent run, mirroring the prompting pattern of the
existing workflow.

What it does

  1. Reacts to the triggering comment with the eyes emoji (acknowledgement).
  2. Builds a prompt from the PR + comment context via actions/github-script,
    reusing the same Context/Instructions structure as respond-to-comment.yml.
  3. Starts a cloud agent run with curl (POST /agent/runs) and captures the
    run_id. The prompt and config are assembled with jq (--rawfile / --arg)
    to avoid shell/JSON injection from comment bodies.
  4. Resolves the session link via GET /agent/runs/{run_id} (with light polling).
  5. Replies on the PR with a link to the live Oz session.
  6. Posts a comment back into the triggered Oz session via
    POST /agent/runs/{run_id}/followups when necessary, to relay extra GitHub
    context (e.g. the exact comment URL to reply to).
  7. Reports errors back on the comment on failure.

Setup notes (documented in the workflow header + README)

  • Repository secret WARP_API_KEY.
  • Repository variable WARP_ENVIRONMENT_ID pointing at an Oz environment that has
    the repo checked out and gh authenticated, so the cloud agent can push changes
    and reply on GitHub.
  • Optional WARP_API_BASE (defaults to https://app.warp.dev/api/v1) and
    WARP_AGENT_MODEL.

The new example is intentionally not registered in scripts/build-workflows.mjs
since that generator wraps the action; running npm run gen-workflows leaves the
generated .github/workflows/ and consumer-workflows/ directories unchanged.
README documents the new example alongside the existing scenarios.

Testing

  • node YAML parse of the new workflow (parses, 7 steps).
  • npm run gen-workflows runs cleanly and produces no changes to generated dirs.
  • npx prettier --check passes on the new workflow and README.

Conversation: https://staging.warp.dev/conversation/053b43d7-6e7c-4a2e-bcde-c0d4498779ef
Run: https://oz.staging.warp.dev/runs/019ef6e7-bb9c-7860-82f2-83b7dcfe1e6f

This PR was generated with Oz.

Add a self-contained example workflow that triggers when a PR comment
mentions @oz-agent. Instead of using the oz-agent-action, it uses curl
against the Oz REST API to spawn a cloud agent run, mirroring the
prompting pattern of respond-to-comment.yml.

The workflow reacts to the comment with an emoji, starts the run via
POST /agent/runs, resolves the shared session via GET /agent/runs/{id},
replies on the PR with the session link, and posts a follow-up back into
the triggered Oz session via POST /agent/runs/{id}/followups when needed.

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant