fix(python-sdk): include API key in memory events WebSocket connections#48
Merged
fix(python-sdk): include API key in memory events WebSocket connections#48
Conversation
The MemoryEventClient was not including the X-API-Key header when connecting to the memory events WebSocket endpoint, causing 401 errors when the control plane has authentication enabled. Changes: - Add optional api_key parameter to MemoryEventClient constructor - Include X-API-Key header in WebSocket connect() method - Include X-API-Key header in history() method (both httpx and requests) - Pass api_key from Agent to MemoryEventClient in both instantiation sites 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The documentation chatbot was binding to `::` (IPv6 all interfaces) which causes Railway internal networking to fail with "connection refused" since Railway routes traffic over IPv4. Removed explicit host parameter to use the SDK default of `0.0.0.0` which binds to IPv4 all interfaces. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This reverts commit 2c1b205.
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
Fixes 401 authentication errors when agents try to connect to memory events WebSocket endpoint on an authenticated control plane.
Root Cause: The
MemoryEventClientwas not including theX-API-Keyheader when connecting to the/api/v1/memory/events/wsWebSocket endpoint, even though the API key was properly configured in the agent.Changes:
api_keyparameter toMemoryEventClient.__init__X-API-Keyheader in WebSocketconnect()methodX-API-Keyheader inhistory()method (both httpx and requests paths)api_keyfromAgenttoMemoryEventClientin both instantiation sitesTest plan
393 passed)🤖 Generated with Claude Code