Results
Every execution in BindAI returns a result object. Result objects provide a consistent way to determine whether an operation succeeded, inspect its output, or handle errors. Instead of returning raw strings or provider-specific responses, BindAI returns structured result types across the framework.Why Results?
Using result objects provides several advantages:- consistent API
- predictable error handling
- structured outputs
- provider independence
- easier debugging
AgentResult
The most common result type isAgentResult.
Every agent execution returns one.
AgentResult Structure
Checking Success
Always verify that execution completed successfully.Handling Errors
When an execution fails:Structured Output
If an output model is supplied, the result contains the parsed object.output contains an instance of the requested model.
Workflow Results
Workflow execution also returns a result object. Example:Tool Results
Tools also return structured results. Example:Human Task Results
Human approval nodes store their completion result inside the workflow context. Example:Success Pattern
Most BindAI result objects follow the same structure.Exceptions vs Results
BindAI prefers returning result objects for expected execution outcomes. Exceptions are generally reserved for unexpected failures such as:- programming errors
- invalid configuration
- missing dependencies
Debugging
Result objects are useful during development. Example:Best Practices
- Always check
successbefore usingoutput. - Display
errormessages to assist debugging. - Use structured outputs whenever possible.
- Return consistent result objects from custom tools.
- Avoid returning raw provider responses directly to application code.
