Repository navigation
@tanstack/openai-base@0.16.0
Minor Changes
-
#1837
824ee98- Add computer use that runs the same code on OpenAI and on Anthropic. A driver controls the machine. The Playwright and sandbox drivers give each thread its own machine.New packages:
@tanstack/ai-computer-useaddscreateComputerUse(). It returnstools, a middleware, a safety-check interrupt, andclose. EachthreadIdgets its own machine, action queue, and approvals. A thread that stays idle foridleTimeout(10 minutes by default) closes.@tanstack/ai-computer-playwrightaddsplaywrightComputer(), which opens one browser page for each thread.createPlaywrightComputerDriver()controls one page that you give it. Both add anavigatetool that openshttp:andhttps:URLs.@tanstack/ai-computer-sandboxaddssandboxComputer(), which creates one Linux desktop sandbox for each thread from any@tanstack/ai-sandboxprovider, likee2bSandbox({ template: 'desktop' }).createSandboxComputerDriver()controls one sandbox that you give it.@tanstack/ai-computer-localaddslocalComputer(), which lets the model use the mouse, keyboard, and main screen of the machine that runschat(). It works on Windows, macOS, and Linux with@jitsi/robotjs.
Changes in existing packages:
@tanstack/aiaddsthreadIdtoToolExecutionContext. It also adds the computer tool metadata reader in@tanstack/ai/adapter-internals.@tanstack/ai-anthropicand@tanstack/openai-basesend the generic computer tool to the model as the native computer tool of the provider.@tanstack/ai-openaimarks the models that support thecomputertool.
const computerUse = createComputerUse({ driver: playwrightComputer({ startUrl: 'https://tanstack.com' }), }) chat({ adapter, messages, threadId, tools: computerUse.tools, middleware: [computerUse.middleware], interrupts: [computerUse.interrupt], }) await computerUse.close(threadId) // one thread await computerUse.close() // every thread, and the browser
The
ai-coreagent skill routes computer use to@tanstack/ai-computer-useand its three drivers. -
#1837
824ee98-computerUseTool({ type: 'computer' })adds the computer tool of the newer OpenAI models, for examplegpt-6.1-sol. The tool name iscomputer. Each call has the batchedactionsof the model and thepending_safety_checks, and the replay sends the actions back as they came.computerUseTool({ type: 'computer_use_preview', ... })for thecomputer-use-previewmodel works as before. The Responses tool choice type also acceptscomputer. Computer screenshots now go out withdetail: 'original', as in OpenAI's computer use guide.
Patch Changes
-
#1837
824ee98- The computer use loop ofcomputerUseTool()runs. Acomputer_callfrom the model is now a tool call tocomputer_use_preview, with theactionand thepending_safety_checksas its input. The tool result goes back ascomputer_call_output, with the first image of the result as the screenshot. When the call does not fail, the output acknowledges the safety checks of the call.A failed computer call sends the newest screenshot of the conversation, because the failed call has no screenshot of its own. A computer call output has no text, so the reason for the failure goes to the model in a user message after the call outputs.
A computer tool result with no image fails the run with an error. Before, the adapter sent an empty screenshot.
-
Updated dependencies [
824ee98]:- @tanstack/ai@0.71.0