Skip to content

feat(langgraph): add __repr__ methods to all channel classes for better debugging#7083

Open
Charan Karnati (Charank18) wants to merge 1 commit intolangchain-ai:mainfrom
Charank18:fix/channel-repr-methods
Open

feat(langgraph): add __repr__ methods to all channel classes for better debugging#7083
Charan Karnati (Charank18) wants to merge 1 commit intolangchain-ai:mainfrom
Charank18:fix/channel-repr-methods

Conversation

@Charank18

This PR adds human-readable repr methods to all 9 channel classes in libs/langgraph/langgraph/channels/. Currently, debugging channel state requires manually inspecting attributes. With these changes, repr(channel) now shows key information at a glance:

  • LastValue / LastValueAfterFinish: shows typ, key, value (or MISSING), and finished flag
  • EphemeralValue / UntrackedValue: shows typ, key, guard, and value
  • AnyValue: shows typ, key, and value
  • Topic: shows typ, key, accumulate, and current length
  • BinaryOperatorAggregate: shows typ, key, operator name, and value
  • NamedBarrierValue / NamedBarrierValueAfterFinish: shows key, names, seen, and finished flag

Example: LastValue(typ=<class 'int'>, key='counter', value=42)

Add human-readable __repr__ to all channel classes for better debugging:
- LastValue, LastValueAfterFinish
- EphemeralValue
- Topic
- BinaryOperatorAggregate
- AnyValue
- UntrackedValue
- NamedBarrierValue, NamedBarrierValueAfterFinish

Each repr shows the channel's type, key, and current value state,
making it easier to inspect channel state during development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant