Skip to content

fix: bound video agent phases and enforce native output budgets - #29

Merged
devhims merged 1 commit into
mainfrom
fix/agent-phase-deadlines
Sep 8, 2026
Merged

fix: bound video agent phases and enforce native output budgets#29
devhims merged 1 commit into
mainfrom
fix/agent-phase-deadlines

Conversation

@devhims

@devhims devhims commented Sep 8, 2026

Copy link
Copy Markdown
Owner

The video agent now gives classification, research and finalisation separate persisted deadlines, rejects tasks outside supported YouTube synthesis, and uses native structured output and SDK token ceilings for final answers. Compact transcript notes and concise answer guidance reduce generation work while retaining source references and caveats.

Changes

  • Bound classification to 20 seconds, research to 40 seconds and finalisation to 40 seconds. Recovery reuses persisted deadlines, and the watchdog respects the active phase. Queueing and the separate 30-second persistence window remain outside these model budgets.
  • Let classification reject unsupported tasks, select storyboard access and choose standard or detailed answer budgets. Preserve legacy route compatibility and expose rejected outcomes in the API contract.
  • Compact transcript analyst output to five findings and up to three warnings with a 1,200-token ceiling. Keep full-transcript reading and exact excerpt resolution; generate the compatibility summary in the application.
  • Use native JSON-schema output for reserved finalisation, with citation requirements visible in the schema. Repair invalid structure, references or token-limit termination once within the existing deadline.
  • Apply AI SDK maxOutputTokens of 1,500 for standard answers and 2,500 for detailed answers across answer-capable research generations, reserved finalisation and terminal-tool argument repair. Remove redundant final-answer length/schema instructions.
  • Add regression coverage and update OpenAPI and architecture documentation. Keep experiment reports, benchmark fixtures, source snapshots and response captures local and ignored by Git.

Validation

  • TypeScript, generated OpenAPI, and Mintlify build/link/accessibility checks passed.
  • 132 focused unit tests across six files and 16 AgentRuntimeDO integration tests passed.
  • Offline replay of the recovered original Workers AI response confirms the provider adapter and AI SDK preserve its content exactly.
  • No full local test suite or new live inference run during PR preparation. Experiment artifacts remain local and are excluded from this PR.

Remaining limitations and deployment

Native token limits and schema validation do not guarantee that every answer fulfills the requested scope or finishes before its deadline. Detailed-report timeouts and schema-valid incomplete answers remain unresolved. The recovered upstream response rules out client-side truncation for the investigated failure, but model generation versus provider serving remains unresolved.

Requested-count enforcement and inference reliability remain follow-up work. An alternative model provider is explicitly deferred.

The latest SDK-budget changes have not been manually deployed. Cloudflare's connected build pipeline watches main, so merging this PR will trigger verification and production deployment. This PR does not claim that every request completes successfully within 100 seconds.

@mintlify

mintlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
video2ctx 🟢 Ready View Preview Sep 8, 2026, 2:16 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
video2ctx-web Ready Ready Preview Sep 8, 2026 2:23pm UTC

@devhims
devhims force-pushed the fix/agent-phase-deadlines branch from e959ced to b93b25e Compare September 8, 2026 14:23
@devhims
devhims merged commit 68e0bc7 into main Sep 8, 2026
7 checks passed
@devhims
devhims deleted the fix/agent-phase-deadlines branch September 8, 2026 14:27
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.

1 participant