voltagent icon indicating copy to clipboard operation
voltagent copied to clipboard

[DOC] Hooks documentation contains error

Open profound7 opened this issue 1 year ago • 4 comments

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 onHandoff which isn't in the documentation
  • onToolEnd example is incorrect
    • Documentation used 2 args: (agentInstance, toolResult)
    • Actual is 3 args: (agent, tool, result)
  • All the toolCall.toolName and toolResult.toolName result in error
    • actual should be .name

Describe the solution (optional)

No response

profound7 avatar Apr 28 '25 06:04 profound7

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!

omeraplak avatar Apr 28 '25 14:04 omeraplak

Why does onError hook disappeared without alternative ? What can be used instead ?

GoMino avatar Apr 28 '25 17:04 GoMino

Why does onError hook 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? 👀

omeraplak avatar Apr 28 '25 17:04 omeraplak

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

omeraplak avatar Apr 30 '25 20:04 omeraplak