Standard Error Reporting
Simply raise exceptions in your agent code. The SDK will catch them and use the extension to format the error message.Advanced Configuration
If you want to customize the error reporting, for example to include stack traces, you can inject the extension with custom parameters.1
Import the Error extension
Import
ErrorExtensionServer, ErrorExtensionSpec, and ErrorExtensionParams.2
Inject and Configure
Inject the extension using
Annotated and set include_stacktrace=True.Handling Multiple Errors
The Error extension supportsExceptionGroup to report multiple errors at once. When an ExceptionGroup is raised, it is formatted as a group of errors in the UI.
Adding Context
You can attach arbitrary context to errors by accessing the injectedErrorExtensionServer instance. This context will be included in the error metadata sent to the client.