agent-runtime-hooks

Register lifecycle hooks to observe and intercept agent execution events.

Updated May 11, 2026
One-click install
npx skills add https://github.com/zmh13928433602-sys/lobe-chat --skill agent-runtime-hooks-zmh13928433602-sys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-runtime-hooks
Source: https://github.com/zmh13928433602-sys/lobe-chat/tree/main/.agents/skills/agent-runtime-hooks
Command: npx skills add https://github.com/zmh13928433602-sys/lobe-chat --skill agent-runtime-hooks-zmh13928433602-sys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Observability and control over agent execution by registering lifecycle hooks to observe, intercept, log, and modify behavior across steps, tool calls, and sub-agents.

Core Features & Use Cases

  • Lifecycle event registration: hook types for beforeStep, afterStep, onComplete, onError, beforeToolCall, afterToolCall, and more.
  • Interception and mocking: customize tool calls, pause for human intervention, and simulate outcomes for testing.
  • Sub-agent and context features: support for sub-agent calls, context compression, and tracing integrations.
  • Use cases: monitor agent behavior in production, audit agent decisions, and build debuggable, observable AI orchestration.

Quick Start

Register hooks by calling execAgent with an array of AgentHook objects to observe and control agent execution.

Frequently Asked Questions about agent-runtime-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I observe and log agent execution steps during orchestration?

Agent lifecycle hooks enable agent execution observation by registering events like beforeStep and afterStep to log steps, trace tool calls, and monitor behavior across nested sub-agents during orchestration.

Can I pause an AI agent for human intervention before a tool call?

Yes, you can pause an AI agent for human intervention by registering a beforeToolCall hook to intercept tool execution, mock outcomes, or manually validate decisions before proceeding.

How do I mock tool call outcomes for agent testing?

You mock tool call outcomes for agent testing by registering beforeToolCall and afterToolCall hooks to intercept execution, simulate responses, and validate agent decisions without triggering real tools.

Does this lifecycle hook system support nested sub-agent calls and context compression?

Yes, the lifecycle hook system supports nested sub-agent calls, context compression, and tracing integrations to maintain observability and control across complex, multi-layered agent execution workflows.

What is the best way to audit agent decisions in production?

Auditing agent decisions in production is best achieved by registering lifecycle hooks like onError and onComplete to capture execution events, trace tool interactions, and log decision paths across sub-agents.

Are there limitations when intercepting events across nested agents?

Intercepting events across nested sub-agents requires an event-driven hook system capable of context compression and tracing integrations, ensuring hooks properly propagate through beforeStep and afterStep without breaking orchestration state.