Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions api-reference/v2-openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,18 @@
"application/json": {
"schema": {
"type": "object",
"required": ["code"],
"properties": {
"prompt": {
"type": "string",
"minLength": 1,
"maxLength": 10000,
"description": "Natural language task for the AI agent. Required if `code` is not set."
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 100000,
"description": "Code to execute in the scrape-bound browser sandbox"
"description": "Code to execute in the scrape-bound browser sandbox. Required if `prompt` is not set."
},
"language": {
"type": "string",
Comment on lines 162 to 176
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.

🟡 OpenAPI schema allows requests with neither prompt nor code

The old schema had "required": ["code"], enforcing that code must be provided. The new schema removes this required constraint without adding an equivalent oneOf/anyOf to enforce that at least one of prompt or code is present. The field descriptions state "Required if code is not set" and "Required if prompt is not set", but the schema itself permits a request body with neither field, which would be invalid per the documented intent. Tools and clients that generate code or validation from this OpenAPI spec will not enforce the mutual-requirement constraint.

(Refers to lines 162-192)

Prompt for agents
In api-reference/v2-openapi.json, around line 161-192 in the request body schema for the /scrape/{jobId}/interact endpoint, the old `required: ["code"]` was removed but no replacement constraint was added. The descriptions on `prompt` and `code` say one is required if the other is not set, but the schema doesn't enforce this.

To fix this in OpenAPI 3.0, add a `oneOf` (or `anyOf`) at the schema level that requires at least one of the two fields. For example:

"schema": {
  "type": "object",
  "anyOf": [
    { "required": ["prompt"] },
    { "required": ["code"] }
  ],
  "properties": { ... }
}

This ensures code-generated clients and validators correctly reject requests missing both fields.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Expand All @@ -191,7 +196,7 @@
},
"responses": {
"200": {
"description": "Code executed successfully",
"description": "Interaction executed successfully",
"content": {
"application/json": {
"schema": {
Expand All @@ -200,6 +205,21 @@
"success": {
"type": "boolean"
},
"output": {
"type": "string",
"nullable": true,
"description": "The agent's natural language answer. Only present when using `prompt`."
},
"liveViewUrl": {
"type": "string",
"nullable": true,
"description": "Read-only live view URL for the browser session"
},
"interactiveLiveViewUrl": {
"type": "string",
"nullable": true,
"description": "Interactive live view URL where viewers can control the browser"
},
"stdout": {
"type": "string",
"nullable": true,
Expand All @@ -208,7 +228,7 @@
"result": {
"type": "string",
"nullable": true,
"description": "Standard output (alias for stdout)"
"description": "Raw return value from the sandbox. For `code`: the last expression evaluated. For `prompt`: the raw page snapshot the agent used."
},
"stderr": {
"type": "string",
Expand Down