
Agent Signal
FreeImplement event-driven pipelines for AI agents.
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 source1. Install with the skills CLI
npx skills add lobehub/lobehub/agent-signal --agent claude-code2. 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 lobehubAgent 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
- Read
references/architecture.mdto map the package boundary, runtime queue, scope model, and async workflow handoff. - Read
references/handlers.mdbefore writing any new policy, source handler, signal handler, or action handler. - Read
references/observability.mdwhen 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.tsapps/server/src/workflows/agentSignal/index.tsapps/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
sourcewhen the outside world produced a new event. - Add a new
signalwhen the system needs a reusable semantic interpretation. - Add a new
actionwhen the runtime needs a concrete side effect. - Add or update a
policywhen you are wiring those pieces together.
Implementation Workflow
- Decide whether the use case is synchronous or quiet background work.
- Define or reuse a source type in
packages/agent-signal/src/source/sourceTypes.ts. - Define or reuse signal and action types in
apps/server/src/services/agentSignal/policies/types.ts. - Implement handlers with
defineSourceHandler,defineSignalHandler, ordefineActionHandler. - Add source normalization or hydration under
apps/server/src/services/agentSignal/sources/**when the producer payload needs shaping. - Bundle handlers with
defineAgentSignalHandlers(...). - Register the policy in
apps/server/src/services/agentSignal/policies/index.tsand pass it into the runtime factory if needed. - Add or update ingress code that emits or enqueues the source event.
- For async self-iteration writes, stamp an Agent Signal operation marker and project user-visible receipts from the completion path.
- Add observability and tests before considering the flow complete.
Default Reading Set
- Shared semantic core:
packages/agent-signal/src/index.tspackages/agent-signal/src/base/builders.tspackages/agent-signal/src/base/types.tspackages/agent-signal/src/source/sourceTypes.tspackages/agent-signal/src/source/sourceEvent.ts - Server-owned runtime and middleware:
apps/server/src/services/agentSignal/runtime/AgentSignalRuntime.tsapps/server/src/services/agentSignal/runtime/AgentSignalScheduler.tsapps/server/src/services/agentSignal/runtime/middleware.tsapps/server/src/services/agentSignal/runtime/context.ts - Existing policy example:
apps/server/src/services/agentSignal/policies/analyzeIntent/index.tsapps/server/src/services/agentSignal/policies/analyzeIntent/feedbackSatisfaction.tsapps/server/src/services/agentSignal/policies/analyzeIntent/feedbackDomain.tsapps/server/src/services/agentSignal/policies/analyzeIntent/feedbackAction.tsapps/server/src/services/agentSignal/policies/analyzeIntent/actions/userMemory.tsapps/server/src/services/agentSignal/policies/analyzeIntent/actions/skillManagement.tsapps/server/src/services/agentSignal/policies/analyzeIntent/completionSkillSynthesis.tsapps/server/src/services/agentSignal/policies/completionPolicy.tsapps/server/src/services/agentSignal/services/selfIteration/completion/buildSelfIterationReceipts.tsapps/server/src/services/agentSignal/services/selfIteration/completion/selfIterationCompletionHandler.ts - Observability:
apps/server/src/services/agentSignal/observability/projector.tsapps/server/src/services/agentSignal/observability/traceEvents.tspackages/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
scopeKeyto serialize related background work. - Prefer the dedicated shared package types and builders from
@lobechat/agent-signalfor normalized nodes and result contracts. - Do not project memory or skill receipts from the enqueue action. Use
agent.execution.completed+selfIterationfinalState viacreateSelfIterationCompletionHandler(...). - 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
Skill Creator
Efficiently create and manage skills for Gemini CLI.
Agent Development
Create and manage autonomous agents for Claude Code.
Math Olympiad Solver
Solve and verify competition math problems effectively.
Microsoft Skill Creator
Create specialized skills for Microsoft technologies.
Doublecheck
A verification pipeline for AI-generated claims.
Skill Development for Claude Code
Create and enhance skills for Claude Code plugins.
