Home/Tools/@tpmjs/tools-slo-draft

sloDraftTool

@tpmjs/tools-slo-draft

Draft Service Level Objective (SLO) definitions for a service. Provide the service name and metrics (with name, target percentage, and time window) to generate a comprehensive SLO document in markdown format with error budgets, alerting strategies, and monitoring recommendations.

Official
ops
v0.2.1
MIT

Interactive Playground

Test @tpmjs/tools-slo-draft (sloDraftTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-slo-draft
pnpm add @tpmjs/tools-slo-draft
yarn add @tpmjs/tools-slo-draft
bun add @tpmjs/tools-slo-draft
deno add npm:@tpmjs/tools-slo-draft

2. Import the tool

import { sloDraftTool } from '@tpmjs/tools-slo-draft';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { sloDraftTool } from '@tpmjs/tools-slo-draft';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { sloDraftTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Auto-extracted
serviceName
Required
Type: string

Name of the service (e.g., "API Gateway", "Payment Service")

metrics
Required
Type: array

Array of SLO metrics with name, target (percentage), and window (e.g., "30d", "7d")

Schema extracted: 1/1/2026, 8:17:57 AM

README

@tpmjs/tools-slo-draft

Draft Service Level Objective (SLO) definitions for services with comprehensive documentation, error budgets, and alerting strategies.

Installation

npm install @tpmjs/tools-slo-draft

Usage

import { sloDraftTool } from '@tpmjs/tools-slo-draft';

// Use with Vercel AI SDK
const result = await sloDraftTool.execute({
  serviceName: 'Payment API',
  metrics: [
    {
      name: 'Availability',
      target: 99.9,
      window: '30d'
    },
    {
      name: 'API Latency P99',
      target: 95.0,
      window: 'rolling 7 days'
    },
    {
      name: 'Error Rate',
      target: 99.5,
      window: '30d'
    }
  ]
});

console.log(result.slo); // Markdown formatted SLO document
console.log(result.summary); // Brief summary
console.log(result.metrics); // Processed metrics with severity

Input

  • serviceName (string, required): Name of the service
  • metrics (array, required): Array of metric objects with:
    • name (string): Metric name (e.g., "Availability", "Latency P99")
    • target (number): Target percentage (0-100)
    • window (string): Time window (e.g., "30d", "7 days", "rolling 30 days")

Output

Returns an object with:

  • slo (string): Comprehensive SLO document in markdown format
  • metrics (array): Processed metrics with additional metadata:
    • Original name, target, window
    • windowType: 'rolling' or 'calendar'
    • severity: 'critical' (≥99.9%), 'high' (≥99%), or 'medium' (<99%)
  • summary (string): Brief summary of the SLO
  • metadata (object):
    • serviceName: Service name
    • createdAt: ISO timestamp
    • totalMetrics: Total number of metrics
    • criticalMetrics: Number of critical severity metrics

Features

  • Automatic Severity Classification: Metrics are classified as critical, high, or medium based on targets
  • Error Budget Calculation: Calculates allowed downtime for each metric
  • Alerting Strategy: Provides burn rate-based alerting recommendations
  • Window Type Detection: Automatically detects rolling vs calendar windows
  • Comprehensive Documentation: Generates full SLO document with monitoring and review processes

Example Output

The tool generates a markdown document including:

  • SLO definitions with targets and allowed downtime
  • Error budget policies
  • Alerting strategies based on severity
  • Review processes and schedules
  • Links to related documentation

License

MIT

Statistics

Downloads/month

43

Quality Score

78%

Bundle Size

NPM Keywords

tpmjs
ops
slo
monitoring
sre

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai