API Reference
Complete reference for all Tauri IPC commands and events. These are the functions the React frontend calls to interact with the Rust backend.
Info
invoke("command_name", { args }) function from the frontend. Events are listened to via listen("event-name", callback).Agent Management
list_agents(projectPath: string)→AgentInfo[]Lists all .md agent files in .claude/agents/ with auto-extracted descriptions.
read_agent(path: string)→{ name: string, path: string, content: string }Reads the full Markdown content of an agent file.
write_agent(path: string, content: string)→voidOverwrites an agent file with new content.
create_agent(projectPath: string, name: string, content: string)→string (file path)Creates a new agent .md file. Returns the full path.
delete_agent(path: string)→voidDeletes an agent file from the filesystem.
Pipeline Management
list_pipelines(projectPath: string)→PipelineInfo[]Lists all .pipeline.json files in .claude/pipelines/.
read_pipeline(path: string)→PipelineReads and parses a pipeline JSON file.
write_pipeline(projectPath: string, pipeline: Pipeline)→string (file path)Saves a pipeline to disk. Also auto-generates agent markdown from pipeline nodes.
delete_pipeline(projectPath: string, path: string)→voidDeletes a pipeline JSON file.
rename_pipeline(projectPath: string, oldPath: string, newName: string)→string (new path)Renames a pipeline file.
generate_pipeline(prompt: string, cliPath: string, projectPath: string)→PipelineUses Claude CLI to generate a pipeline from a natural language description.
Execution
start_run(pipeline: Pipeline, inputs: Record<string, string>, claudeCliPath: string, projectPath: string)→string (run ID)Starts executing a pipeline. Returns run ID immediately; execution continues async.
cancel_run((none))→voidCancels the currently active run. Sends SIGTERM to active processes.
respond_to_approval(approved: boolean)→voidResponds to a pending approval gate. true = continue, false = fail the node.
get_run_state((none))→RunState | nullReturns the current run state or null if no run is active.
resume_run(originalRunId: string, pipeline: Pipeline, inputs: Record<string, string>, claudeCliPath: string, projectPath: string)→string (new run ID)Resumes a failed run from the point of failure, reusing successful steps.
Run History & Analytics
list_run_history(limit?: number)→RunRow[]Lists past runs ordered by start time descending.
get_run_details(runId: string)→[RunRow, RunStepRow[]]Returns the run record and all its step records.
get_cost_summary((none))→{ totalCost: number, runs: CostRun[] }Total cost and per-run cost breakdown.
get_usage_stats((none))→UsageStatsComprehensive analytics: totals, averages, top nodes, top pipelines.
get_avg_ai_cost((none))→number | nullAverage cost per AI task execution.
Project Management
scan_project(projectPath: string)→ProjectInfoScans a directory for .claude/ existence, agent count, and pipeline count.
init_project(projectPath: string)→voidCreates .claude/agents/ and .claude/pipelines/ directories.
detect_project_from_cwd((none))→string | nullWalks parent directories looking for .claude/. Returns the project root or null.
get_recent_projects((none))→RecentProjectsReturns the list of recently opened projects.
add_recent_project(projectPath: string)→voidAdds a project to the recent list.
remove_recent_project(projectPath: string)→voidRemoves a project from the recent list.
Settings
get_settings((none))→AppSettingsReturns the current app settings.
save_settings(settings: AppSettings)→voidPersists settings to the JSON file.
detect_claude_cli((none))→string | nullAuto-detects the Claude CLI path. Returns the path or null.
detect_claude_cli_detailed((none))→{ path: string, version: string, source: string }Detailed detection with version info and the source where it was found.
File Watching
start_watching(projectPath: string)→voidStarts watching .claude/agents/ and .claude/pipelines/ for changes.
stop_watching((none))→voidStops the file watcher.
Error Logging
get_error_log(limit?: number)→LogInfo { path, sizeBits, entries[] }Returns recent error log entries.
get_full_log((none))→stringReturns the full log file content.
get_log_path((none))→stringReturns the absolute path to the log file.
clear_error_log((none))→voidClears the error log.
Events
The Rust backend emits these events to the frontend via Tauri's event system:
run-updateEmitted on every status change during pipeline execution.
RunState { runId, status, nodeStates, totalCost }node-logEmitted for each line of stdout/stderr from an executing node.
{ runId: string, nodeId: string, line: string }approval-requestedEmitted when execution reaches an approval gate, pausing for human input.
{ runId: string, nodeId: string, name: string }file-changedEmitted when the file watcher detects changes in .claude/ directories. Debounced at 500ms.
{ kind: "Modify" | "Create" | "Remove", paths: string[] }Database Schema
AgentFlow uses SQLite (via SQLx) stored at ~/.cache/com.agentflow.app/agentflow.db
CREATE TABLE runs (
id TEXT PRIMARY KEY, -- "run-{timestamp_ms}"
pipeline_name TEXT NOT NULL,
started_at TEXT NOT NULL, -- ISO 8601 UTC
finished_at TEXT, -- NULL until completion
status TEXT NOT NULL DEFAULT 'running',
trigger_input TEXT, -- JSON string
resumed_from TEXT, -- Original run ID
failed_node_id TEXT,
pipeline_hash TEXT -- SHA256 of instructions
);CREATE TABLE run_steps (
id INTEGER PRIMARY KEY AUTOINCREMENT,
run_id TEXT NOT NULL,
node_id TEXT NOT NULL,
node_name TEXT,
started_at TEXT,
finished_at TEXT,
status TEXT NOT NULL DEFAULT 'pending',
exit_code INTEGER,
log_output TEXT, -- Full captured output
attempt INTEGER DEFAULT 1,
cost_usd REAL, -- NULL for non-AI nodes
model TEXT,
approval_state TEXT, -- "approved" | "rejected"
instructions_hash TEXT, -- SHA256 for resume
FOREIGN KEY (run_id) REFERENCES runs(id)
);