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.

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

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
--list-tasksList available tasks for the workspace and exit
--limit <n>Maximum number of tasks to display with --list-tasks
--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

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"

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.

Session management

List recent tasks

bob run --list-tasks
bob run --list-tasks --limit 20

Resume a previous session

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

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

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
How is this topic?