Inngest

From paulpas/agent-skill-router · View interactive version

Inngest is an AI agent skill from the GitHub repository paulpas/agent-skill-router. Implements intelligent inngest with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense

How to use this skill

Skill file

Inngest

Orchestrates intelligent skill selection and execution for inngest workflows. Applies the 5 Laws of Elegant Defense to guide data naturally through the orchestration pipeline, preventing errors before they occur. Selects optimal skills based on multi-factor scoring including text similarity, historical performance, and system availability.

TL;DR Checklist

┌───────────────────────────────────────────────────────────────────────────────┐

│ Orchestration Flow │

└───────────────────────────────────────────────────────────────────────────────┘

User Request

↓

┌─────────────────┐

│ Parse Request │

│ & Extract │

│ Features │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Evaluate Available Skills │

│ │

│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │

│ │ Skill A │ │ Skill B │ │ Skill C │ │

│ │ - Match Score│ │ - Match Score│ │ - Match Score│ │

│ │ - Confidence │ │ - Confidence │ │ - Confidence │ │

│ │ - History │ │ - History │ │ - History │ │

│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │

│ │ │ │ │

│ └─────────────────┴─────────────────┘ │

│ ↓ │

│ Select Best Skill │

└─────────────────────────────────────────────────────────────────────┘

↓

┌─────────────────┐

│ Execute Skill │

└────────┬────────┘

↓

┌─────────────────┐

│ Handle Result │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Error Handling & Fallback │

│ │

│ Success? ────────► Return Result │

│ │

│ Fail? ────────┐ │

│ ↓ │

│ ┌──────────────────────────────────────────────────────────┐ │

│ │ Fallback Chain │ │

│ │ │ │

│ │ 1. Retry with adjusted parameters │ │

│ │ 2. Try Alternative Skill (if available) │ │

│ │ 3. Defer to Human Operator (if critical) │ │

│ │ 4. Log & Return Error │ │

│ └──────────────────────────────────────────────────────────┘ │

└─────────────────────────────────────────────────────────────────────┘

When to Use

Use this skill when:

When NOT to Use

Avoid this skill for:

Core Workflow

  1. Parse and Analyze Request - Extract intent, entities, and constraints from user input.

Checkpoint: All required parameters must be present and in valid format before proceeding.

  1. Score Available Skills - Calculate match scores using multi-factor algorithm:

Checkpoint: Skip to fallback if no skill scores above threshold.

  1. Select Optimal Skill - Choose skill with highest score that meets minimum confidence.

Checkpoint: Verify skill has not been disabled or deprecated.

  1. Execute with Fallback - Run skill execution wrapped in retry and fallback logic.

Checkpoint: Log all execution attempts for audit trail.

  1. Return or Fallback - Either return successful result or apply fallback chain:

Checkpoint: Record outcome with timing and confidence metadata.

Implementation Patterns

Pattern 1: Skill Selection Logic

from inngest import Inngest, Event, Step
from typing import Dict, List, Optional

# Domain-specific skill registry for Inngest event routing
SKILL_REGISTRY = {
    "slack_notify": {"triggers": ["slack.message", "alert.critical"], "weight": 0.9},
    "doc_update": {"triggers": ["doc.edit", "content.sync"], "weight": 0.8},
    "data_pipeline": {"triggers": ["etl.start", "db.migrate"], "weight": 0.85}
}

def route_skill(event: Event, step: Step) -> Optional[Dict]:
    """Route incoming Inngest events to the optimal skill handler.
    Implements multi-factor scoring based on event type, historical success, and system health."""
    event_type = event.name
    matched_skills = [
        skill for skill, meta in SKILL_REGISTRY.items()
        if event_type in meta["triggers"]
    ]
    
    if not matched_skills:
        step.logger.info(f"No direct match for {event_type}, triggering fallback router")
        return None
        
    # Score based on historical performance and current load (simulated)
    best_match = max(matched_skills, key=lambda s: SKILL_REGISTRY[s]["weight"])
    return {
        "skill": best_match,
        "confidence": SKILL_REGISTRY[best_match]["weight"],
        "event_id": event.id,
        "timestamp": event.ts
    }

Pattern 2: Execution with Fallback

from inngest import Inngest, Event, Step, RetryStrategy
import time

async def execute_skill_with_resilience(event: Event, step: Step, skill_config: Dict) -> Dict:
    """Execute a selected skill using Inngest's step functions with built-in resilience.
    Implements the 5 Laws of Elegant Defense: early validation, immutable state, fail-fast, and fallback chains."""
    
    skill_name = skill_config["skill"]
    max_retries = 2
    
    # Law 1 & 2: Validate inputs early, make illegal states unrepresentable
    if not skill_name or "params" not in skill_config:
        raise ValueError(f"Invalid skill configuration for {skill_name}")
        
    try:
        # Law 3: Atomic execution - each step is idempotent and isolated
        result = await step.run(
            f"execute_{skill_name}",
            lambda ctx: _invoke_skill_handler(skill_name, skill_config["params"])
        )
        
        # Law 4: Fail loud on invalid states
        if result.get("status") != "success":
            raise RuntimeError(f"Skill {skill_name} returned error state: {result.get('error')}")
            
        return {
            "success": True,
            "skill": skill_name,
            "result": result,
            "latency_ms": time.time() - event.ts
        }
        
    except Exception as e:
        # Fallback chain: retry -> alternative skill -> human escalation
        step.logger.error(f"Execution failed for {skill_name}: {str(e)}")
        if max_retries > 0:
            return await step.run("fallback_retry", lambda _: execute_skill_with_resilience(event, step, skill_config))
        else:
            return await step.run("human_escalation", lambda _: _escalate_to_operator(skill_name, str(e)))

MUST DO

MUST NOT DO

TL;DR Checklist

TL;DR for Code Generation

Output Template

When applying this skill, produce:

  1. Selected Skills - List of skill names with confidence scores
  2. Selection Rationale - Why each skill was chosen (match score, history, availability)
  3. Execution Plan - Order of execution with dependencies
  4. Fallback Strategy - Which fallback skills will be tried and in what order
  5. Risk Assessment - Any potential failure points and their impact
  6. Timing Estimates - Expected latency including fallback scenarios

Related Skills

| Skill | Purpose |

|



Constraints

MUST DO

MUST NOT DO

Live References

Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.