Skip to content

fix(python-sdk): include API key in memory events WebSocket connections#48

Merged
AbirAbbas merged 3 commits intomainfrom
fix/memory-events-api-key-auth
Dec 3, 2025
Merged

fix(python-sdk): include API key in memory events WebSocket connections#48
AbirAbbas merged 3 commits intomainfrom
fix/memory-events-api-key-auth

Conversation

@AbirAbbas
Copy link
Contributor

Summary

Fixes 401 authentication errors when agents try to connect to memory events WebSocket endpoint on an authenticated control plane.

Root Cause: The MemoryEventClient was not including the X-API-Key header when connecting to the /api/v1/memory/events/ws WebSocket endpoint, even though the API key was properly configured in the agent.

Changes:

  • Add optional api_key parameter to MemoryEventClient.__init__
  • Include X-API-Key header in WebSocket connect() method
  • Include X-API-Key header in history() method (both httpx and requests paths)
  • Pass api_key from Agent to MemoryEventClient in both instantiation sites

Test plan

  • All existing tests pass (393 passed)
  • Deploy to Railway and verify memory events WebSocket connects successfully

🤖 Generated with Claude Code

AbirAbbas and others added 3 commits December 3, 2025 14:38
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>
@AbirAbbas AbirAbbas merged commit 669d06f into main Dec 3, 2025
15 checks passed
@AbirAbbas AbirAbbas deleted the fix/memory-events-api-key-auth branch December 3, 2025 19:58
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