Skip to content

feat: add POST /api/sandbox endpoint - #155

Merged
sweetmantech merged 5 commits into
testfrom
sweetmantech/myc-4023-api-create-sandbox-post-sandbox
Jan 23, 2026
Merged

feat: add POST /api/sandbox endpoint#155
sweetmantech merged 5 commits into
testfrom
sweetmantech/myc-4023-api-create-sandbox-post-sandbox

Conversation

@sweetmantech

Copy link
Copy Markdown
Contributor

Summary

  • Add POST /api/sandbox endpoint to create ephemeral sandbox environments
  • Integrate @vercel/sandbox SDK for sandbox creation
  • Return sandboxId, status, timeout, and createdAt in response

Files Added

  • app/api/sandbox/route.ts - Route handler with CORS and JSDoc
  • lib/sandbox/createSandbox.ts - Sandbox creation logic using Vercel SDK
  • lib/sandbox/createSandboxPostHandler.ts - Request handler with API key auth

Test plan

  • Verify API key authentication works
  • Test sandbox creation returns expected response shape
  • Confirm CORS headers are set correctly

🤖 Generated with Claude Code

sidneyswiftand others added 3 commits January 23, 2026 12:44
* feat: add Google Drive and Google Docs to enabled toolkits
- Add googledrive and googledocs to ENABLED_TOOLKITS array
- Enables Tool Router access to Google Drive and Google Docs tools
* docs: update JSDoc to mention all Google integrations
Create ephemeral sandbox environments using Vercel Sandbox SDK.
- Add route handler with CORS and API key authentication
- Add createSandbox function using @vercel/sandbox
- Returns sandboxId, status, timeout, createdAt
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel

vercelBot commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentReviewUpdated (UTC)
recoup-apiReadyReadyPreviewJan 23, 2026 7:57pm

@coderabbitai

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

@github-actions

github-actionsBot commented Jan 23, 2026

Copy link
Copy Markdown

Braintrust eval report

Catalog Opportunity Analysis Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Catalog_availability44% (+28.999999999999996pp)3 🟢1 🔴
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration33.84s (-1.73s)3 🟢2 🔴

Catalog Songs Count Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
AnswerCorrectness19.1% (0pp)1 🟢2 🔴
Factuality33.3% (-67pp)-2 🔴
Llm_calls4 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration12.01s (-3.25s)3 🟢-

First Week Album Sales Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Factuality50% (-5pp)-1 🔴
Llm_calls1 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration13.72s (-1.9s)3 🟢1 🔴

Memory & Storage Tools Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration15.1s (-1.2s)1 🟢-

Monthly Listeners Tracking Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
AnswerSimilarity78.2% (+3pp)4 🟢1 🔴
Llm_calls2 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration12.08s (-0.18s)4 🟢1 🔴

Search Web Tool Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
AnswerCorrectness28% (+1pp)6 🟢5 🔴
Llm_calls3 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration23.42s (-0.95s)3 🟢8 🔴

Social Scraping Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration20.54s (-2.16s)4 🟢2 🔴

Spotify Followers Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
AnswerCorrectness20.5% (0pp)1 🟢4 🔴
Llm_calls3 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration11.2s (-1.71s)3 🟢2 🔴

Spotify Tools Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration33.27s (+7.36s)-2 🔴

TikTok Analytics Questions Evaluation (HEAD-1769198199)

ScoreAverageImprovementsRegressions
Question_answered0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration19.95s (+4.8s)-2 🔴

The Vercel Sandbox SDK includes "snapshotting" as a valid status.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment on lines +12 to +19
* @param request - The request object
* @returns A NextResponse with sandbox data or error
*/
export async function createSandboxPostHandler(request: NextRequest): Promise<NextResponse> {
const accountIdOrError = await getApiKeyAccountId(request);
if (accountIdOrError instanceof NextResponse) {
return accountIdOrError;
}

@vercelvercelBotJan 23, 2026

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.

Handler extracts accountId for authentication but never uses it, making the purpose of the validation unclear and suggesting incomplete implementation

Fix on Vercel

try {
const sandbox = await createSandbox();

return NextResponse.json(sandbox, { status: 200, headers: getCorsHeaders() });

@vercelvercelBotJan 23, 2026

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.

Sandbox POST endpoint returns raw object instead of wrapped object, inconsistent with workspace and artist endpoints

Fix on Vercel

return NextResponse.json(sandbox, { status: 200, headers: getCorsHeaders() });
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to create sandbox";
return NextResponse.json({ error: message }, { status: 400, headers: getCorsHeaders() });

@vercelvercelBotJan 23, 2026

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.

Sandbox error handler returns { error: message } instead of { status: "error", error: message }, inconsistent with workspace and other handlers

Fix on Vercel

DRY - reference types from @vercel/sandbox instead of duplicating.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sweetmantech
sweetmantech merged commit 7b3af1d into testJan 23, 2026
5 checks passed
@sweetmantech
sweetmantech deleted the sweetmantech/myc-4023-api-create-sandbox-post-sandbox branch January 23, 2026 20:13
Sign up for freeto 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.

2 participants

@sweetmantech@sidneyswift