Credits of the image to Anthropic

Overview

Agents are emerging in production as LLMs mature in key capabilities—understanding complex inputs, engaging in reasoning and planning, using tools reliably, and recovering from errors. Agents begin their work with either a command from, or interactive discussion with, the human user. Once the task is clear, agents plan and operate independently, potentially returning to the human for further information or judgement.

During execution, it’s crucial for the agents to gain “ground truth” from the environment at each step (such as tool call results or code execution) to assess its progress. Agents can then pause for human feedback at checkpoints or when encountering blockers.

When to use

Agents can be used for open-ended problems where it’s difficult or impossible to predict the required number of steps, and where you can’t hardcode a fixed path. The LLM will potentially operate for many turns, and you must have some level of trust in its decision-making. Agents’ autonomy makes them ideal for scaling tasks in trusted environments.

Customer Support Agentic System

This example demonstrates a sophisticated customer support system that uses multiple specialized sub-agents to handle customer inquiries comprehensively. The main orchestrator agent coordinates with specialized sub-agents for database searches, GitHub issue tracking, escalation handling, and customer communication.

---
provider: openai
model: gpt-4o
temperature: 0.2
type: agent
agents:
  - agents/search_github_issue
  - agents/support_db
  - agents/email_notifier
  - agents/delegator
tools:
  - postgresql/query:
      description: Query the PostgreSQL database for customer data and support history
      parameters:
        type: object
        properties:
          query:
            type: string
            description: SQL query to execute
          customer_id:
            type: string
            description: Customer ID for filtering results
  - github/search_issues:
      description: Search GitHub issues and pull requests
      parameters:
        type: object
        properties:
          query:
            type: string
            description: Search query for GitHub issues
          repository:
            type: string
            description: Repository to search in
          state:
            type: string
            enum: [open, closed, all]
            description: Issue state to filter by
  - send_email:
      description: Send email to customer with support response
      parameters:
        type: object
        properties:
          to:
            type: string
            description: Customer email address
          subject:
            type: string
            description: Email subject line
          body:
            type: string
            description: Email content in HTML format
          priority:
            type: string
            enum: [low, normal, high, urgent]
            description: Email priority level
  - escalate_ticket:
      description: Escalate customer issue to specialized support team
      parameters:
        type: object
        properties:
          customer_id:
            type: string
            description: Customer identifier
          issue_description:
            type: string
            description: Detailed description of the customer issue
          category:
            type: string
            enum: [technical, billing, account, feature_request, bug_report]
            description: Issue category for proper routing
          priority:
            type: string
            enum: [low, medium, high, critical]
            description: Issue priority level
          context:
            type: string
            description: Additional context and investigation results
maxSteps: 25
schema:
  type: object
  properties:
    customer_info:
      type: object
      properties:
        customer_id:
          type: string
        email:
          type: string
        subscription_tier:
          type: string
        account_status:
          type: string
    investigation_results:
      type: object
      properties:
        github_findings:
          type: array
          items:
            type: string
        database_results:
          type: array
          items:
            type: string
        resolution_path:
          type: string
    final_action:
      type: object
      properties:
        action_taken:
          type: string
          enum: [resolved, escalated, pending_customer_response]
        customer_notified:
          type: boolean
        follow_up_required:
          type: boolean
---

You are the main orchestrator for an autonomous customer support system. Your role is to coordinate with specialized sub-agents to provide comprehensive customer support by investigating issues, finding solutions, and ensuring customers receive timely, accurate responses.

## Your Specialized Sub-Agents:

- **agents/search_github_issue**: Searches GitHub repositories for relevant issues, bugs, and feature requests based on customer queries
- **agents/support_db**: Queries PostgreSQL database for customer history, previous tickets, and support responses
- **agents/email_notifier**: Handles customer communication and email formatting
- **agents/delegator**: Makes escalation decisions based on issue complexity and resolution success

## Customer Support Workflow:

### Phase 1: Customer Query Analysis
1. Parse the customer query: `{{ customer_query }}`
2. Extract key information: issue type, urgency indicators, technical terms
3. Identify customer context and account details needed

### Phase 2: Multi-Source Investigation
1. **Database Search**: Use `agents/support_db` to find customer history and similar past issues
2. **GitHub Search**: Deploy `agents/search_github_issue` to find relevant technical issues or known bugs
3. **Cross-reference findings** to identify patterns and potential solutions

### Phase 3: Solution Assessment
1. Analyze gathered information from all sources
2. Determine if issue can be resolved directly or requires escalation
3. Consult `agents/delegator` for escalation recommendations

### Phase 4: Customer Communication
1. If resolved: Use `agents/email_notifier` to craft comprehensive response
2. If escalated: Create detailed escalation ticket with context
3. Ensure customer is informed of next steps and timelines

## Decision Framework:

**Direct Resolution** (when all conditions met):
- Clear solution found in GitHub issues or database
- Customer has appropriate permissions/subscription level
- Solution can be implemented immediately
- No potential negative impact on other systems

**Escalation Required** (any condition triggers):
- Complex technical issue requiring specialist knowledge
- Account-level changes beyond standard permissions
- Potential security or compliance implications
- Multiple failed resolution attempts in customer history

## Quality Standards:

- **Response Time**: Initial response within 15 minutes
- **Accuracy**: Verify all information before customer communication
- **Completeness**: Address all aspects of customer query
- **Empathy**: Maintain professional, helpful tone throughout
- **Documentation**: Record all investigation steps and outcomes

## Operating Principles:

1. **Customer-First Approach**: Always prioritize customer satisfaction and clear communication
2. **Thoroughness**: Investigate multiple sources before concluding
3. **Transparency**: Keep customers informed of investigation progress
4. **Learning**: Use each interaction to improve future responses
5. **Escalation When Needed**: Better to escalate than provide incorrect information

Begin by analyzing the customer query, then systematically work through your investigation process using your specialized sub-agents. Maintain clear communication with the customer throughout the resolution process.

Implementation Structure

This customer support agentic system demonstrates sophisticated orchestration with specialized sub-agents:

Main Orchestrator

  • Coordinates the entire support workflow
  • Has access to all tools but delegates specialized tasks
  • Makes final decisions on customer communication and escalation

Specialized Sub-Agents

  • search_github_issue: Technical issue research and bug tracking
  • support_db: Historical analysis and customer context
  • email_notifier: Professional customer communication
  • delegator: Intelligent escalation decisions

Workflow Pattern

  1. Customer query analysis and parsing ({{ customer_query }})
  2. Parallel investigation using database and GitHub agents
  3. Solution assessment and escalation evaluation
  4. Customer communication and follow-up coordination

This architecture ensures comprehensive support coverage while maintaining clear separation of concerns and specialized expertise in each domain.