Starting a non-interactive session

Non-interactive sessions provide a method to use Bob Shell directly from the command line without entering an interactive session. Use for automation, scripting, and batch processing tasks.

When to use a non-interactive session

Non-interactive sessions work best for:

  • Integrating Bob Shell into automation scripts.
  • Processing multiple files with a single command.
  • Getting quick insights without starting an interactive session.
  • Generating documentation from code.
  • CI/CD pipelines that need structured JSON output.

Starting a non-interactive session

Use the bob run subcommand to run Bob Shell non-interactively from the command line.

Syntax

bob run [options] [prompt...]

You can also pipe a prompt through stdin:

echo "Explain this project" | bob run

Tips for effective use

  • When processing large files or projects, be specific about which files to analyze.
  • Use --format json or --format stream-json for reliable parsing in scripts.
  • Use --max-cost and --max-turns to cap resource use in automated workflows.
  • For multi-line prompts, save them to a file and pipe to bob run:
cat prompt.txt | bob run

Basic usage

Run a prompt directly

bob run "Explain this project"

Pipe content as input

You can pipe text content to Bob Shell:

cat buildError.txt | bob run "Explain this build error"

Save results to a file

Redirect the output to save results:

bob run "Review @bigFile.java" > review.md

Reference project files

Use the @ symbol to reference files in your project:

bob run "Summarize the functionality in @src/main.js"

Set cost and turn limits

bob run --max-cost 0.50 --max-turns 10 "Refactor @app.js"

Session management

Resume a previous session

bob run --resume <task-id> "Continue from where we left off"
bob run --resume latest "Keep going"

General utility flags

Some flags are invoked directly with bob, not with bob run or bob chat. To list saved tasks, run the following command:

bob --list-tasks

The following flags are available:

FlagDescription
--list-tasks [n|all]List saved tasks for the current workspace and exit. Defaults to 20. Pass a number or all to control how many are shown.
--limit <n>Maximum number of tasks to display with --list-tasks.
--show-licenseDisplay the IBM license agreement and exit.

Machine-readable output

When stdout is not a TTY — for example, when you pipe or redirect output — --list-tasks switches from a human-readable table to NDJSON, with one JSON object per line.

Each line has the following shape:

{"id":"<uuid>","title":"<string>","status":"<string>","workspace":"<file-uri>","updatedAt":<unix-ms>}
FieldTypeDescription
idstring (UUID)Unique task identifier, usable with --resume
titlestringTask title, falling back to first message, then id
statusstringTask status (active, completed, paused)
workspacestring (file URI)Absolute workspace path as a file: URI
updatedAtnumberLast-updated timestamp in Unix milliseconds

Examples

# Pipe into jq
bob --list-tasks all | jq '.id'

# Save to file then process
bob --list-tasks 100 > tasks.ndjson

# Display the license agreement
bob --show-license

Output formats

The --format option controls how bob run writes its output. Use this option when capturing output for scripts or CI pipelines.

pretty (default)

Human-readable text output suitable for terminal display.

json

Emits a single JSON object after the session completes. Use this format to capture the full result for programmatic processing.

Schema:

FieldTypeDescription
typestringAlways "result"
timestampstringISO 8601 (date-time standard) completion timestamp
statusstring"success" or "error"
statsobjectSession statistics — see fields below
stats.task_idstringUnique identifier for the completed task
stats.total_tokensnumberTotal tokens used
stats.input_tokensnumberInput tokens used
stats.output_tokensnumberOutput tokens generated
stats.cache_read_tokensnumberTokens read from cache
stats.cache_write_tokensnumberTokens written to cache
stats.cache_rationumberCache hit ratio
stats.duration_msnumberSession duration in milliseconds
stats.session_costsnumberTotal cost for the session
stats.tool_callsnumberNumber of tool calls made
last_messagestringFinal assistant message

Example:

bob run --format json "What is the entry point?" > result.json

stream-json

Emits newline-delimited JSON (NDJSON) — one event object per line — as the session progresses. Use this format to stream output into a pipeline or process events in real time.

Event types:

Event typeKey fieldsDescription
messagerole, content, isReasoning?A user or assistant message
tool_usetool_name, tool_id, parametersA tool call initiated by Bob
tool_resulttool_id, status, output?, error?The result returned by a tool
errorseverity, messageCost/turn limit reached
resultstatus, stats, last_messageFinal summary emitted when the session ends

Pipeline example:

bob run --format stream-json "Audit @src/" \
  | grep '"type":"result"' \
  | jq '.last_message'
Note:

When running non-interactively with bob run, all tools are pre-approved. You are not prompted to approve tool calls during execution.

Options

OptionDescription
--format <format>Output format: pretty (default), json, or stream-json
--mode <mode>Starting mode (for example, agent, plan, ask)
--max-cost <bobcoins>Maximum spend in Bobcoins before the session stops
--max-turns <n>Maximum number of agentic turns before the session stops
--disable-mcpDisable all MCP servers for this session
--disable-subagentsDisable subagent spawning for this session
--disable-tool-groups <groups>Disable specific tool groups (comma-separated, for example execute,mcp)
--workspace <path>Override the workspace root directory
--log-level <level>Log verbosity: error, warn, info, debug, or trace
--resume <task-id>Resume a previous task by task ID
--resume latestResume the most recent task
--team-id <id>Run under a specific team context (required when using an API key of type general)
--trustMark the current folder as trusted
--accept-licenseAccept the IBM license agreement and continue without prompting
How is this topic?