Skip to content

feat(engine): journaled run/resume entry points for graph observability export#1

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/graph-event-journal
Jul 4, 2026
Merged

feat(engine): journaled run/resume entry points for graph observability export#1
senamakel merged 1 commit into
tinyhumansai:mainfrom
senamakel:feat/graph-event-journal

Conversation

@senamakel

Copy link
Copy Markdown
Member

What

New non-breaking engine entry points that capture the tinyagents GraphObservation stream during a run:

  • run_with_checkpointer_journaled(..., journal: Arc<dyn GraphEventJournal>) and resume_with_checkpointer_journaled(...) — thread the journal through build_graphCompiledGraph::with_event_journal(...); existing signatures untouched (resume refactored into a shared inner impl).
  • Because tinyagents mints the run id internally, the journaled variants return JournaledRunOutcome { outcome, graph_run_ids: GraphRunIds { run_id, root_run_id } } so the host can read the journal slice back (run_id is the journal stream key; a resume mints a new run id — documented).
  • Re-exports GraphEventJournal / GraphObservation / InMemoryGraphEventJournal so hosts don't need a direct tinyagents dependency.

Why

Today flows run via run_with_checkpointer, which never attaches a journal/event sink — so no GraphObservations are captured and GraphLangfuseExporter has nothing to export. This unblocks Langfuse graph tracing end-to-end (companion PRs: tinyagents langgraph-metadata patch, openhuman flows-domain export hook, tinyhumansai/backend#1069).

Known follow-up

When a run errors/times out, the engine returns Err without run ids, so failed runs can't be exported (the journal slice is unreadable without the run id). Surfacing ids on the error path needs an error-type change — deliberately out of scope here.

Testing

Full cargo test: 238 passed, 0 failed (new: journaled_run_records_graph_observations asserting node.started/node.completed/run lifecycle under the surfaced run id).

https://claude.ai/code/session_01VSwRwLDBXg3o6timchvKn8

…raph observations

- run_with_checkpointer_journaled / resume_with_checkpointer_journaled
  accept a host-injected GraphEventJournal and wire it into the compiled
  tinyagents graph via with_event_journal, so every graph event is
  recorded as a durable GraphObservation
- JournaledRunOutcome returns the tinyagents-minted run_id/root_run_id
  (GraphRunIds) — the journal's stream key — so the host can read the
  run's observation slice back (journal.read_from(run_id, 0)) and export
  it (e.g. to Langfuse)
- existing entry points unchanged (build_graph/build_and_run thread an
  Option<Arc<dyn GraphEventJournal>>; resume path refactored into a
  shared inner impl)
- re-export GraphEventJournal / GraphObservation /
  InMemoryGraphEventJournal so hosts don't need a direct tinyagents dep
- test: journaled run records node started/completed + run lifecycle
  observations under the surfaced run id

Claude-Session: https://claude.ai/code/session_01VSwRwLDBXg3o6timchvKn8
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 39911172-a19a-474b-83d2-e1aa7982afb5

📥 Commits

Reviewing files that changed from the base of the PR and between 2dcddfd and eab7cf7.

📒 Files selected for processing (1)
  • src/engine.rs

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eab7cf7829

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/engine.rs
/// read the slice back (`journal.read_from(run_id, 0)`) and e.g. export it to
/// Langfuse. [`InMemoryGraphEventJournal`] is a process-local implementation
/// suitable for per-run capture.
pub use tinyagents::{GraphEventJournal, GraphObservation, InMemoryGraphEventJournal};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Bump tinyagents requirement for journal APIs

In workspaces whose Cargo.lock already pins tinyagents to a 1.2.x release, Cargo can keep that version because this crate still declares tinyagents = "1.2", but these newly referenced observability types and the related with_event_journal/GraphExecution run-id fields are only available in the newer tinyagents API. Updating tinyflows in that context fails to compile before any journaled entry point can be used, so the manifest lower bound should be raised to the version that provides these symbols.

Useful? React with 👍 / 👎.

@senamakel senamakel merged commit 438f8fc into tinyhumansai:main Jul 4, 2026
2 checks passed
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