[DOC] Hooks documentation contains error
Documentation issue
The documentation about hooks contain errors. https://voltagent.dev/docs/agents/overview/#hooks
Describe the thing to improve
In the documentation sample code about createHooks, there will be errors if you try them out.
- There is no
onError - There is however, a
onHandoffwhich isn't in the documentation onToolEndexample is incorrect- Documentation used 2 args:
(agentInstance, toolResult) - Actual is 3 args:
(agent, tool, result)
- Documentation used 2 args:
- All the
toolCall.toolNameandtoolResult.toolNameresult in error- actual should be
.name
- actual should be
Describe the solution (optional)
No response
Hey @profound7 , Thank you so much for pointing this out! 🙏 You’re absolutely right. We’ll get it updated.
Would you be interested in opening a PR to fix the documentation? Of course, if you prefer, we can also handle it either way, we really appreciate your help!
Why does onError hook disappeared without alternative ?
What can be used instead ?
Why does
onErrorhook disappeared without alternative ? What can be used instead ?
Hey @GoMino ,
For error handling, you can follow this guide: https://voltagent.dev/docs/agents/overview/#error-handling But honestly, I think it would be better if onError was implemented directly. Would you be interested in adding it? 👀
Hey, We’ve updated the docs: https://voltagent.dev/docs/agents/hooks/
Instead of using onError, we’ve added the error object to onEnd -> https://voltagent.dev/docs/agents/hooks/#onend
Thank you @GoMino @profound7