New to Claude Skills? Learn how to install them →

lobehub on GitHub

Agent Signal

Free

Implement event-driven pipelines for AI agents.

Get this skill

Free · Opens the source repo

What Agent Signal does

Agent Signal is a skill designed to facilitate the implementation of event-driven background processes for AI agents. This skill allows developers to decouple background work from foreground chat requests, enabling more efficient handling of events and actions. The core architecture follows a consistent runtime shape, where events trigger signal interpretations that lead to action executions, ultimately resulting in built-in signals that convey the outcome of these actions.

The skill's architecture is structured around several key components: sources, signals, actions, and policies. Sources represent normalized events from various producers, such as user messages or system events. Signals provide semantic interpretations of these sources, while actions define the concrete side effects that should occur in response to signals. Policies act as middleware bundles that register handlers for sources, signals, and actions, allowing for modular and reusable components in the workflow.

To effectively use Agent Signal, developers should follow a systematic approach. This includes defining or reusing source types, signal types, and action types, as well as implementing handlers for each of these components. The skill also emphasizes observability, providing tools for tracing and debugging workflows, ensuring that developers can monitor the performance and behavior of their agent pipelines. The documentation includes references to architecture, handlers, and observability, which guide users through the setup and implementation process.

Agent Signal is ideal for developers looking to enhance their AI agents with robust event-driven capabilities. It is particularly useful in scenarios where asynchronous processing is required, allowing for more responsive and efficient agent interactions. By leveraging this skill, developers can create sophisticated workflows that handle a variety of events and actions without the overhead of tightly coupling background tasks to user interactions.

When to use it

Use Agent Signal when you need to implement background workflows for AI agents that respond to various events without blocking user interactions.

When not to use it

This skill may not be suitable for simple use cases where synchronous processing suffices or when minimal event handling is required.

What you can build with it

Asynchronous Event Handling

Implement Agent Signal to manage events such as user messages or system notifications asynchronously, ensuring that your AI agent remains responsive.

Modular Workflow Design

Use Agent Signal to create modular workflows where different policies can be easily added or modified without disrupting the overall system.

Enhanced Observability

Leverage the observability features of Agent Signal to gain insights into the performance and execution of your agent workflows, aiding in debugging and optimization.

How to install Agent Signal

View source

1. Install with the skills CLI

npx skills add lobehub/lobehub/agent-signal --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by lobehub

Agent Signal

Use this skill to implement event-driven background work for agents without coupling the work to the foreground chat request.

Agent Signal has one consistent runtime shape:

source event -> signal interpretation -> action execution -> built-in result signals

Durable self-iteration work has one extra completion branch:

memory/skill action -> execAgent enqueue -> agent.execution.completed -> selfIteration receipt projection

Start Here

  1. Read references/architecture.md to map the package boundary, runtime queue, scope model, and async workflow handoff.
  2. Read references/handlers.md before writing any new policy, source handler, signal handler, or action handler.
  3. Read references/observability.md when you need tracing, metrics, debugging, or workflow snapshot visibility.

Use The Right Entry Point

  • Use emitAgentSignalSourceEvent(...) when a server-owned producer should execute the pipeline immediately.
  • Use executeAgentSignalSourceEvent(...) when a worker or controlled backend path already owns execution timing and may inject a runtime guard backend.
  • Use enqueueAgentSignalSourceEvent(...) when the caller should return quickly and let Upstash Workflow process the event out-of-band.
  • Use emitAgentSignalSourceEventWithStore(...) for isolated tests or evals that should avoid ambient Redis state.

Read:

  • apps/server/src/services/agentSignal/index.ts
  • apps/server/src/workflows/agentSignal/index.ts
  • apps/server/src/workflows/agentSignal/run.ts

Core Model

  • source: A normalized fact that happened. Sources come from producers such as runtime lifecycle events, user messages, or bot ingress.
  • signal: A semantic interpretation derived from one source or from another signal. Signals express meaning, routing, or policy state.
  • action: A concrete side effect planned from one signal. Actions do the work.
  • policy: An installable middleware bundle that registers source, signal, and action handlers.
  • procedure: Not a distinct runtime node. Treat "procedure" as the end-to-end flow for one use case: ingress source, matching handlers, planned actions, execution result, and observability.

Keep the boundaries strict:

  • Add a new source when the outside world produced a new event.
  • Add a new signal when the system needs a reusable semantic interpretation.
  • Add a new action when the runtime needs a concrete side effect.
  • Add or update a policy when you are wiring those pieces together.

Implementation Workflow

  1. Decide whether the use case is synchronous or quiet background work.
  2. Define or reuse a source type in packages/agent-signal/src/source/sourceTypes.ts.
  3. Define or reuse signal and action types in apps/server/src/services/agentSignal/policies/types.ts.
  4. Implement handlers with defineSourceHandler, defineSignalHandler, or defineActionHandler.
  5. Add source normalization or hydration under apps/server/src/services/agentSignal/sources/** when the producer payload needs shaping.
  6. Bundle handlers with defineAgentSignalHandlers(...).
  7. Register the policy in apps/server/src/services/agentSignal/policies/index.ts and pass it into the runtime factory if needed.
  8. Add or update ingress code that emits or enqueues the source event.
  9. For async self-iteration writes, stamp an Agent Signal operation marker and project user-visible receipts from the completion path.
  10. Add observability and tests before considering the flow complete.

Default Reading Set

  • Shared semantic core: packages/agent-signal/src/index.ts packages/agent-signal/src/base/builders.ts packages/agent-signal/src/base/types.ts packages/agent-signal/src/source/sourceTypes.ts packages/agent-signal/src/source/sourceEvent.ts
  • Server-owned runtime and middleware: apps/server/src/services/agentSignal/runtime/AgentSignalRuntime.ts apps/server/src/services/agentSignal/runtime/AgentSignalScheduler.ts apps/server/src/services/agentSignal/runtime/middleware.ts apps/server/src/services/agentSignal/runtime/context.ts
  • Existing policy example: apps/server/src/services/agentSignal/policies/analyzeIntent/index.ts apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackSatisfaction.ts apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackDomain.ts apps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.ts apps/server/src/services/agentSignal/policies/analyzeIntent/actions/userMemory.ts apps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.ts apps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.ts apps/server/src/services/agentSignal/policies/completionPolicy.ts apps/server/src/services/agentSignal/services/selfIteration/completion/buildSelfIterationReceipts.ts apps/server/src/services/agentSignal/services/selfIteration/completion/selfIterationCompletionHandler.ts
  • Observability: apps/server/src/services/agentSignal/observability/projector.ts apps/server/src/services/agentSignal/observability/traceEvents.ts packages/observability-otel/src/modules/agent-signal/index.ts

Implementation Rules

  • Reuse existing source, signal, and action types before adding new ones.
  • Keep source handlers focused on interpretation and fan-out, not heavy side effects.
  • Keep action handlers responsible for side effects, idempotency, and executor-style result reporting. For memory/skill self-iteration actions, the side effect is enqueueing execAgent; the durable write and receipt projection happen after completion.
  • Use stable ids and idempotency keys when the same source can arrive more than once.
  • Preserve scope discipline. The runtime uses scopeKey to serialize related background work.
  • Prefer the dedicated shared package types and builders from @lobechat/agent-signal for normalized nodes and result contracts.
  • Do not project memory or skill receipts from the enqueue action. Use agent.execution.completed + selfIteration finalState via createSelfIterationCompletionHandler(...).
  • Add focused tests near the touched runtime, policy, or store module. Existing tests under apps/server/src/services/agentSignal/**/__test__ and **/__tests__ are the reference pattern.

References

  • Architecture and boundaries: references/architecture.md
  • Writing handlers and policies: references/handlers.md
  • Observability, metrics, and debugging: references/observability.md

Frequently asked questions about Agent Signal

Similar skills