Skip to content

Add Hosted Agents /v2/agents OpenAPI (full harness surface) - #1233

Open
SSharma-10 wants to merge 13 commits into
mainfrom
ohs-v2-agents-openapi
Open

SSharma-10 wants to merge 13 commits into
mainfrom
ohs-v2-agents-openapi

Conversation

@SSharma-10

Copy link
Copy Markdown
Contributor

Summary

  • Add the full Hosted Agents (OHS) public OpenAPI surface under /v2/agents/*, mirrored from harness-api harness.swagger.json (38 operations).
  • Covers Agent Configs (list/create/get/delete/clone + list sessions by config), Sessions (CRUD-ish lifecycle, HITL, input, pause/resume, sandbox exec, policy validate, sandbox sizes, workspace upload/download/transfers), Checkpoints (+ rollback), Fork, and Templates (+ builds).
  • Replaces the incomplete draft PRs #1207 and #1213 (those can be closed). Branched from current main.

Test plan

  • Path/method parity vs harness.swagger.json: 38/38
  • make bundle succeeds
  • npm run lint -- specification/DigitalOcean-public.v2.yaml → 0 errors
  • Spec CI green on this PR
  • Follow-up: godo / doctl / pydo clientgen after merge

Made with Cursor

SSharma-10 and others added 7 commits September 24, 2026 12:06
Document all 38 OHS public endpoints (configs, sessions, checkpoints, fork, workspace transfers, and templates) for client generation and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Expose a single requestBody media type so Autorest can generate agents_create_session, while documenting YAML/JSON dual forms via description and x-content-schemas to match harness swagger.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread specification/DigitalOcean-public.v2.yaml
Comment thread specification/resources/agents/models/definitions.yml
Comment thread specification/resources/agents/agents_commit_session_workspace_transfer.yml Outdated
Comment thread specification/resources/agents/agents_create_config.yml Outdated
Comment thread specification/resources/agents/models/definitions.yml
anup-deka
anup-deka previously approved these changes Sep 25, 2026

@anup-deka anup-deka left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left few comments

sdharavath added a commit to sdharavath/openapi that referenced this pull request Oct 8, 2026
… OpenAPI

Adds the 15 operations missing from digitalocean#1233 (point 3 of the API Engineering review):

- Triggers Config API (13 ops): CRUD + pause/resume on /v2/agents/triggers, webhook
  secret rotation, execution history + cancel, by-session lookup, reusable-session
  picker, the webhook-providers registry, and the HMAC-authenticated webhook ingress
  endpoint. Mirrored from harness-trigger/contracts/trigger.swagger.json.
- Session event stream: GET /v2/agents/sessions/{session_id}/events (Server-Sent
  Events), mirrored from contracts/mars-dataplane-sse.openapi.yaml. Documents the
  shipping params (replay_only, replay_from, cursor, device_id, Last-Event-ID,
  X-Device-UUID).
- Port-forward: GET /v2/agents/sessions/{session_id}/port-forward/{port}, the
  WebSocket tunnel to a guest TCP port (documented as the 101 upgrade handshake).

The webhook ingress body is modeled as application/octet-stream (binary), not '*/*':
the latter crashes the autorest/modelerfour pre-namer ('Name cannot be empty') that
the pydo client-gen CI runs.

Validation: make lint 0 errors; make bundle ok; autorest --python generate exits 0.
Co-authored-by: Cursor <cursoragent@cursor.com>
@anup-deka

Copy link
Copy Markdown
Contributor

Latest PR - #1255 supersede this one
So it could be closed

SSharma-10 added a commit that referenced this pull request Oct 13, 2026
…rward; supersedes #1233) (#1255)

* Add Hosted Agents /v2/agents OpenAPI surface from harness swagger.

Document all 38 OHS public endpoints (configs, sessions, checkpoints, fork, workspace transfers, and templates) for client generation and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Fix Hosted Agents OpenAPI gaps vs harness swagger.

* Rename Hosted Agents OpenAPI copy to Environment terminology

* Align Harness Runtime OpenAPI tag with product docs

* Make CreateSession/ValidatePolicy codegen-safe for pydo.

Expose a single requestBody media type so Autorest can generate agents_create_session, while documenting YAML/JSON dual forms via description and x-content-schemas to match harness swagger.

Co-authored-by: Cursor <cursoragent@cursor.com>

* emove x-content-schemas refs that break bundled Spectral lint

* Rename Harness Runtime operationIds to harness_* for pydo codegen

* addressed comments

* Fix Hosted Agents scopes and Insights fields

* Update sandbox_size structure (#1237)

* OAR-15627: add triggers, event stream, and port-forward to /v2/agents OpenAPI

Adds the 15 operations missing from #1233 (point 3 of the API Engineering review):

- Triggers Config API (13 ops): CRUD + pause/resume on /v2/agents/triggers, webhook
  secret rotation, execution history + cancel, by-session lookup, reusable-session
  picker, the webhook-providers registry, and the HMAC-authenticated webhook ingress
  endpoint. Mirrored from harness-trigger/contracts/trigger.swagger.json.
- Session event stream: GET /v2/agents/sessions/{session_id}/events (Server-Sent
  Events), mirrored from contracts/mars-dataplane-sse.openapi.yaml. Documents the
  shipping params (replay_only, replay_from, cursor, device_id, Last-Event-ID,
  X-Device-UUID).
- Port-forward: GET /v2/agents/sessions/{session_id}/port-forward/{port}, the
  WebSocket tunnel to a guest TCP port (documented as the 101 upgrade handshake).

The webhook ingress body is modeled as application/octet-stream (binary), not '*/*':
the latter crashes the autorest/modelerfour pre-namer ('Name cannot be empty') that
the pydo client-gen CI runs.

Validation: make lint 0 errors; make bundle ok; autorest --python generate exits 0.
Co-authored-by: Cursor <cursoragent@cursor.com>

* OAR-15627: use shared DO error model {id,message,request_id} for all /v2/agents errors

Anup Deka (API Eng) asked for the standard envelope; cthulhu#179553 (merged) makes
harness-api emit it and the Oceanus edge already returns it. Point the agents error
schema at shared/models/error.yml so all 128 error responses across the 53 ops use
{id, message, request_id} instead of the old nested {error:{code,message}}, removing
the split where only 401/404/429/500 used the standard shape.

make lint 0 errors; make bundle ok (old nested shape gone); autorest --python exits 0.

Co-authored-by: Cursor <cursoragent@cursor.com>

* OAR-15627: address API review of #1255 (findings 1-9)

- #1: events-stream errors are text/plain (OHP, not JSON) for 404/429/500/503;
  drop the 400; keep 401 JSON (edge). OHP moves to JSON under MARSOHS-2065.
- #2: add 402 to the 16 billing-gated operations (cthulhu#179578).
- #3: add GET /v2/agents/sessions/{id}/ingress (publicly routed; replaces the
  port-forward bridge for browser clients).
- #4: trigger create/update return 422 (trigger limit) and 503 (upstream check);
  webhook ingress returns 400 (body too large/unreadable).
- #5: add stream.state to the stream_event type enum + a stream_state schema.
- #6: trigger reads return 404 not 403 for another team's trigger; create can
  return 403 (config permission denied).
- #7: correct the port-forward description (ingress replaced it for browsers;
  paused sessions are woken and served) and document the handshake 400.
- #8: webhook body lists concrete content types (json/form/octet-stream).
- #9: drop the ignored Content-Type response header on the events 200.

Deferred (cosmetic): renaming the 53 Go-method summaries to DO reference style.

make lint 0 errors; make bundle ok; autorest --python exits 0.

Co-authored-by: Cursor <cursoragent@cursor.com>

* OAR-15627: document events-stream errors as the DO-standard JSON envelope

Matches OHP after cthulhu#179797 (MARSOHS-2065): OHP routes its refusals through
common/httpapi.WriteError + httpapi.RequestID and emits {id, message, request_id}
on 404/429/500/503 (the 401 is the edge). GATED ON #179797's DEPLOY: until it is
rolled out to the OHP instance behind api.digitalocean.com the live stream still
returns text/plain, so #1255 must merge only after #179797 is deployed.

make lint 0 errors; make bundle ok.

Co-authored-by: Cursor <cursoragent@cursor.com>

* OAR-15627: address minor review follow-ups

- create and update trigger document 502 (config service error); update also
  documents 403 (config permission denied) - both via writeConfigErr's default
  and PermissionDenied branches (handlers.go:1244/1248).
- webhook ingress application/json body is type: object (additionalProperties:
  true) so real JSON deliveries validate under a contract check; form and
  octet-stream stay strings.

make lint 0 errors; make bundle ok; autorest --python exits 0.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Make trigger webhook body codegen-safe for Autorest

---------

Co-authored-by: SSharma-10 <shivanisharma@digitalocean.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Damanpreet Singh <damanpreetsingh@digitalocean.com>
Co-authored-by: anup-deka <adeka@digitalocean.com>

This branch has not been deployed

No deployments
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.

4 participants