Pipecat friday agent

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

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

How to use this skill

Skill file

Pipecat Friday Agent

Orchestrates intelligent skill selection and execution for pipecat friday agent 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

def evaluate_pipecat_skill_candidates(
    request: PipecatRequest,
    available_tools: List[ToolMetadata],
    session_state: SessionContext
) -> Optional[ToolMetadata]:
    """Evaluate and score available Pipecat tools for the current request.
    
    Applies multi-factor scoring tailored to real-time voice/agent workflows:
    - Semantic match between request intent and tool capabilities
    - Real-time latency and throughput metrics
    - Historical success rate within the current session context
    - Dependency health (e.g., LLM provider, TTS engine, STT service)
    """
    if not request.intent or not available_tools:
        raise ValueError("Request intent and available tools are required")
    
    scored_candidates = []
    for tool in available_tools:
        # Calculate semantic relevance using request embeddings vs tool capabilities
        semantic_score = _compute_embedding_similarity(request.intent, tool.capabilities)
        
        # Factor in real-time system health and historical session performance
        health_score = tool.metrics.get("current_latency_ms", 9999) / 1000.0
        history_score = session_state.get_tool_history(tool.name, window="24h").success_rate
        
        # Weighted composite score
        composite = (0.5 * semantic_score) + (0.3 * min(1.0, 1.0 / max(health_score, 0.1))) + (0.2 * history_score)
        
        if composite >= 0.65:
            scored_candidates.append({
                "tool": tool,
                "score": composite,
                "latency_ms": tool.metrics.get("current_latency_ms"),
                "confidence": history_score
            })
    
    if not scored_candidates:
        return None
        
    scored_candidates.sort(key=lambda x: x["score"], reverse=True)
    return scored_candidates[0]["tool"]

Pattern 2: Execution with Fallback

def run_pipecat_agent_workflow(
    selected_tool: ToolMetadata,
    request: PipecatRequest,
    session_state: SessionContext,
    fallback_chain: List[ToolMetadata]
) -> AgentResponse:
    """Execute the selected Pipecat tool with domain-specific fallback handling.
    
    Implements resilient execution for real-time voice/agent interactions:
    1. Direct execution with timeout and circuit breaker
    2. Fallback to alternative tool if primary fails or degrades
    3. Graceful degradation to text-only if voice pipeline fails
    4. Human handoff for critical/unhandled intents
    """
    try:
        # Execute with strict timeout to maintain real-time UX
        response = selected_tool.execute(
            payload=request.payload,
            context=session_state,
            timeout_ms=3000
        )
        
        # Validate response integrity before returning
        if not response.is_valid():
            raise ToolValidationError(f"Invalid response from {selected_tool.name}")
            
        # Update session history for adaptive routing
        session_state.record_execution(selected_tool.name, success=True, latency=response.latency_ms)
        return AgentResponse(success=True, data=response, tool=selected_tool.name)
        
    except TimeoutError:
        session_state.record_execution(selected_tool.name, success=False, latency=3000)
        return _apply_pipecat_fallback(selected_tool, fallback_chain, request, session_state)
        
    except ToolValidationError as e:
        session_state.record_execution(selected_tool.name, success=False, latency=0)
        raise AgentExecutionError(f"Pipeline validation failed: {e}") from e
        
    except Exception as e:
        session_state.record_execution(selected_tool.name, success=False, latency=0)
        return _apply_pipecat_fallback(selected_tool, fallback_chain, request, session_state)

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 |

|---|---|

| langgraph-implementation | Provides LangGraph-specific implementation patterns that Pipecat integrates with |

| real-time-audio-processing | Covers audio pipeline design that complements Pipecat's streaming architecture |


Constraints

MUST DO

MUST NOT DO

Live References

Authoritative documentation links for this 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.