Sessions & State
Pipelines
Execute multiple commands in a single HTTP round-trip
Pipelines#
Pipelines let agents execute multiple commands in a single HTTP round-trip. Steps run sequentially, and each step can reference previous results using $prev or named aliases with as.
json
// Agent sends a pipeline requestPOST /surf/pipeline{ "steps": [ { "command": "search", "params": { "query": "laptop" }, "as": "searchResults" }, { "command": "cart.add", "params": { "sku": "$prev.results[0].sku" } }, { "command": "checkout" } ], "sessionId": "sess_abc123", "continueOnError": false}ย // Response{ "ok": true, "results": [ { "command": "search", "ok": true, "result": { "results": [...] } }, { "command": "cart.add", "ok": true, "result": { "added": "LAPTOP-01" } }, { "command": "checkout", "ok": true, "result": { "orderId": "ORD-789" } } ]}Set continueOnError: true to continue executing subsequent steps even if one fails. By default, the pipeline stops on the first error.