feat: add LangGraph integration helper (v0.2.6)#13
Merged
Conversation
Adds shekel.integrations.langgraph.budgeted_graph() — a convenience context manager wrapping shekel.budget() for LangGraph workflows. Existing OpenAI/Anthropic patches cover cost tracking automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
- Add budgeted_graph() to api-reference.md with full signature and examples - Add shekel[langgraph] extra to installation.md (section, dep table, troubleshooting) - Fix install command in langgraph.md and langgraph_demo.py to use shekel[langgraph] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mypy 1.19.1 follows imports into _pytest/terminal.py which uses match syntax (Python 3.10+), causing a hard [syntax] error when python_version = "3.9". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mypy 1.19.1 traverses into _pytest/terminal.py (site-packages) which uses match syntax incompatible with python_version = "3.9". Adding exclude = ["/_pytest/"] prevents the path from being scanned. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On Python 3.11, mypy 1.19.1 follows imports into _pytest/terminal.py which uses match syntax (Python 3.10+), causing a fatal [syntax] error. Python 3.12 can parse match natively so the issue only surfaces in CI. Using follow_imports="skip" prevents mypy from traversing into _pytest.* regardless of how the import is reached. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shekel.integrations.langgraph.budgeted_graph(max_usd, **kwargs)— a@contextmanagerwrappingshekel.budget()for LangGraph workflowslanggraphoptional extra topyproject.tomlBudgetExceededErrorpropagation, cost recordingHow it works
No new provider adapter needed — existing OpenAI/Anthropic patches automatically intercept all LLM calls inside LangGraph nodes.
budgeted_graphis purely a convenience import.Test plan
pytest tests/integrations/test_langgraph_integration.py -v— 8/8 passpytest tests/ --ignore=tests/integrations/test_groq_integration.py --ignore=tests/integrations/test_gemini_integration.py --ignore=tests/performance/ -q— 391 passed, 0 failuresruff check— clean🤖 Generated with Claude Code