I’m the author of agent-contracts, a Python library that explores a
contract-based approach to structuring LangGraph agents.
When building larger LangGraph-based systems, I kept running into the
same issues:
- node responsibilities becoming implicit
- state dependencies spreading across the graph
- routing logic getting harder to reason about
- refactoring feeling increasingly risky
agent-contracts is an attempt to make these boundaries explicit.
Each node declares a contract that describes:
- which parts of the state it reads and writes
- what external services it depends on
- when it should run, using rule-based conditions with optional LLM hints
From these contracts, the LangGraph structure can be assembled in a more
predictable and inspectable way.
This is still early-stage and experimental.
I’m mainly interested in feedback on the design trade-offs and whether
this mental model resonates with others building complex agent systems.
I’m the author of agent-contracts, a Python library that explores a contract-based approach to structuring LangGraph agents.
When building larger LangGraph-based systems, I kept running into the same issues: - node responsibilities becoming implicit - state dependencies spreading across the graph - routing logic getting harder to reason about - refactoring feeling increasingly risky
agent-contracts is an attempt to make these boundaries explicit. Each node declares a contract that describes: - which parts of the state it reads and writes - what external services it depends on - when it should run, using rule-based conditions with optional LLM hints
From these contracts, the LangGraph structure can be assembled in a more predictable and inspectable way.
This is still early-stage and experimental. I’m mainly interested in feedback on the design trade-offs and whether this mental model resonates with others building complex agent systems.