Error Handling
All SDK methods return response objects with consistent `success`/`error` patterns.
Response Structure
{
success: boolean;
data?: any;
error?: string;
errorMessage?: string;
errorDetails?: object;
}{
success: bool
data: any | None
error: str | None
error_message: str | None
error_details: dict | None
}Checking Results
const result = await agent.memory.get("key");
if (result.success && result.data) {
// Safe to use result.data
await agent.log(`Value: ${result.data.value}`);
} else {
// Handle error
await agent.log(`Error: ${result.error || result.errorMessage}`, { error: true });
}result = agent.memory.get("key")
if result.success and result.data:
# Safe to use result.data
agent.log(f"Value: {result.data.value}")
else:
# Handle error
agent.log(f"Error: {result.error_message}", error=True)Uncaught Exceptions
When to Use Try/Catch
Common Error Patterns - (More details to come!)
Error Type
Cause
Solution
Best Practices
Last updated