Skip to content

feat: agent execution observability — run tools, provenance, and lifecycle history#411

Merged
jahvon merged 4 commits into
mainfrom
jdoc/feat-agent-exec-observability
Jul 25, 2026
Merged

feat: agent execution observability — run tools, provenance, and lifecycle history#411
jahvon merged 4 commits into
mainfrom
jdoc/feat-agent-exec-observability

Conversation

@jahvon

@jahvon jahvon commented Jul 25, 2026

Copy link
Copy Markdown
Member

Summary

Makes flow usable as an agent's primary execution engine and turns its history into an observability surface. Three layers:

  • Lifecycle-aware history — every run is recorded at start as running and updated to completed/failed at finish, so in-progress foreground runs are visible from any terminal (not just after they exit). Runs whose process dies are reconciled to failed on next view.
  • Provenance — runs capture where they came from: cli, or mcp with the calling client name (claude, cursor, …) and session ID. flow logs gains --source/--session/--client filters and a lifecycle-aware --status (running/completed/failed, with success/failure aliases). Origin is surfaced in the TUI list (new Origin column), the plain-text list, and detail views.
  • Modernized MCP — new run_command (arbitrary shell command(s), single or serial/parallel batch) and run_executable (transient executable of any type from an inline spec) tools, so agents run everything through flow with workspace env/secrets and a durable, attributable history entry. get_execution_logs exposes the same provenance filters plus mine: true (this session's own runs). The always-loaded tool surface was trimmed ~50% (output schemas pruned to the execution tools; server instructions slimmed) to lower context cost.

All three run tools (execute, run_command, run_executable) stamp provenance via a shared transient path. Per-run workspace scoping never mutates the global current workspace.

Docs

  • AI Tools guide: run tools, the pick-the-closest-tool ladder, and a new Observability section; refreshed Claude Code skill example.
  • Execution History guide: lifecycle status + provenance filtering.
  • integrations.md tool list and llms.txt descriptions updated; generated CLI docs regenerated.

Testing

  • Unit tests for the new filters (source/session/client, lifecycle status, case-insensitivity, AND-combining) and MCP filter pass-through.
  • Live end-to-end: verified the running→completed lifecycle mid-flight, provenance recording, and every filter against seeded runs.
  • flow validate green (generate → lint → unit → e2e → schemas), no generated drift.

Notes

  • Additive only — new omitempty record fields keep legacy history unmarshalling; RecordExecution upserts by run ID.
  • Split cleanly off main; independent of the container-detail work on jdoc/feat-container-exec-view.

🤖 Generated with Claude Code

jahvon and others added 4 commits July 24, 2026 21:59
Make execution history lifecycle- and provenance-aware, and let flow run
ad-hoc/transient commands as first-class, recorded executions.

- ExecutionRecord gains Status (running/completed/failed), CompletedAt,
  PID, Source/ClientName/SessionID, and Command/Label; RecordExecution
  upserts by run ID so a run transitions running -> terminal in place.
- exec writes a "running" record at start and finalizes at completion;
  stale running records (dead PID) are reconciled on read, reusing a
  shared process.Alive helper.
- `flow exec --cmd` runs one or more ad-hoc commands (serial/parallel via
  --mode) as a transient executable; `--spec` runs an inline executable of
  any type. Runs resolve a workspace (--workspace, then the run dir, then
  current) without mutating the global current workspace.
- `flow logs` surfaces status, command/label, and provenance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Add run_command (single or batched shell commands) and run_executable
  (transient executable of any type from an inline spec); both propagate
  the MCP client name and session id as run provenance to the flow
  subprocess so runs are attributable in history.
- Return structuredContent from the data tools and drop the large
  advertised output schemas on the read/list tools, roughly halving the
  always-loaded tool surface (~5.4k -> ~2.7k tokens) with no capability
  loss. Also drop the verb enum from execute/get_executable.
- Trim server instructions to essentials and update the flow-context skill
  to prefer flow's run tools over raw shell.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add --source/--session/--client filters to `flow logs` and make the
status filter lifecycle-aware (running/completed/failed, with
success/failure aliases). Surface run origin in both the TUI list view
(new Origin column) and the plain-text list, alongside the existing
provenance in detail views.

Expose the same through the MCP get_execution_logs tool: source/session/
status params plus a `mine` shortcut that scopes results to the calling
session's own runs. Drop the remaining output schemas from
switch_workspace and sync_executables to keep the tool surface lean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the AI Tools guide with run_command/run_executable and a new
Observability section covering lifecycle-aware history, provenance
(source/client/session), and the get_execution_logs `mine` filter; sync
the Claude Code skill example to the pick-the-closest-tool ladder.

Add source/session/client filtering and lifecycle status to the
Execution History guide, and refresh the llms.txt descriptions so agents
pulling the index know the observability surface exists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jahvon
jahvon merged commit 19e3678 into main Jul 25, 2026
15 checks passed
@jahvon
jahvon deleted the jdoc/feat-agent-exec-observability branch July 25, 2026 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant