feat(cookbook): add crash-resilient LangGraph financial analyst - #95
Conversation
sdageltc
left a comment
There was a problem hiding this comment.
Hi @wangshen-tech! Thank you so much for putting together this comprehensive LangGraph financial analyst cookbook using yfinance and DeepSeek! 🚀
The cookbook logic and test structure look great. However, this branch was created from an older base commit before our recent v0.5.2 Multi-Framework Adapter Suite release (letitloop/adapters/). As a result, merging directly would cause conflicts and remove existing adapter files.
Could you please rebase your branch against the latest origin/main?
git fetch origin
git checkout feat/issue-82-financial-agent
git rebase origin/main
# If any merge conflicts arise in README.md / CHANGELOG.md, resolve them keeping both the adapters and your new cookbook section
git push --force-with-leaseOnce rebased, we will run the test matrix and merge immediately. Thank you for the awesome contribution!
c3535ef to
2566514
Compare
sdageltc
left a comment
There was a problem hiding this comment.
Thank you @wangshen-tech! Clean rebase against main, and all 13 cookbook tests pass with 100% success. Merging now! 🚀
Description
Adds a real-world LangGraph financial analyst cookbook using yfinance, DeepSeek, and LetItLoop
@durable_asynccheckpoints.Closes #82
Architecture
The compiled async
StateGraphruns four durable nodes:Every node executes through
await async_step(...), so completed JSON-safe outputs are committed to LetItLoop's WAL before the graph advances.Installation and usage
API keys are read only from the environment and are never persisted in WAL or the independent call log.
SIGKILL recovery proof
On POSIX, the demo sends a real
SIGKILLimmediately aftergenerate_investment_memoreturns from its durable step. Windows uses exit 137 because it has no POSIXSIGKILL.At the interruption point, WAL contains exactly:
fetch_market_datacompute_indicatorsgenerate_investment_memogenerate_reportis still absent. A separate fsynced JSONL receipt log audits successful market and LLM calls independently of WAL.Observed live AAPL + DeepSeek demo:
This demonstrates zero re-fetching, zero duplicate LLM calls, and 0% duplicate token consumption for already committed steps. These are the live provider's actual usage fields; offline mode uses deterministic simulated accounting without making a paid request.
The guarantee is intentionally scoped to committed steps. If a process dies after an external provider receives a request but before that result is committed, exactly-once billing requires provider-side idempotency and is not claimed here.
<1msmeasurement scopeThe demo initializes and loads WAL first, then times only these in-memory calls:
The fallback callback raises if any underlying function executes. Python startup, imports, WAL initialization, graph construction, and the unfinished report node are excluded.
Observed locally:
fetch_market_data: 0.006mscompute_indicators: 0.002msgenerate_investment_memo: 0.001msCI uses a relaxed 25ms ceiling to avoid timing flakes while still strictly verifying that the callbacks are not executed.
Coverage
StateGraph.compile()+await graph.ainvoke(...)orchestrator.llm.call_llmVerification
A live AAPL + DeepSeek post-memo SIGKILL demo completed successfully with exit code 0 and 1059 provider-reported tokens before and after recovery. No API key is included in this change.