Repository navigation
@tanstack/ai-openai@0.31.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.