Skip to content

CLI Reference

petalflow supports workflow validation, compilation, execution, daemon hosting, and tool registry management.

Terminal window
go install github.com/petal-labs/petalflow/cmd/petalflow@latest
petalflow --version
FlagDescription
--verboseEnable verbose/debug logging
--quietSuppress non-error output
--no-colorDisable colored output

run

Execute a workflow file (agent or graph).

compile

Compile Agent/Task workflow into Graph IR JSON.

validate

Validate workflow schema and graph integrity.

serve

Start daemon APIs for workflows, tools, schedules, and events.

tools

Register/configure/test tools in SQLite registry.
Terminal window
petalflow run <file> [flags]
FlagDescription
--input, -iInline JSON input object
--input-file, -fRead input JSON/YAML from file
--output, -oWrite output envelope to file
--formatjson, text, or pretty (default: pretty)
--timeoutRun timeout (default: 5m)
--dry-runValidate + compile only, do not execute
--envSet env var (KEY=VALUE, repeatable)
--provider-keyProvider credential (name=key, repeatable)
--store-pathSQLite path for tool registry
--streamStream node.output.delta content
Terminal window
petalflow run workflow.yaml --input '{"topic":"release notes"}'
petalflow run workflow.yaml --input-file input.json --format json
petalflow run workflow.yaml --dry-run
petalflow run workflow.yaml --provider-key anthropic=sk-ant-...
petalflow run workflow.yaml --store-path /tmp/petalflow.db
Terminal window
petalflow compile <agent-workflow-file> [flags]
FlagDescription
--output, -oOutput path (stdout if omitted)
--prettyPretty JSON output (default: true)
--validate-onlyValidate Agent/Task schema without emitting Graph IR
  • compile only accepts Agent/Task workflows.
  • Returns exit code 6 (WrongSchema) if input is Graph IR.
Terminal window
petalflow validate <file> [flags]
FlagDescription
--formattext or json
--strictTreat warnings as failures

Validation supports both Agent/Task and Graph IR workflows.

Terminal window
petalflow serve [flags]
FlagDefaultDescription
--host0.0.0.0Listen host
--port, -p8080Listen port
--cors-origin*Allowed CORS origin
--sqlite-path~/.petalflow/petalflow.dbSQLite database path
--configauto-discoverTool startup config (petalflow.yaml)
--provider-key-Provider key (name=key, repeatable)
--tls-cert / --tls-key-TLS cert/key files
--read-timeout30sHTTP read timeout
--write-timeout60sHTTP write timeout
--max-body1048576Max request bytes
--workflow-schedule-poll5sSchedule polling interval
MethodPath
GET/health
GET/api/node-types
POST/api/workflows/agent
POST/api/workflows/graph
GET/api/workflows
GET/api/workflows/{id}
PUT/api/workflows/{id}
DELETE/api/workflows/{id}
POST/api/workflows/{id}/run
ANY/api/workflows/{id}/webhooks/{trigger_id}
GET/api/workflows/{id}/schedules
POST/api/workflows/{id}/schedules
GET/api/workflows/{id}/schedules/{schedule_id}
PUT/api/workflows/{id}/schedules/{schedule_id}
DELETE/api/workflows/{id}/schedules/{schedule_id}
GET/api/runs/{run_id}/events
MethodPath
POST/api/tools
GET/api/tools
GET/api/tools/{name}
PUT/api/tools/{name}
DELETE/api/tools/{name}
PUT/api/tools/{name}/config
POST/api/tools/{name}/test
GET/api/tools/{name}/health
POST/api/tools/{name}/refresh
PUT/api/tools/{name}/overlay
PUT/api/tools/{name}/disable
PUT/api/tools/{name}/enable
Terminal window
petalflow tools <subcommand> [flags]

Persistent flag:

  • --store-path: SQLite path (default: ~/.petalflow/petalflow.db)
SubcommandPurpose
register <name>Register tool (native, http, stdio, mcp)
listList built-in + registered tools
inspect <name>Show manifest/registration details
unregister <name>Remove registration
config <name>Set/show config and secrets
test <name> <action>Invoke tool action with test input
refresh <name>Re-discover MCP actions
overlay <name> --set <path>Set/clear MCP overlay
health [name] / --allRun MCP health checks
Terminal window
petalflow tools list
petalflow tools inspect template_render --actions
petalflow tools register echo_http --type http --manifest ./echo_http.tool.json
petalflow tools config echo_http --set region=us-west-2
petalflow tools config echo_http --set-secret api_key=sk-...
petalflow tools test echo_http echo --input value=hello
petalflow tools refresh s3_fetch
petalflow tools overlay s3_fetch --set ./s3_fetch.overlay.yaml
petalflow tools health --all
CodeMeaning
0Success
1Validation failure
2Runtime failure
3File not found
4Input parse error
5Provider resolution/auth error
6Wrong workflow schema for command
10Timeout
VariablePurpose
PETALFLOW_SQLITE_PATHDefault SQLite path for run/tools/serve
PETALFLOW_TOOLS_STORE_PATHBackward-compatible store path fallback
PETALFLOW_CONFIGOptional config path override

Provider credentials can be passed via --provider-key or resolved from environment/config.