zag-agent 0.14.2

Core library for zag — a unified interface for AI coding agents
Documentation
# zag pipe

Chain results from completed sessions into a new agent session.

## Synopsis

    zag pipe [options] <session_ids>... -- <prompt>
    zag pipe --tag <TAG> -- <prompt>

## Description

Collects the final results from one or more completed sessions and feeds them as context into a new agent session along with a user-provided prompt. This is the primary primitive for building DAG-like workflows where one session's output feeds into the next.

Results are wrapped in `<session-result>` XML tags with session ID prefixes so the receiving agent can distinguish between sources.

## Arguments

    session_ids    One or more session IDs to collect results from
    prompt         The prompt to send with the collected context (after --)

## Flags

    --tag <TAG>              Collect results from all sessions with this tag
    -p, --provider <NAME>    Provider for the new session
    -m, --model <NAME>       Model for the new session
    -o, --output <FORMAT>    Output format (text, json, json-pretty)
    --json                   Request JSON output from the agent
    -a, --auto-approve       Skip permission prompts
    -s, --system-prompt      Custom system prompt
    --add-dir <PATH>         Additional directories (repeatable)
    --file <PATH>            Attach a file to the prompt (repeatable)
    --env <KEY=VALUE>        Environment variable for subprocess (repeatable)
    --mcp-config <CONFIG>    MCP server config: JSON string or path to a JSON file (Claude only)
    --size <SIZE>            Ollama model size
    --max-turns <N>          Maximum agentic turns
    -r, --root <PATH>        Root directory
    -q, --quiet              Suppress logging
    --name <NAME>            Name for the new pipe session (for discovery)
    --description <TEXT>     Short description of the new pipe session
    --timeout <DURATION>     Timeout (e.g., 30s, 5m, 1h); kills the agent if exceeded
    -w, --worktree [<NAME>]  Create a git worktree for the new pipe session
    --sandbox [<NAME>]       Run the new pipe session inside a Docker sandbox
    --context <SESSION_ID>   Prepend another session's last result as context

## Examples

    # Pipe one session's result into a new one
    sid=$(zag spawn "analyze auth module")
    zag wait $sid
    zag pipe $sid -- "summarize the analysis"

    # Pipe multiple sessions
    zag pipe $sid1 $sid2 $sid3 -- "synthesize these analyses"

    # Pipe by tag
    zag pipe --tag batch -- "create a unified report"

    # With explicit provider/model
    zag pipe --tag batch -p claude -m opus -- "synthesize findings"

    # Name the follow-up session and bound it with a timeout
    zag pipe "$sid" --name followup --timeout 5m -- "summarize"

    # Run the follow-up in a worktree, prepending context from another session
    zag pipe "$sid" --worktree --context "$other_sid" -- "apply the plan"

## See Also

    zag man collect    Gather raw results without re-processing
    zag man spawn      Launch background sessions
    zag man exec       Non-interactive single prompt