SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
1.1 KB · 12 lines typescript
Raw Blame History
1// Shell tool, LOCAL environment: the model proposes commands; nothing is executed here. STATUS: LIVE_VERIFIED 2026-09-18 (gpt-5.4-nano).2// Run: node --env-file=.env --experimental-strip-types examples/openai/tools/shell/shell.ts3import OpenAI from "openai";4import { logRequest } from "../../../shared/tool-loop/log.ts";5const client = new OpenAI();6const r: any = await client.responses.create({ model: "gpt-5.4-nano", input: "Propose the shell command `echo OK`. Do not explain.",7  tools: [{ type: "shell", environment: { type: "local" } } as any], tool_choice: { type: "shell" } as any, max_output_tokens: 64, reasoning: { effort: "low" } });8logRequest("openai", "POST", "/v1/responses", 200, 0.0001, "shell.ts local");9const call = r.output.find((i: any) => i.type === "shell_call");10console.log("shell_call:", call.call_id, call.action.commands, "timeout_ms=", call.action.timeout_ms, "environment=", call.environment);11// Continue with: { type: "shell_call_output", call_id: call.call_id, output: [{ stdout: "OK\n", stderr: "", outcome: { type: "exit", exit_code: 0 } }] }12