Skip to content

docs(hooks): document agent-based hooks example (51_agent_hooks)#519

Open
VascoSch92 wants to merge 2 commits into
mainfrom
burak/2864-agent-based-hook-evaluation
Open

docs(hooks): document agent-based hooks example (51_agent_hooks)#519
VascoSch92 wants to merge 2 commits into
mainfrom
burak/2864-agent-based-hook-evaluation

Conversation

@VascoSch92
Copy link
Copy Markdown
Member

Summary

Documents the new type="agent" hook introduced in OpenHands/software-agent-sdk#3052 by adding an Agent-based Hooks section to sdk/guides/hooks.mdx.

The section covers:

  • how the reviewer sub-agent returns an {"decision": "allow"|"deny", "reason": ...} payload
  • the key HookDefinition fields (system_prompt, tools, timeout, max_iterations)
  • isolated sub-conversation execution (no nested hooks), agent-hook:* metrics merged into the parent, and fail-open-on-error behaviour
  • a ready-to-run code block referencing examples/01_standalone_sdk/51_agent_hooks/main.py

Why

The agent-sdk [Optional] Docs example CI (check_documented_examples.py) fails on #3052 because the new 51_agent_hooks example is undocumented. This PR adds that documentation.

The branch name matches the agent-sdk PR branch (burak/2864-agent-based-hook-evaluation) so the agent-sdk check picks up this feature branch instead of falling back to main.

Related: OpenHands/software-agent-sdk#3052

Adds an "Agent-based Hooks" section to the hooks guide covering the new
type="agent" hook from software-agent-sdk#3052: how the reviewer sub-agent
returns an allow/deny decision, the key HookDefinition fields, isolated
sub-conversation execution, agent-hook:* metrics, and fail-open behaviour.

Documents examples/01_standalone_sdk/51_agent_hooks/main.py so the agent-sdk
"check documented examples" CI passes.
@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 24, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
all-hands-ai 🟢 Ready View Preview May 24, 2026, 10:18 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@VascoSch92
Copy link
Copy Markdown
Member Author

@burakkeless Could you give a look of the docs please?

Copy link
Copy Markdown
Contributor

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Good taste - Excellent documentation of the new agent-based hooks feature.

This PR provides clear, well-structured documentation that follows all repository conventions. The auto-sync format is correct, examples are comprehensive, and the technical content is accurate.

[IMPROVEMENT OPPORTUNITIES] (Optional, non-blocking)

  • The "Exit Codes" section (lines 28-47) could be clarified to indicate it applies specifically to shell script hooks, since agent-based hooks use a different mechanism (JSON payload). Consider adding a note like "For shell script hooks:" to prevent potential confusion.

[RISK ASSESSMENT]

  • [Overall PR] ⚠️ Risk Assessment: 🟢 LOW

Documentation-only change that adds new content without modifying existing functionality. The auto-sync format follows the established pattern and will be validated by CI. The branch name matches the agent-sdk PR branch, ensuring proper integration testing.

VERDICT:
Worth merging: High-quality documentation that clearly explains the new feature with excellent examples.

KEY INSIGHT:
The documentation effectively positions agent-based hooks as a semantic alternative to syntactic shell script filters, with the awk /etc/passwd example perfectly illustrating why LLM-based evaluation adds value beyond pattern matching.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/OpenHands/docs/actions/runs/26374283356

Comment thread sdk/guides/hooks.mdx
- Stop (quality reviewer): refuses to let the main agent finish until the
required deliverable exists in the workspace.

For shell-command hooks see ../33_hooks/33_hooks.py.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/33_hooks/main.py is the correct path

Comment thread sdk/guides/hooks.mdx
sensitive file* even though no obvious keyword (`cat`, `/etc/shadow`) appears.

Key fields on an agent `HookDefinition`:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is missing from this list.

@burakkeless
Copy link
Copy Markdown

@VascoSch92 I left 2 comments , but overall it looks good to me.

@burakkeless Could you give a look of the docs please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants