Module 11: Error Handling
Handle protocol errors from agents on the client side.What You’ll Learn
- Catching
AcpClientSession.AcpError - Standard error codes in
AcpErrorCodes - Throwing
AcpProtocolExceptionfrom agent handlers - Error recovery — continuing after errors
The Code
ACP uses structured errors based on JSON-RPC error codes. On the client side, protocol errors arrive asAcpClientSession.AcpError exceptions. You can inspect the error code to determine what went wrong:
AcpProtocolException with a standard error code. The SDK converts it to a JSON-RPC error response:
Error Codes
Agents throw
AcpProtocolException with one of these codes. The SDK converts it to a JSON-RPC error response. Clients catch it as AcpClientSession.AcpError.