feat(payments): Add LangGraph integration for payment handling#546
Open
ragsu43 wants to merge 12 commits into
Open
feat(payments): Add LangGraph integration for payment handling#546ragsu43 wants to merge 12 commits into
ragsu43 wants to merge 12 commits into
Conversation
rajuans
reviewed
Jun 23, 2026
rajuans
reviewed
Jun 23, 2026
rajuans
reviewed
Jun 23, 2026
Merge AgentCorePaymentsConfig (LangGraph) and AgentCorePaymentsPluginConfig (Strands) into a single dataclass in integrations/config.py. Both names remain available as aliases for backward compatibility.
… of in langgraph-specific package
…ersion floor Fix TYPE_CHECKING import in errors.py to use ..config (parent package) instead of .config (non-existent sibling module). This resolves mypy/pyright failures for PaymentErrorContext.config type resolution. Raise langchain and langgraph minimum versions from >=0.2.0 to >=1.0.0 in both dev dependencies and the [langgraph] optional group. AgentMiddleware, create_agent, and the langchain.agents.middleware namespace are langchain 1.0 APIs — the 0.2.0 floor allowed installations that would fail at import time.
Cover the auto_session feature path that was previously only validated live against testnet. Tests verify: - Session created on first 402 when auto_session=True - Config mutated with new session ID for subsequent calls - Session reused across multiple tool calls (no duplicate creation) - auto_session=False still raises PAYMENT ERROR without session - Budget and expiry config values passed correctly - Pre-existing session_id skips auto-creation
Add PRE-MERGE REQUIREMENT note to test_functional.py docstring clarifying that any middleware changes must be validated against live testnet before merge, since these tests are skipped in CI.
Add note that one middleware instance should be created per agent invocation/request. The middleware is not thread-safe due to config mutations in auto_session and on_payment_error callbacks.
…cation Extract guard checks, 402 detection, payment request extraction, header injection, and post-payment rejection detection into shared private methods. The sync and async paths now only differ at await/sleep boundaries. Future bug fixes to detection or injection logic only need to be applied in one place instead of four. No behavioral changes — 128 tests pass identically before and after.
17b79dc to
b44cf37
Compare
Document when each path is used (.invoke vs .ainvoke), what the async path does differently (non-blocking sleep, to_thread for signing, async callbacks), and provide FastAPI and script examples.
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.
Description of changes:
Added LangGraph middleware and config files for developer integration with ACP.