Provides a shared library of TypeScript interfaces, Zod schemas, and utility functions for defining and validating service runbooks, incident workflows, and alert configurations. It serves as the core type and validation layer for the Agent Runbook ecosystem, requiring only `zod` as a runtime dependency.
Core types, Zod schemas, utilities, and error classes for the Agent Runbook Generator ecosystem. This package is the single source of truth for all domain types used throughout the @reaatech/agent-runbook-* monorepo.
68+ domain types — ServiceDefinition, Runbook, AlertDefinition, DashboardConfig, FailureMode, RollbackProcedure, IncidentWorkflow, ServiceDependency, HealthCheck, and more
70+ Zod schemas — runtime validation for every domain type, used at API boundaries and in the MCP server
25 utility functions — file I/O, ID generation, markdown helpers, secret redaction, retry with exponential backoff, duration parsing
8 error classes — AppError, ValidationError, NotFoundError, AnalysisError, GenerationError, ConfigurationError, LLMError with type guards and user-facing formatters
Zero runtime dependencies beyond zod — lightweight and tree-shakeable
Dual ESM/CJS output — works with import and require
Quick Start
typescript
import { type AnalysisContext, type Runbook, AlertSeverity, generateId, readFile, validateInput, AnalysisContextSchema,} from "@reaatech/agent-runbook";// Generate a unique runbook IDconst id = generateId("rb");// Validate an analysis context at the boundaryconst raw = JSON.parse(incomingJson);const context = AnalysisContextSchema.parse(raw);// Read a file with automatic error handlingconst content = readFile("./some-file.json");
API Reference
Domain Types
Export
Kind
Description
ServiceDefinition
interface
Service metadata — name, team, repository, version
AnalysisContext
interface
Context passed between analysis and generation phases
Runbook
interface
Complete runbook with sections, metadata, and cross-references
RunbookSection
interface
Individual runbook section with content and subsections
RunbookMetadata
interface
Summary metadata about a generated runbook
GenerationConfig
interface
Configuration for the generation process
AlertDefinition
interface
Alert with name, type, severity, expression, annotations
DashboardConfig
interface
Dashboard with title, platform, panels, variables
DashboardPanel
interface
Dashboard panel with query, thresholds, legend
FailureMode
interface
Failure mode with category, severity, detection, mitigation
RollbackProcedure
interface
Rollback procedure with steps, checks, verification
RollbackStep
interface
Individual step with commands, timeout, automation
VerificationStep
interface
Post-rollback verification with success criteria
IncidentWorkflow
interface
Incident response workflow with severity, triggers, escalation
EscalationPolicy
interface
Escalation policy with levels, repeat policy
CommunicationTemplate
interface
Incident communication template with variables
ServiceDependency
interface
Service dependency with direction, protocol, criticality
ServiceMap
interface
Service map graph with nodes, edges, critical paths
HealthCheck
interface
Health check with endpoint, interval, timeout, criteria