Agent skill · AI & Agents

agent-runtime-hooks

Agent runtime lifecycle hooks. Use for before/after tool or step hooks, tool mocks, human intervention, sub-agent calls, context compression, evals, tracing, callAgent, or lifecycle events.

LobeHub80,937★ · +310/wk · 1 repos on radarProfile →
claude-codeNOASSERTION
Install
npx skills add lobehub/lobehub --skill agent-runtime-hooks --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 7 KB
Bundled scripts: none
Path: .agents/skills/agent-runtime-hooks/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 81,252 · +315 this week
Language: TypeScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Agent Runtime Hooks Lifecycle hooks for observing and intercepting agent execution. Hooks are registered per-operation via `execAgent({ hooks })` and dispatched by `HookDispatcher`. ## Hook Types 16 hook types across 5 categories: ``` execAgent({ hooks }) │ ├─ beforeStep ──────────── Before each step executes │ │ │ ├─ [call_llm] LLM inference │ │ │ ├─ [call_tool] │ │ ├─ beforeToolCall ── Before tool executes (supports mocking) │ │ ├─ (tool execution) │ │ ├─ afterToolCall ─── After tool completes (observation only) │ │ └─ onToolCallError ─ Tool threw an exception │ │ │ ├─ [request_human_approve] │ │ ├─ beforeHumanIntervention ── Before agent pauses │ │ ├─ afterHumanIntervention ─── After approve/reject + resume │ │ └─ onStopByHumanIntervention ── User rejected, agent halted │ │ │ ├─ [compress_context] │ │ ├─ beforeCompact ──── Before compression starts │ │ ├─ afterCompact ───── After compression completes │ │ └─ onCompactError ─── Compression failed │ │ │ ├─ [callAgent] (via execSubAgentTask) │ │ ├─ beforeCallAgent ── Before sub-agent starts │ │ ├─ afterCallAgent ─── After sub-agent completes │ │ └─ onCallAgentError ── Sub-agent failed │ │ │ └─ afterStep ──────────── After step co

What's inside
Steps it walks through
  1. Hook Types
  2. Key Files
  3. Registration Flow
  4. Hook Reference
  5. Step Level
  6. Tool Call Level
  7. Human Intervention
  8. Context Compression
  9. Sub-Agent (CallAgent)
  10. Design Notes
  11. Real-World Example: agent-evals
More from lobehub
All skills →
About this skill
What does the agent-runtime-hooks skill do?

Agent runtime lifecycle hooks. Use for before/after tool or step hooks, tool mocks, human intervention, sub-agent calls, context compression, evals, tracing, callAgent, or lifecycle events.

How do I install it?

Run `npx skills add lobehub/lobehub --skill agent-runtime-hooks --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From lobehub/lobehub, a repository with 81,252 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going