Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

5.6 KB
Raw Blame
{
  "headers": {
    "authorization": "<redacted>",
    "chatgpt-account-id": "<redacted>",
    "content-type": "application/json",
    "accept": "text/event-stream",
    "originator": "codex_exec",
    "user-agent": "codex_exec/0.161.0 (variant-probe)",
    "version": "0.161.0"
  },
  "body": {
    "model": "gpt-6.1-sol",
    "stream": true,
    "store": false,
    "tool_choice": "auto",
    "parallel_tool_calls": false,
    "include": ["reasoning.encrypted_content"],
    "reasoning": {
      "effort": "low"
    },
    "text": {
      "verbosity": "low"
    },
    "instructions": "You are a coding agent. Use the exec tool for any file access.",
    "tools": [
      {
        "type": "custom",
        "name": "exec",
        "description": "Run JavaScript code to orchestrate/compose tool calls\n- Evaluates the provided JavaScript code in a fresh V8 isolate as an async module.\n- All nested tools are available on the global `tools` object, for example `await tools.exec_command(...)`. Tool names are exposed as normalized JavaScript identifiers, for example `await tools.mcp__ologs__get_profile(...)`.\n- Nested tool methods take either a string or an object as their input argument.\n- Nested tools return either an object or a string, based on the description.\n- Runs raw JavaScript -- no Node, no file system, no network access, no console.\n- Accepts raw JavaScript source text, not JSON, quoted strings, or markdown code fences.\n- You may optionally start the tool input with a first-line pragma like `// @exec: {\"yield_time_ms\": 10000, \"max_output_tokens\": 1000}`.\n- `yield_time_ms` asks `exec` to yield early if the script is still running. Defaults to 30000 ms.\n- `max_output_tokens` sets the token budget for direct `exec` results. Defaults to 10000 tokens.\n- When the JS code is fully evaluated, the isolate's lifetime ends and unawaited promises are silently discarded.\n\n- Global helpers:\n- `exit()`: Immediately ends the current script successfully (like an early return from the top level).\n- `text(value: string | number | boolean | undefined | null)`: Appends a text item. Non-string values are stringified with `JSON.stringify(...)` when possible.\n- `image(imageUrlOrItem: string | { image_url: string; detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null } | ImageContent, detail?: \"auto\" | \"low\" | \"high\" | \"original\" | null)`: Appends an image item. `image_url` should be a base64-encoded `data:` URL. To forward an MCP tool image, pass an individual `ImageContent` block from `result.content`, for example `image(result.content[0])`. MCP image blocks may request detail with `_meta: { \"codex/imageDetail\": \"original\" }`. When provided, the second `detail` argument overrides any detail embedded in the first argument.\n- `audio(audioUrlOrItem: string | { audio_url: string } | AudioContent)`: Appends an audio item. `audio_url` should be a base64-encoded `data:` URL. To forward an MCP tool audio block, pass an individual `AudioContent` block from `result.content`, for example `audio(result.content[0])`.\n- `generatedImage(result: { image_url: string; output_hint?: string })`: Appends an image-generation result and its optional output hint. HTTP(S) URLs are not supported.\n- `store(key: string, value: any)`: stores a serializable value under a string key for later `exec` calls in the same session.\n- `load(key: string)`: returns the stored value for a string key, or `undefined` if it is missing.\n- `notify(value: string | number | boolean | undefined | null)`: immediately injects an extra `custom_tool_call_output` for the current `exec` call. Values are stringified like `text(...)`.\n- `setTimeout(callback: () => void, delayMs?: number)`: schedules a callback to run later and returns a timeout id. Pending timeouts do not keep `exec` alive by themselves; await an explicit promise if you need to wait for one.\n- `clearTimeout(timeoutId?: number)`: cancels a timeout created by `setTimeout`.\n- `ALL_TOOLS`: metadata for the enabled nested tools as `{ name, description }` entries.\n- `yield_control()`: yields the accumulated output to the model immediately while the script keeps running.\n\nSome deferred nested tools may be omitted from this description. They are still available on the global `tools` object and listed in `ALL_TOOLS`.\nTo find one, filter `ALL_TOOLS` by `name` and `description`.\n\n\n### `exec_command`\nRuns a command.\n\nexec tool declaration:\n```ts\ndeclare const tools: { exec_command(args: {\n  // Shell command to execute.\n  cmd: string;\n}): Promise<{ output: string; exit_code?: number; wall_time_seconds: number }>; };\n```",
        "format": {
          "type": "grammar",
          "syntax": "lark",
          "definition": "\nstart: pragma_source | plain_source\npragma_source: PRAGMA_LINE NEWLINE SOURCE\nplain_source: SOURCE\n\nPRAGMA_LINE: /[ \\t]*\\/\\/ @exec:[^\\r\\n]*/\nNEWLINE: /\\r?\\n/\nSOURCE: /[\\s\\S]+/\n"
        }
      }
    ],
    "input": [
      {
        "type": "message",
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "Read README.md and notes.txt in parallel and report line counts."
          }
        ]
      },
      {
        "type": "custom_tool_call",
        "call_id": "call_probe_1",
        "name": "exec",
        "input": "const r = await Promise.all([tools.exec_command({cmd:\"wc -l README.md\"}), tools.exec_command({cmd:\"wc -l notes.txt\"})]);\nr.forEach((x)=>text(x.output));\n"
      },
      {
        "type": "custom_tool_call_output",
        "call_id": "call_probe_1",
        "output": "Script completed\nWall time 0.2 seconds\nOutput:\n       6 README.md\n       3 notes.txt\n"
      }
    ]
  }
}