Skip to content

Conversation

@wintonzheng
Copy link
Contributor

@wintonzheng wintonzheng commented Nov 12, 2025

Update API specifications by running fern api update.


📋 This PR updates the API specifications by adding a new prompt improvement endpoint and browser profile support. The changes introduce a /v1/prompts/improve endpoint that allows users to enhance prompts based on specific use-cases, along with corresponding request/response schemas and browser profile configuration options.

🔍 Detailed Analysis

Key Changes

  • New Prompt Improvement Endpoint: Added /v1/prompts/improve POST endpoint with use-case query parameter and API key authentication
  • Schema Definitions: Introduced ImprovePromptRequest and ImprovePromptResponse schemas for the new endpoint functionality
  • Browser Profile Support: Added browser_profile_id field to enable reusing browser profiles for task runs
  • API Documentation: Updated OpenAPI specification with comprehensive parameter descriptions and validation rules

Technical Implementation

sequenceDiagram
    participant Client
    participant API
    participant PromptService
    
    Client->>API: POST /v1/prompts/improve
    Note over Client,API: Headers: x-api-key<br/>Query: use-case<br/>Body: ImprovePromptRequest
    API->>PromptService: Process improvement request
    PromptService->>API: Return improved prompt
    API->>Client: ImprovePromptResponse
    Note over API,Client: Contains original, improved,<br/>and optional error fields
Loading

Impact

  • Enhanced User Experience: Users can now programmatically improve their prompts with context-aware suggestions
  • Browser Profile Reuse: Improved efficiency by allowing browser profile reuse across task runs
  • API Consistency: Maintains existing authentication patterns and error handling standards
  • Developer Integration: Clear schema definitions facilitate easier client SDK generation and integration

Created with Palmier


Important

Add new /v1/prompts/improve endpoint and related schemas to skyvern_openapi.json.

  • API Changes:
    • Add new endpoint /v1/prompts/improve with POST method in skyvern_openapi.json.
    • Endpoint handles prompt improvement based on a use-case, requiring use-case query parameter and optional x-api-key header.
  • Request/Response Schemas:
    • Add ImprovePromptRequest schema with context and prompt properties.
    • Add ImprovePromptResponse schema with error, improved, and original properties.
  • Schema Updates:
    • Add browser_profile_id property to an existing schema in skyvern_openapi.json.

This description was created by Ellipsis for 967d793. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • New Features
    • Introduced prompt improvement endpoint enabling users to refine prompts with optional context support
    • Extended login flow to support browser profile selection during authentication

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

A new OpenAPI endpoint /v1/prompts/improve (POST) is introduced for prompt improvement with associated ImprovePromptRequest and ImprovePromptResponse schemas. LoginRequest is extended with an optional browser_profile_id field to enable browser profile correlation during login.

Changes

Cohort / File(s) Summary
OpenAPI Schema Updates
fern/openapi/skyvern_openapi.json
Added new endpoint /v1/prompts/improve (POST) under Prompts tag with required use-case query parameter, optional x-api-key header, and request/response schemas. Introduced ImprovePromptRequest (prompt + optional context) and ImprovePromptResponse (improved prompt, original prompt, optional error) schemas. Extended LoginRequest with optional browser_profile_id field. Mirror updates applied to YAML/OpenAPI definitions for consistency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify new endpoint path /v1/prompts/improve follows naming conventions
  • Confirm ImprovePromptRequest and ImprovePromptResponse schema structure and required fields are correct
  • Validate browser_profile_id field type and optionality in LoginRequest
  • Check consistency of schema definitions across JSON and YAML representations
  • Ensure response codes (200, 422) are properly documented

Possibly related PRs

Suggested labels

sync

Suggested reviewers

  • suchintan

Poem

🐰 A new endpoint hops into view,
Prompts improved through and through,
Browser profiles now aligned,
Schema changes, carefully designed,
The API grows with grace and might!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and generic, using the non-descriptive phrase 'fern api update' without conveying what actual API changes were made. Replace with a specific title describing the main changes, such as 'Add prompt improvement endpoint and browser profile support' to clearly indicate the primary changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-openapi-spec-2025-11-12T00-31-55-268Z

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 967d793 in 2 minutes and 4 seconds. Click for details.
  • Reviewed 169 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. fern/openapi/skyvern_openapi.json:2677
  • Draft comment:
    Consider using an OpenAPI security scheme for API key authentication rather than defining 'x-api-key' as a header parameter.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50% This is a code quality suggestion about OpenAPI best practices. The comment is technically correct - OpenAPI does support security schemes that can be defined once and reused across endpoints. However, I need to consider: 1) Is this obvious or unimportant? 2) Does it require seeing other parts of the codebase to validate? 3) Is it actionable? Looking at the diff, I can only see this one endpoint being added. I cannot see if other endpoints in the file use the same pattern or if there's already a security scheme defined elsewhere in the OpenAPI spec. Without seeing the full file or other endpoints, I cannot determine if this is consistent with the existing pattern or if it's actually an issue. The rules state "Ignore cross-file issues. Only think about the file you are reviewing" and "If you are not sure, or if understanding the comment requires more context (such as seeing other files or parts of the codebase), you should delete the comment." I might be missing that this is a standalone improvement that doesn't require context - it's a valid OpenAPI best practice regardless of what else exists in the file. The suggestion is actionable and clear, which the rules say is good for code quality refactors. While it's a valid best practice, I cannot verify from the diff alone whether this pattern is consistent with the rest of the API specification. If other endpoints use the same inline header parameter pattern, changing just this one would be inconsistent. The comment requires understanding the broader context of the OpenAPI spec to determine if it's the right change, which violates the "requires more context" rule. Delete this comment. While it's technically a valid OpenAPI best practice, determining whether to apply it requires seeing the rest of the OpenAPI specification to understand if there's already a security scheme defined or if other endpoints follow the same pattern. Without this context, I cannot verify if the suggestion is appropriate.
2. fern/openapi/skyvern_openapi.json:2675
  • Draft comment:
    Redundant description for the 'use-case' query parameter; consider consolidating the description to avoid duplication.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. fern/openapi/skyvern_openapi.json:8970
  • Draft comment:
    Consider adding a maxLength constraint to the 'prompt' field in ImprovePromptRequest to avoid excessively long input.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. fern/openapi/skyvern_openapi.json:9747
  • Draft comment:
    If 'browser_profile_id' is expected to follow a specific format (e.g., a UUID), consider adding a pattern validation.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_uK76THUU0Vo0WSEL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
fern/openapi/skyvern_openapi.json (3)

8970-8996: Strengthen request schema with examples.

Add examples to ImprovePromptRequest to improve docs and SDK hints.

       "ImprovePromptRequest": {
         "properties": {
           "context": {
             "anyOf": [ { "type": "string" }, { "type": "null" } ],
             "title": "Context",
-            "description": "Additional context about the user's needs"
+            "description": "Additional context about the user's needs",
+            "examples": ["Audience: CFOs at mid-market SaaS; Tone: concise"]
           },
           "prompt": {
             "type": "string",
             "minLength": 1,
             "title": "Prompt",
-            "description": "The original prompt to improve"
+            "description": "The original prompt to improve",
+            "examples": ["Draft an outreach email requesting a product demo."]
           }
         },

8998-9028: Clarify success vs. failure shape; avoid "error" in 200 payload.

Returning an "error" field in a 200 response blurs semantics and complicates clients. Prefer 4xx for failures (422 already defined). If you keep an error field, make success/failure mutually exclusive with oneOf.

Simplest: drop "error" from the 200 schema:

       "ImprovePromptResponse": {
         "properties": {
-          "error": {
-            "anyOf": [ { "type": "string" }, { "type": "null" } ],
-            "title": "Error",
-            "description": "Error message if prompt improvement failed"
-          },
           "improved": {
             "type": "string",
             "title": "Improved",
             "description": "The improved version of the prompt"
           },
           "original": {
             "type": "string",
             "title": "Original",
             "description": "The original prompt provided for improvement"
           }
         },
         "type": "object",
         "required": [
           "improved",
           "original"
         ],

2677-2749: Standardize query param naming and add Fern SDK method identifier.

Query parameter use-case is the only hyphenated param in the API; all others use snake_case (e.g., folder_id). Additionally, 23 other endpoints include x-fern-sdk-method-name for stable SDK method naming—this endpoint is missing it.

Apply this diff:

   "/v1/prompts/improve": {
     "post": {
       "tags": [
         "Prompts"
       ],
       "summary": "Improve prompt",
       "description": "Improve a prompt based on a specific use-case",
       "operationId": "improve_prompt_v1_prompts_improve_post",
       "parameters": [
         {
-          "name": "use-case",
+          "name": "use_case",
           "in": "query",
           "required": true,
           "schema": {
             "type": "string",
-            "description": "The use-case for prompt improvement",
-            "title": "Use-Case"
+            "description": "The use case for prompt improvement",
+            "title": "Use Case"
           },
-          "description": "The use-case for prompt improvement"
+          "description": "The use case for prompt improvement"
         },
         {
           "name": "x-api-key",
           "in": "header",
           "required": false,
           "schema": {
             "anyOf": [
               { "type": "string" },
               { "type": "null" }
             ],
             "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
             "title": "X-Api-Key"
           },
           "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
         }
       ],
       "requestBody": {
         "required": true,
         "content": {
           "application/json": {
             "schema": { "$ref": "#/components/schemas/ImprovePromptRequest" }
           }
         }
       },
       "responses": {
         "200": {
           "description": "Successful Response",
           "content": {
             "application/json": {
               "schema": { "$ref": "#/components/schemas/ImprovePromptResponse" }
             }
           }
         },
         "422": {
           "description": "Validation Error",
           "content": {
             "application/json": {
               "schema": { "$ref": "#/components/schemas/HTTPValidationError" }
             }
           }
         }
       },
+      "x-fern-sdk-method-name": "improve_prompt"
     }
   },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1688f07 and 967d793.

📒 Files selected for processing (1)
  • fern/openapi/skyvern_openapi.json (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run tests and pre-commit hooks
🔇 Additional comments (1)
fern/openapi/skyvern_openapi.json (1)

9750-9761: Verify the precedence rules with backend implementation and product specification.

The review comment's suggestions for documentation consistency are valid based on codebase patterns:

  • Examples are inconsistent: browser_session_id includes examples ("examples": ["pbs_123456"]) at line 9735, but browser_profile_id at line 9750 omits them, while other ID fields in the schema include them.
  • Prefix information is missing: Other occurrences of browser_profile_id in the schema (lines 1799, 1805) document that it "starts with bp_", but the field at line 9750 lacks this detail.
  • Field coexistence confirmed: All three fields (browser_session_id, browser_profile_id, browser_address) coexist in the same request schema (lines 9735–9762), validating the question about their interaction.

However, the proposed precedence rule ("profile takes precedence and a new session may be created from it") cannot be verified from the OpenAPI schema alone. This requires confirmation against the backend implementation and product specification to ensure accuracy before documenting it as a rule.

@marcmuon marcmuon closed this Nov 26, 2025
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.

3 participants