MCPcopy Create free account
hub / github.com/vercel/examples / resume_run

Function resume_run

python/vibe-coding-ide/backend/src/api/agent.py:107–129  ·  view source on GitHub ↗
(run_id: str, token: str, result: str)

Source from the content-addressed store, hash-verified

105
106@router.get("/{run_id}/resume")
107async def resume_run(run_id: str, token: str, result: str):
108 oidc_token = await get_vercel_oidc_token()
109 token_payload = read_stream_token(token)
110 if token_payload.get("run_id") != run_id:
111 raise HTTPException(status_code=400, detail="Token does not match run id")
112 base = await get_run_payload(run_id)
113 if base is None:
114
115 async def missing_generator() -> AsyncGenerator[str, None]:
116 yield sse_format(
117 emit_event(run_id, "run_failed", error="Unknown or expired run id")
118 )
119
120 return StreamingResponse(missing_generator(), headers=SSE_HEADERS)
121
122 async def event_generator() -> AsyncGenerator[str, None]:
123 try:
124 async for chunk in resume_agent_flow(base, run_id, result, oidc_token=oidc_token):
125 yield chunk
126 except Exception as e:
127 yield sse_format(emit_event(run_id, "run_failed", error=str(e)))
128
129 return StreamingResponse(event_generator(), headers=SSE_HEADERS)

Callers

nothing calls this directly

Calls 5

read_stream_tokenFunction · 0.90
get_run_payloadFunction · 0.90
missing_generatorFunction · 0.85
event_generatorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected