|
Download tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/hooks.md from Lego-X/ProgramGen: direct link, hf CLI and curl.
- Browser
- Download file 2.13 kB
-
https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/hooks.md
- Command line
-
hf download hf://datasets/Lego-X/ProgramGen/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/hooks.md
-
curl -L -o hooks.md https://huggingface.co/datasets/Lego-X/ProgramGen/resolve/main/tasks/data/reverse/0fl01__oxide-agent.e2f15d4/environment/docs/hooks.md
2.13 kB
Hooks System (Usage Reference)
Hooks intercept agent lifecycle events to enforce limits and safety rules. They
are built in; no user code is required. Two hooks are manageable at runtime via
the manager control plane (topic_agent_hooks_enable / topic_agent_hooks_disable /
topic_agent_hooks_get): search_budget and timeout_report. The completion and
tool-access hooks are protected and cannot be disabled.
Active hooks
| Hook | Applies to | Behavior |
|---|---|---|
| CompletionCheckHook | main + sub-agents | Verifies all todo tasks are done; forces extra iterations if not. |
| HotContextHealthHook | main + sub-agents | Monitors context health during execution. |
| ToolAccessPolicyHook | main agent | Blocks tools not allowed by the current profile (allowlist/blocklist). |
| SubAgentSafetyHook | sub-agents | Restricts iterations, token budget, and blocks dangerous tools for delegated tasks. |
| SearchBudgetHook | main + sub-agents | Limits web-search tool calls per session (default 10). |
| TimeoutReportHook | main + sub-agents | Produces a structured report when the agent time limit is reached. |
Configurable limits (environment)
| Variable | Default | Purpose |
|---|---|---|
AGENT_TIMEOUT_SECS |
1800 | Agent time limit (30 minutes). |
AGENT_MAX_ITERATIONS |
200 | Max iterations, main agent (env-overridable). |
SUB_AGENT_MAX_ITERATIONS |
2000 | Max iterations, sub-agent (env-overridable). |
AGENT_SEARCH_LIMIT |
10 | Search tool calls per session. |
AGENT_CONTINUATION_LIMIT |
10 | Max forced continuations from completion checks. |
AGENT_MAX_TOKENS |
200000 | Max tokens in memory (main agent). |
Sub-agents inherit the main-agent token budget unless an explicit override is set.
Main vs sub-agent behavior
- Main agent: orchestrates, can delegate to sub-agents, governed by the profile's tool access policy.
- Sub-agent: executes a delegated subtask in an isolated session with a task-specific tool whitelist; cannot spawn further sub-agents; governed by SubAgentSafetyHook instead of the profile policy hook.