Agent workflow

From NaveedTechLab/skills-library · View interactive version

Agent workflow is an AI agent skill from the GitHub repository NaveedTechLab/skills-library. Implements the core Customer Success Agent using OpenAI Agents SDK. Manages the orchestration of tool calls (search, ticket creation, etc.), conversation logic, and state management. Use when Claude needs to create or modify Customer Success Agent implementations with OpenAI Agents SDK, orchestrate

How to use this skill

Skill file

Customer Success Agent Workflow Skill

This skill provides guidance for implementing the core Customer Success Agent using OpenAI Agents SDK, focusing on orchestration of tool calls, conversation logic, and state management.

Overview

The Customer Success Agent is responsible for:

Key Components

1. Agent Architecture

The Customer Success Agent follows this architecture:

from openai import OpenAI
from typing import Dict, Any, List
import json

class CustomerSuccessAgent:
    def __init__(self, api_key: str, model: str = "gpt-4-turbo"):
        self.client = OpenAI(api_key=api_key)
        self.model = model
        self.conversation_history = []
        self.state_manager = StateManager()

    def process_message(self, user_input: str, customer_id: str) -> str:
        # Process user input and return response
        pass

2. Tool Orchestration

The agent orchestrates multiple tools to serve customer needs:

3. Conversation Logic

Implement conversation flow management:

4. State Management

Maintain state across conversations:

Implementation Guidelines

Tool Definition and Registration

Define tools with clear schemas:

def search_knowledge_base(query: str, category: str = None) -> List[Dict]:
    """
    Search the knowledge base for relevant articles.

    Args:
        query: Search query
        category: Category to filter by (optional)

    Returns:
        List of relevant articles
    """
    # Implementation here
    pass

def create_customer_ticket(
    customer_id: str,
    subject: str,
    description: str,
    priority: str = "medium"
) -> Dict:
    """
    Create a support ticket for the customer.

    Args:
        customer_id: Unique customer identifier
        subject: Ticket subject
        description: Detailed description
        priority: Priority level

    Returns:
        Created ticket information
    """
    # Implementation here
    pass

State Management Patterns

Use a state manager to persist conversation context:

class StateManager:
    def __init__(self):
        self.customer_states = {}

    def get_state(self, customer_id: str) -> Dict[str, Any]:
        """Retrieve customer state"""
        return self.customer_states.get(customer_id, {})

    def update_state(self, customer_id: str, updates: Dict[str, Any]):
        """Update customer state with new information"""
        if customer_id not in self.customer_states:
            self.customer_states[customer_id] = {}
        self.customer_states[customer_id].update(updates)

    def clear_state(self, customer_id: str):
        """Clear customer state when conversation ends"""
        if customer_id in self.customer_states:
            del self.customer_states[customer_id]

Conversation Flow Control

Implement conversation logic to manage complex interactions:

class ConversationFlow:
    def __init__(self):
        self.active_intents = {}

    def classify_intent(self, user_input: str) -> str:
        """Classify the user's intent"""
        # Implementation using NLP or rule-based classification
        pass

    def handle_intent(self, intent: str, params: Dict) -> str:
        """Handle specific intent with parameters"""
        # Implementation for each intent type
        pass

Best Practices

Error Handling

Security Considerations

Performance Optimization

Reference Files

For detailed implementation patterns, see:

When NOT to Use This Skill

Common Mistakes

Related Skills

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.