feat(engine): journaled run/resume entry points for graph observability export#1
Conversation
…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
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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. Comment |
There was a problem hiding this comment.
💡 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".
| /// 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}; |
There was a problem hiding this comment.
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 👍 / 👎.
What
New non-breaking engine entry points that capture the tinyagents
GraphObservationstream during a run:run_with_checkpointer_journaled(..., journal: Arc<dyn GraphEventJournal>)andresume_with_checkpointer_journaled(...)— thread the journal throughbuild_graph→CompiledGraph::with_event_journal(...); existing signatures untouched (resume refactored into a shared inner impl).JournaledRunOutcome { outcome, graph_run_ids: GraphRunIds { run_id, root_run_id } }so the host can read the journal slice back (run_idis the journal stream key; a resume mints a new run id — documented).GraphEventJournal/GraphObservation/InMemoryGraphEventJournalso hosts don't need a direct tinyagents dependency.Why
Today flows run via
run_with_checkpointer, which never attaches a journal/event sink — so noGraphObservations are captured andGraphLangfuseExporterhas 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
Errwithout 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_observationsasserting node.started/node.completed/run lifecycle under the surfaced run id).https://claude.ai/code/session_01VSwRwLDBXg3o6timchvKn8