The gateway now ships in the
praisonai-bot package. praisonai serve gateway still works exactly as documented here; for a standalone install see praisonai-bot Migration.Quick Start
1
Simple Usage
Error handling is automatic โ no configuration needed. When agents throw exceptions containing Unicode characters, the gateway safely converts them for bot replies.
2
Test Error Handling
Verify your version includes Unicode-safe error handling:If this runs without error, you have the fix from PR #1754.
How It Works
The gateway processes exceptions in three stages:- Root-cause extraction โ identifies the underlying API error
- Unicode sanitization โ converts symbols to ASCII-safe equivalents
- Safe reply โ sends clean message to user via bot
Configuration Options
Error handling is automatic with no required configuration. The feature is included in PraisonAI versions containing PR #1754.Gateway Error Handling Reference
Source implementation details in PraisonAI PR #1754
Structured Connection Errors
Thehello handshake returns machine-readable ConnectErrorCode values (auth_required, auth_unauthorized, protocol_unsupported, pairing_required, agent_not_found) with optional next_action hints โ instead of free-text-only connection failures.
Codes fall into two client-side classes: transient (rate_limited โ back off and retry) and terminal (auth_required, auth_unauthorized, pairing_required, protocol_unsupported, agent_not_found, origin_not_allowed, configuration_error โ reconnect loop stops until an operator intervenes). See Gateway Client โ Terminal vs Transient Connect Errors for how GatewayClient handles each class and the on_reconnect_paused callback.
See Gateway Handshake Protocol for the full error matrix and capability negotiation.
Reconnect After Disconnect
Pending inbox messages and in-flight executions are preserved when a WebSocket disconnects. On reconnect with the samesession_id, the client receives a status frame:
Common Patterns
Recognized Error Types
The gateway automatically recognizes and formats these error patterns:Symbol Replacements
Unicode symbols are replaced with ASCII equivalents:
Accented letters (รก, รฉ, รฑ, etc.) are converted to their base forms (a, e, n).
Before vs After
Before PR #1754 (broken on Windows):Best Practices
Monitor Gateway Logs
Monitor Gateway Logs
Full Unicode exception details are preserved in gateway logs for debugging while users see clean ASCII-safe messages.
Handle API Quota Limits
Handle API Quota Limits
Set up billing alerts and monitor usage to prevent quota exceeded errors:
Test Cross-Platform Compatibility
Test Cross-Platform Compatibility
The Unicode-safe error handling works on Windows, macOS, and Linux:
Upgrade Legacy Environments
Upgrade Legacy Environments
No workaround needed on supported versions. Previously recommended environment variables (
PYTHONUTF8=1) are no longer required for the bot reply path.Related
Gateway Troubleshooting
Troubleshoot Windows charmap errors and other gateway issues
Bot Gateway
Configure multiple bots with the gateway server

