Batch
There is no SDK batch() helper. Inside an agent turn, the model can group tool
calls with the builtin batch tool (up to 32 invocations, run in dependency
steps with bounded concurrency). When a host workflow has a clear list of
independent, deterministic steps, compose them directly from the session's
deterministic helpers (readFile, grep, glob, ls, git) and
aggregate the results yourself. That keeps the "batch" fully under your control:
no model calls, explicit ordering, and no destructive operations unless you
invoke them.
The example below reads package metadata, the changelog, and the release script,
then reports version mismatches without editing any files. readFile returns the
read tool's output, which prefixes each line with its line number and a tab. A
failed read (for example a missing file) comes back as the tool's error text
rather than a thrown error, so validate what you parse.
Do not mix destructive operations into these grouped reads. The direct helpers
run with host authority: they skip the session's permissionPolicy /
permission_policy and confirmation prompts. Put any destructive host step
(writes, git commits, bash) behind your own application confirmation, or run
it through governedTool / governed_tool / GovernedTool, which executes the
tool without a model but still applies the session's permission and confirmation
gates.
When the steps are not independent — each one depends on the previous result
and you want an agent to drive them — use
session.pipeline(...) instead, which runs
the work in stages where each stage receives the prior stage's output.