agent runtime hooks

AI Community

Skill notes

Hook Types

16 hook types across 5 categories:

Key Files

File · Role packages/agent-runtime/src/types/hooks.ts · Type definitions (AgentHookType, all event interfaces) src/server/services/agentRuntime/hooks/types.ts · Server-side types (AgentHook, re-exports) src/server/services/agentRuntime/hooks/HookDispatcher.ts · Registration, dispatch, dispatchBeforeToolCall src/server/modules/AgentRuntime/RuntimeExecutors.ts · Tool/Compact/HumanIntervention hook dispatch

Step Level

beforeStep — Before each step. event: AgentHookEvent afterStep — After each step. event: AgentHookEvent (content, toolsCalling, totalCost, etc.) onComplete — Terminal state. event: AgentHookEvent (reason: done/error/interrupted/max_steps/cost_limit) onError — Error occurred. event: AgentHookEvent (errorMessage, errorDetail)

Tool Call Level

beforeToolCall — Before tool executes. Supports mocking via event.mock(). Dispatch method: hookDispatcher.dispatchBeforeToolCall() (returns mock result or null). afterToolCall — After tool completes. Observation only. onToolCallError — Tool threw an exception (catch block, not just success=false).

Human Intervention

beforeHumanIntervention — Before agent pauses for approval. afterHumanIntervention — After approve/reject, agent resumes. onStopByHumanIntervention — User rejected, agent halted.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
AI
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@lobehub · no license declared
Token usage
Lean
Setup complexity
Guided setup
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Shell exec
Network behavior
External requests
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview agent-runtime-hooks.preview
# Real-World Example: agent-evals

See `devtools/agent-evals/helpers/runner.ts` — `createEvalHooks()` uses `afterStep`, `onComplete`, `afterToolCall`, and `beforeToolCall` (for mock).

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.