ai-agents 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -106
  3. data/docs/Gemfile +14 -0
  4. data/docs/Gemfile.lock +183 -0
  5. data/docs/_config.yml +53 -0
  6. data/docs/_sass/color_schemes/ruby.scss +72 -0
  7. data/docs/_sass/custom/custom.scss +93 -0
  8. data/docs/architecture.md +353 -0
  9. data/docs/assets/fonts/InterVariable.woff2 +0 -0
  10. data/docs/concepts/agent-tool.md +166 -0
  11. data/docs/concepts/agents.md +43 -0
  12. data/docs/concepts/context.md +110 -0
  13. data/docs/concepts/handoffs.md +81 -0
  14. data/docs/concepts/runner.md +87 -0
  15. data/docs/concepts/tools.md +62 -0
  16. data/docs/concepts.md +21 -0
  17. data/docs/guides/agent-as-tool-pattern.md +242 -0
  18. data/docs/guides/multi-agent-systems.md +261 -0
  19. data/docs/guides/rails-integration.md +440 -0
  20. data/docs/guides/state-persistence.md +451 -0
  21. data/docs/guides.md +18 -0
  22. data/docs/index.md +95 -0
  23. data/examples/collaborative-copilot/README.md +169 -0
  24. data/examples/collaborative-copilot/agents/analysis_agent.rb +48 -0
  25. data/examples/collaborative-copilot/agents/answer_suggestion_agent.rb +50 -0
  26. data/examples/collaborative-copilot/agents/copilot_orchestrator.rb +85 -0
  27. data/examples/collaborative-copilot/agents/integrations_agent.rb +58 -0
  28. data/examples/collaborative-copilot/agents/research_agent.rb +52 -0
  29. data/examples/collaborative-copilot/data/contacts.json +47 -0
  30. data/examples/collaborative-copilot/data/conversations.json +170 -0
  31. data/examples/collaborative-copilot/data/knowledge_base.json +58 -0
  32. data/examples/collaborative-copilot/data/linear_issues.json +83 -0
  33. data/examples/collaborative-copilot/data/stripe_billing.json +71 -0
  34. data/examples/collaborative-copilot/interactive.rb +90 -0
  35. data/examples/collaborative-copilot/tools/create_linear_ticket_tool.rb +58 -0
  36. data/examples/collaborative-copilot/tools/get_article_tool.rb +41 -0
  37. data/examples/collaborative-copilot/tools/get_contact_tool.rb +51 -0
  38. data/examples/collaborative-copilot/tools/get_conversation_tool.rb +53 -0
  39. data/examples/collaborative-copilot/tools/get_stripe_billing_tool.rb +44 -0
  40. data/examples/collaborative-copilot/tools/search_contacts_tool.rb +57 -0
  41. data/examples/collaborative-copilot/tools/search_conversations_tool.rb +54 -0
  42. data/examples/collaborative-copilot/tools/search_knowledge_base_tool.rb +55 -0
  43. data/examples/collaborative-copilot/tools/search_linear_issues_tool.rb +60 -0
  44. data/examples/isp-support/agents_factory.rb +57 -1
  45. data/examples/isp-support/tools/create_lead_tool.rb +16 -2
  46. data/examples/isp-support/tools/crm_lookup_tool.rb +13 -1
  47. data/lib/agents/agent.rb +52 -6
  48. data/lib/agents/agent_tool.rb +113 -0
  49. data/lib/agents/handoff.rb +8 -34
  50. data/lib/agents/tool_context.rb +36 -0
  51. data/lib/agents/version.rb +1 -1
  52. data/lib/agents.rb +1 -0
  53. metadata +44 -2
@@ -0,0 +1,169 @@
1
+ # Copilot Agents & Tools
2
+
3
+ This example demonstrates a collaborative multi-agent system for customer support, inspired by Chatwoot's copilot feature. The system uses the agent-as-tool pattern to enable specialized agents to work together behind the scenes.
4
+
5
+ ## Agent Architecture Overview
6
+
7
+ The Chatwoot Copilot system consists of 4 specialized AI agents that work together to assist support agents with customer conversations.
8
+
9
+ ```
10
+ ┌─────────────────────────────────────────┐
11
+ │ Answer Suggestion Agent │
12
+ │ (Primary Entry) │
13
+ └─────────────┬───────────────────────────┘
14
+
15
+ ┌─────────┴─────────┐
16
+ │ │
17
+ ▼ ▼
18
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
19
+ │ Research │ │ Analysis │ │Integration │
20
+ │ Agent │ │ Agent │ │ Agent │
21
+ └─────────────┘ └─────────────┘ └─────────────┘
22
+ ```
23
+
24
+ ---
25
+
26
+ ## 1. Answer Suggestion Agent
27
+
28
+ **Primary Role**: Main interface for support agents seeking assistance
29
+
30
+ ### Responsibilities:
31
+ - Serve as the primary entry point for all agent queries
32
+ - Provide direct answers and draft responses to customer inquiries
33
+ - Suggest appropriate solutions based on available knowledge
34
+ - Route complex queries to specialized agents when needed
35
+ - Synthesize information from multiple sources into actionable advice
36
+
37
+ ### Tools Available:
38
+ - **GetConversationTool**: Retrieve current conversation details and context
39
+ - **GetContactTool**: Access customer profile and contact information
40
+ - **SearchDocumentationTool**: Search help documentation and guides
41
+ - **GetArticleTool**: Retrieve specific knowledge base articles
42
+ - **SearchArticlesTool**: Search across knowledge base content
43
+
44
+ ### When Support Agents Use This:
45
+ - "What should I tell this customer?"
46
+ - "How do I handle this type of issue?"
47
+ - "What's the best response for this situation?"
48
+ - "Can you help me draft a reply?"
49
+
50
+ ---
51
+
52
+ ## 2. Research Agent
53
+
54
+ **Primary Role**: Deep investigation and historical analysis specialist
55
+
56
+ ### Responsibilities:
57
+ - Investigate customer interaction history and patterns
58
+ - Find similar past cases and their resolutions
59
+ - Analyze customer behavior across multiple conversations
60
+ - Provide comprehensive context about customer relationships
61
+ - Identify recurring issues and successful resolution strategies
62
+
63
+ ### Tools Available:
64
+ - **SearchConversationsTool**: Find similar past conversations and cases
65
+ - **SearchContactsTool**: Discover related customers and interaction patterns
66
+ - **GetContactTool**: Retrieve detailed customer profiles and history
67
+
68
+ ### When Support Agents Use This:
69
+ - "What's this customer's history with us?"
70
+ - "How have we handled similar issues before?"
71
+ - "Are there patterns in this customer's behavior?"
72
+ - "What similar cases can help me understand this situation?"
73
+
74
+ ---
75
+
76
+ ## 3. Analysis Agent
77
+
78
+ **Primary Role**: Conversation quality and communication guidance specialist
79
+
80
+ ### Responsibilities:
81
+ - Analyze conversation tone, sentiment, and emotional state
82
+ - Assess conversation health and progress toward resolution
83
+ - Provide communication guidance and tone recommendations
84
+ - Evaluate customer satisfaction indicators
85
+ - Suggest conversation management strategies
86
+
87
+ ### Tools Available:
88
+ - **GetConversationTool**: Analyze current conversation state and progression
89
+
90
+ ### When Support Agents Use This:
91
+ - "How is this conversation going?"
92
+ - "What's the customer's mood/sentiment?"
93
+ - "How should I adjust my communication approach?"
94
+ - "Is this conversation escalating or improving?"
95
+ - "What tone should I use in my response?"
96
+
97
+ ---
98
+
99
+ ## 4. Integrations Agent
100
+
101
+ **Primary Role**: External systems and technical context specialist
102
+
103
+ ### Responsibilities:
104
+ - Provide technical context from development and project management tools
105
+ - Access external system data relevant to customer issues
106
+ - Retrieve billing and subscription information (future)
107
+ - Connect customer issues with known bugs or feature requests
108
+ - Bridge customer support with engineering and product teams
109
+
110
+ ### Tools Available:
111
+ - **SearchLinearIssuesTool**: Search Linear issues for development context and bug reports
112
+
113
+ ### Future Tools (Planned):
114
+ - **GitHubSearchTool**: Repository search for technical context
115
+ - **StripeBillingTool**: Billing and subscription information
116
+ - **SlackIntegrationTool**: Team communication context
117
+
118
+ ### When Support Agents Use This:
119
+ - "Is this a known technical issue?"
120
+ - "Are there any related bug reports?"
121
+ - "What's the development status of this feature?"
122
+ - "Is there billing information relevant to this case?"
123
+
124
+ ---
125
+
126
+ ## Usage Example
127
+
128
+ ```ruby
129
+ # Create the main answer suggestion agent with sub-agents as tools
130
+ answer_agent = Agents::Agent.new(
131
+ name: "AnswerSuggestionAgent",
132
+ instructions: "You help support agents by providing answers and suggestions...",
133
+ tools: [
134
+ research_agent.as_tool(
135
+ name: "research_customer_history",
136
+ description: "Research customer history and similar cases"
137
+ ),
138
+ analysis_agent.as_tool(
139
+ name: "analyze_conversation",
140
+ description: "Analyze conversation tone and sentiment"
141
+ ),
142
+ integrations_agent.as_tool(
143
+ name: "check_technical_context",
144
+ description: "Check for technical issues and development context"
145
+ )
146
+ ]
147
+ )
148
+
149
+ # Support agent asks for help
150
+ result = runner.run(answer_agent, "How should I respond to this angry customer about login issues?")
151
+ ```
152
+
153
+ ## Key Features
154
+
155
+ - **Agent-as-Tool Pattern**: Sub-agents work behind the scenes, no conversation handoffs
156
+ - **Specialized Expertise**: Each agent focuses on specific domain knowledge
157
+ - **State Sharing**: Agents share context through the state mechanism
158
+ - **Composable Architecture**: Easy to add new specialized agents
159
+ - **Thread-Safe**: Safe for concurrent support agent usage
160
+
161
+ ## Running the Example
162
+
163
+ ```bash
164
+ # Set your API key
165
+ export OPENAI_API_KEY="your-key-here"
166
+
167
+ # Run the interactive demo
168
+ ruby examples/collaborative-copilot/interactive.rb
169
+ ```
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../tools/get_conversation_tool"
4
+
5
+ module Copilot
6
+ class AnalysisAgent
7
+ def self.create
8
+ Agents::Agent.new(
9
+ name: "Analysis Agent",
10
+ instructions: analysis_instructions,
11
+ model: "gpt-4o-mini",
12
+ tools: [
13
+ GetConversationTool.new
14
+ ]
15
+ )
16
+ end
17
+
18
+ def self.analysis_instructions
19
+ <<~INSTRUCTIONS
20
+ You are the Analysis Agent, specialized in conversation quality and communication guidance.
21
+
22
+ **Your available tools:**
23
+ - `get_conversation`: Retrieve conversation details and messages for analysis
24
+
25
+ **Your primary role is to:**
26
+ - Analyze conversation tone, sentiment, and emotional state
27
+ - Assess conversation health and progress toward resolution
28
+ - Provide communication guidance and tone recommendations
29
+ - Evaluate customer satisfaction indicators
30
+
31
+ **Analysis workflow:**
32
+ 1. Use `get_conversation` to retrieve the full conversation history
33
+ 2. Analyze the emotional trajectory and communication patterns
34
+ 3. Assess how well the conversation is progressing
35
+ 4. Identify any escalation risks or satisfaction issues
36
+
37
+ **Provide analysis in this format:**
38
+ - **Conversation Health**: Overall assessment of how the conversation is going
39
+ - **Customer Sentiment**: Current emotional state and any changes over time
40
+ - **Communication Quality**: How well the agent is handling the situation
41
+ - **Risk Assessment**: Any signs of escalation or dissatisfaction
42
+ - **Tone Recommendations**: Suggested communication approach and tone
43
+
44
+ Focus on practical communication advice that will improve the interaction.
45
+ INSTRUCTIONS
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../tools/get_conversation_tool"
4
+ require_relative "../tools/get_contact_tool"
5
+ require_relative "../tools/search_knowledge_base_tool"
6
+ require_relative "../tools/get_article_tool"
7
+
8
+ module Copilot
9
+ class AnswerSuggestionAgent
10
+ def self.create
11
+ Agents::Agent.new(
12
+ name: "Answer Suggestion Agent",
13
+ instructions: answer_suggestion_instructions,
14
+ model: "gpt-4o-mini",
15
+ tools: [
16
+ GetConversationTool.new,
17
+ GetContactTool.new,
18
+ SearchKnowledgeBaseTool.new,
19
+ GetArticleTool.new
20
+ ]
21
+ )
22
+ end
23
+
24
+ def self.answer_suggestion_instructions
25
+ <<~INSTRUCTIONS
26
+ You are the Answer Suggestion Agent, the main interface for support agents seeking assistance.
27
+
28
+ **Your available tools:**
29
+ - `get_conversation`: Retrieve current conversation details and context
30
+ - `get_contact`: Access customer profile and contact information#{" "}
31
+ - `search_knowledge_base`: Search help documentation and guides
32
+ - `get_article`: Retrieve specific knowledge base articles
33
+
34
+ **Your primary role is to:**
35
+ - Serve as the primary entry point for all agent queries
36
+ - Provide direct answers and draft responses to customer inquiries
37
+ - Suggest appropriate solutions based on available knowledge
38
+ - Synthesize information from multiple sources into actionable advice
39
+
40
+ **Response workflow:**
41
+ 1. Use `get_conversation` to understand the current situation
42
+ 2. Use `get_contact` to understand the customer background
43
+ 3. Use `search_knowledge_base` to find relevant solutions
44
+ 4. Use `get_article` to get detailed instructions when needed
45
+
46
+ Focus on providing practical, actionable guidance that support agents can immediately use.
47
+ INSTRUCTIONS
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "research_agent"
4
+ require_relative "analysis_agent"
5
+ require_relative "integrations_agent"
6
+ require_relative "answer_suggestion_agent"
7
+
8
+ module Copilot
9
+ class CopilotOrchestrator
10
+ def self.create
11
+ # Create specialized agents
12
+ research_agent = ResearchAgent.create
13
+ analysis_agent = AnalysisAgent.create
14
+ integrations_agent = IntegrationsAgent.create
15
+ answer_suggestion_agent = AnswerSuggestionAgent.create
16
+
17
+ # Create main orchestrator with sub-agents as tools
18
+ Agents::Agent.new(
19
+ name: "Support Copilot",
20
+ instructions: orchestrator_instructions,
21
+ model: "gpt-4o-mini",
22
+ tools: [
23
+ research_agent.as_tool(
24
+ name: "research_customer_history",
25
+ description: "Research customer history, similar cases, and behavioral patterns. Returns contact details including email addresses."
26
+ ),
27
+ analysis_agent.as_tool(
28
+ name: "analyze_conversation",
29
+ description: "Analyze conversation tone, sentiment, and communication quality"
30
+ ),
31
+ integrations_agent.as_tool(
32
+ name: "check_technical_systems",
33
+ description: "Check Linear issues and Stripe billing info. For billing checks, requires customer email address (not contact IDs)."
34
+ ),
35
+ answer_suggestion_agent.as_tool(
36
+ name: "get_knowledge_base_help",
37
+ description: "Search knowledge base and get specific article content"
38
+ )
39
+ ]
40
+ )
41
+ end
42
+
43
+ def self.orchestrator_instructions
44
+ <<~INSTRUCTIONS
45
+ You are the Support Copilot, helping support agents provide excellent customer service.
46
+
47
+ **Your specialist agents:**
48
+ - `research_customer_history`: Deep investigation of customer history and similar cases
49
+ - `analyze_conversation`: Conversation analysis and communication guidance
50
+ - `check_technical_systems`: Technical context from Linear and billing from Stripe
51
+ - `get_knowledge_base_help`: Knowledge base search and documentation retrieval
52
+
53
+ **CRITICAL: Multi-Step Workflow Approach**
54
+
55
+ For complex queries, you MUST break them down into logical steps and use multiple tools in sequence:
56
+
57
+ 1. **Plan your approach**: What information do you need to gather?
58
+ 2. **Execute steps sequentially**: Use EXACT results from previous tools in subsequent calls
59
+ 3. **Build context progressively**: Each tool call should build on previous findings#{" "}
60
+ 4. **Resolve contradictions**: If tools return conflicting info, investigate further
61
+ 5. **Synthesize comprehensive response**: Combine all findings into actionable guidance
62
+
63
+ **CRITICAL: When using tool results in subsequent calls:**
64
+ - Extract specific values (emails, IDs, names) from previous tool outputs
65
+ - Use those EXACT values in your next tool call
66
+ - Don't just pass the original query parameters forward
67
+
68
+ **DON'T:**
69
+ - Make single tool calls for complex queries that need multiple pieces of information
70
+ - Pass original parameters instead of discovered values to subsequent tools
71
+ - Ignore contradictory results from different tools
72
+
73
+ **DO:**
74
+ - Use multiple tools sequentially with progressive information building
75
+ - Extract and use specific values from previous tool results in next calls
76
+ - Investigate discrepancies between different data sources
77
+ - Plan your information gathering strategy before executing
78
+
79
+ Always think: "What specific information did I just learn, and how do I use it in my next step?"
80
+
81
+ Provide clear, actionable guidance. Be concise but thorough. Focus on helping the support agent succeed.
82
+ INSTRUCTIONS
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../tools/search_linear_issues_tool"
4
+ require_relative "../tools/create_linear_ticket_tool"
5
+ require_relative "../tools/get_stripe_billing_tool"
6
+
7
+ module Copilot
8
+ class IntegrationsAgent
9
+ def self.create
10
+ Agents::Agent.new(
11
+ name: "Integrations Agent",
12
+ instructions: integrations_instructions,
13
+ model: "gpt-4o-mini",
14
+ tools: [
15
+ SearchLinearIssuesTool.new,
16
+ CreateLinearTicketTool.new,
17
+ GetStripeBillingTool.new
18
+ ]
19
+ )
20
+ end
21
+
22
+ def self.integrations_instructions
23
+ <<~INSTRUCTIONS
24
+ You are the Integrations Agent, specialized in external systems and technical context.
25
+
26
+ **Your available tools:**
27
+ - `search_linear_issues`: Search Linear for bug reports and development context
28
+ - `create_linear_ticket`: Create new Linear tickets for engineering issues
29
+ - `get_stripe_billing`: Retrieve customer billing information from Stripe (REQUIRES customer email address)
30
+
31
+ **Your primary role is to:**
32
+ - Provide technical context from development and project management tools
33
+ - Access external system data relevant to customer issues
34
+ - Create engineering tickets for bugs or feature requests
35
+ - Retrieve billing and subscription information
36
+ - Bridge customer support with engineering and product teams
37
+
38
+ **CRITICAL: Billing Information Requirements**
39
+ - For Stripe billing lookups, you MUST have the customer's email address
40
+ - Contact IDs, names, or phone numbers will NOT work for billing queries
41
+ - If you don't have an email address, clearly state that you need it for billing information
42
+
43
+ **Integration workflow:**
44
+ 1. Use `search_linear_issues` to check for known bugs or related issues
45
+ 2. For billing queries: Ensure you have a customer email address before using `get_stripe_billing`
46
+ 3. Use `create_linear_ticket` when new engineering work is needed
47
+
48
+ **Provide information in this format:**
49
+ - **Technical Context**: Any relevant bugs, issues, or development work
50
+ - **Billing Information**: Subscription and payment details if relevant
51
+ - **Engineering Actions**: Any tickets created or recommended
52
+ - **Status Updates**: Current status of related development work
53
+
54
+ When creating tickets, be specific about the issue and include relevant customer context.
55
+ INSTRUCTIONS
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../tools/search_conversations_tool"
4
+ require_relative "../tools/search_contacts_tool"
5
+ require_relative "../tools/get_contact_tool"
6
+
7
+ module Copilot
8
+ class ResearchAgent
9
+ def self.create
10
+ Agents::Agent.new(
11
+ name: "Research Agent",
12
+ instructions: research_instructions,
13
+ model: "gpt-4o-mini",
14
+ tools: [
15
+ SearchConversationsTool.new,
16
+ SearchContactsTool.new,
17
+ GetContactTool.new
18
+ ]
19
+ )
20
+ end
21
+
22
+ def self.research_instructions
23
+ <<~INSTRUCTIONS
24
+ You are the Research Agent, specialized in deep investigation and historical analysis.
25
+
26
+ **Your available tools:**
27
+ - `search_conversations`: Find similar past conversations and cases
28
+ - `search_contacts`: Discover related customers and interaction patterns#{" "}
29
+ - `get_contact`: Retrieve detailed customer profiles and history
30
+
31
+ **Your primary role is to:**
32
+ - Investigate customer interaction history and patterns
33
+ - Find similar past cases and their resolutions
34
+ - Analyze customer behavior across multiple conversations
35
+ - Provide comprehensive context about customer relationships
36
+
37
+ **Research workflow:**
38
+ 1. Use `search_conversations` to find similar issues and resolutions
39
+ 2. Use `get_contact` to understand customer background and history
40
+ 3. Use `search_contacts` to find patterns with similar customers if needed
41
+
42
+ **Provide findings in this format:**
43
+ - **Customer Background**: Key details about the customer
44
+ - **Similar Cases**: Past conversations with similar issues and how they were resolved
45
+ - **Patterns**: Any recurring issues or behavioral patterns
46
+ - **Recommendations**: Suggested approach based on historical data
47
+
48
+ Be thorough but concise. Focus on actionable insights.
49
+ INSTRUCTIONS
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,47 @@
1
+ {
2
+ "CONTACT-123": {
3
+ "id": "CONTACT-123",
4
+ "name": "John Smith",
5
+ "email": "john.smith@example.com",
6
+ "phone": "+1-555-0123",
7
+ "company": "Acme Corp",
8
+ "plan": "Pro",
9
+ "created_at": "2023-12-01T08:00:00Z",
10
+ "total_conversations": 5,
11
+ "satisfaction_score": 4.2,
12
+ "tags": ["enterprise", "frequent-user"],
13
+ "notes": "Long-time customer, usually has technical questions",
14
+ "last_login": "2024-01-14T16:30:00Z",
15
+ "account_status": "active"
16
+ },
17
+ "CONTACT-456": {
18
+ "id": "CONTACT-456",
19
+ "name": "Sarah Johnson",
20
+ "email": "sarah.j@startup.io",
21
+ "phone": "+1-555-0456",
22
+ "company": "StartupCo",
23
+ "plan": "Basic",
24
+ "created_at": "2024-01-01T12:00:00Z",
25
+ "total_conversations": 2,
26
+ "satisfaction_score": 4.8,
27
+ "tags": ["new-customer", "billing"],
28
+ "notes": "New customer, had billing confusion initially",
29
+ "last_login": "2024-01-11T10:15:00Z",
30
+ "account_status": "active"
31
+ },
32
+ "CONTACT-789": {
33
+ "id": "CONTACT-789",
34
+ "name": "Mike Chen",
35
+ "email": "mike.chen@techfirm.com",
36
+ "phone": "+1-555-0789",
37
+ "company": "TechFirm Inc",
38
+ "plan": "Enterprise",
39
+ "created_at": "2023-06-15T14:30:00Z",
40
+ "total_conversations": 12,
41
+ "satisfaction_score": 3.9,
42
+ "tags": ["enterprise", "integration-issues"],
43
+ "notes": "Technical lead, often reports bugs and requests features",
44
+ "last_login": "2024-01-13T11:45:00Z",
45
+ "account_status": "active"
46
+ }
47
+ }
@@ -0,0 +1,170 @@
1
+ {
2
+ "CONV-001": {
3
+ "id": "CONV-001",
4
+ "contact_id": "CONTACT-123",
5
+ "status": "open",
6
+ "subject": "Login Issues",
7
+ "created_at": "2024-01-15T10:30:00Z",
8
+ "messages": [
9
+ {
10
+ "role": "customer",
11
+ "content": "I can't log into my account! This is frustrating.",
12
+ "timestamp": "2024-01-15T10:30:00Z"
13
+ },
14
+ {
15
+ "role": "agent",
16
+ "content": "I'm sorry to hear you're having trouble. Let me help you with that.",
17
+ "timestamp": "2024-01-15T10:32:00Z"
18
+ },
19
+ {
20
+ "role": "customer",
21
+ "content": "I've tried resetting my password 3 times already!",
22
+ "timestamp": "2024-01-15T10:35:00Z"
23
+ },
24
+ {
25
+ "role": "agent",
26
+ "content": "I understand your frustration. Let me check your account status first. Can you confirm your email address?",
27
+ "timestamp": "2024-01-15T10:36:00Z"
28
+ },
29
+ {
30
+ "role": "customer",
31
+ "content": "Yes, it's john.smith@example.com",
32
+ "timestamp": "2024-01-15T10:37:00Z"
33
+ },
34
+ {
35
+ "role": "agent",
36
+ "content": "Thank you. I can see your account is active. The issue might be browser-related. Have you tried clearing your cache?",
37
+ "timestamp": "2024-01-15T10:38:00Z"
38
+ },
39
+ {
40
+ "role": "customer",
41
+ "content": "No, I haven't. How do I do that?",
42
+ "timestamp": "2024-01-15T10:39:00Z"
43
+ }
44
+ ],
45
+ "tags": ["login", "password-reset", "frustrated-customer", "browser-cache"]
46
+ },
47
+ "CONV-002": {
48
+ "id": "CONV-002",
49
+ "contact_id": "CONTACT-456",
50
+ "status": "resolved",
51
+ "subject": "Billing Question",
52
+ "created_at": "2024-01-10T14:20:00Z",
53
+ "messages": [
54
+ {
55
+ "role": "customer",
56
+ "content": "Why was I charged twice this month?",
57
+ "timestamp": "2024-01-10T14:20:00Z"
58
+ },
59
+ {
60
+ "role": "agent",
61
+ "content": "Let me check your billing history for you.",
62
+ "timestamp": "2024-01-10T14:22:00Z"
63
+ },
64
+ {
65
+ "role": "customer",
66
+ "content": "I see charges for $29.99 on both January 5th and January 10th",
67
+ "timestamp": "2024-01-10T14:23:00Z"
68
+ },
69
+ {
70
+ "role": "agent",
71
+ "content": "I found the issue - there was a duplicate charge due to a payment processing error. I've processed a refund for the January 10th charge.",
72
+ "timestamp": "2024-01-10T14:25:00Z"
73
+ },
74
+ {
75
+ "role": "customer",
76
+ "content": "How long will the refund take?",
77
+ "timestamp": "2024-01-10T14:26:00Z"
78
+ },
79
+ {
80
+ "role": "agent",
81
+ "content": "Refunds typically appear in 3-5 business days. You'll receive an email confirmation shortly.",
82
+ "timestamp": "2024-01-10T14:27:00Z"
83
+ },
84
+ {
85
+ "role": "customer",
86
+ "content": "Thank you so much! That resolves it.",
87
+ "timestamp": "2024-01-10T14:28:00Z"
88
+ }
89
+ ],
90
+ "tags": ["billing", "refund", "resolved", "duplicate-charge"],
91
+ "resolution": "Processed refund for duplicate charge - $29.99 refunded"
92
+ },
93
+ "CONV-003": {
94
+ "id": "CONV-003",
95
+ "contact_id": "CONTACT-123",
96
+ "status": "resolved",
97
+ "subject": "Feature Request",
98
+ "created_at": "2024-01-05T09:15:00Z",
99
+ "messages": [
100
+ {
101
+ "role": "customer",
102
+ "content": "Can you add dark mode to the app?",
103
+ "timestamp": "2024-01-05T09:15:00Z"
104
+ },
105
+ {
106
+ "role": "agent",
107
+ "content": "That's a great suggestion! I'll pass it to our product team.",
108
+ "timestamp": "2024-01-05T09:17:00Z"
109
+ },
110
+ {
111
+ "role": "customer",
112
+ "content": "Is there any timeline for when this might be available?",
113
+ "timestamp": "2024-01-05T09:18:00Z"
114
+ },
115
+ {
116
+ "role": "agent",
117
+ "content": "I don't have a specific timeline, but I've added your request to our feature backlog with high priority since it's been requested by multiple users.",
118
+ "timestamp": "2024-01-05T09:20:00Z"
119
+ },
120
+ {
121
+ "role": "customer",
122
+ "content": "Great! I'll keep an eye out for updates.",
123
+ "timestamp": "2024-01-05T09:21:00Z"
124
+ }
125
+ ],
126
+ "tags": ["feature-request", "dark-mode", "product-feedback"],
127
+ "resolution": "Forwarded to product team - added to high priority backlog"
128
+ },
129
+ "CONV-004": {
130
+ "id": "CONV-004",
131
+ "contact_id": "CONTACT-789",
132
+ "status": "escalated",
133
+ "subject": "API Integration Problems",
134
+ "created_at": "2024-01-12T11:00:00Z",
135
+ "messages": [
136
+ {
137
+ "role": "customer",
138
+ "content": "Our API integration is failing with 500 errors intermittently",
139
+ "timestamp": "2024-01-12T11:00:00Z"
140
+ },
141
+ {
142
+ "role": "agent",
143
+ "content": "I'm sorry to hear about the API issues. Can you provide more details about when these errors occur?",
144
+ "timestamp": "2024-01-12T11:02:00Z"
145
+ },
146
+ {
147
+ "role": "customer",
148
+ "content": "It happens about 20% of the time when we call the /users endpoint. Here's the error: Internal Server Error",
149
+ "timestamp": "2024-01-12T11:04:00Z"
150
+ },
151
+ {
152
+ "role": "agent",
153
+ "content": "Thank you for the details. This sounds like it needs investigation by our engineering team. Let me escalate this to them.",
154
+ "timestamp": "2024-01-12T11:06:00Z"
155
+ },
156
+ {
157
+ "role": "customer",
158
+ "content": "Please do, this is affecting our production system",
159
+ "timestamp": "2024-01-12T11:07:00Z"
160
+ },
161
+ {
162
+ "role": "agent",
163
+ "content": "I've created a high-priority ticket (ENG-445) and our engineering team will investigate immediately. You should hear back within 2 hours.",
164
+ "timestamp": "2024-01-12T11:10:00Z"
165
+ }
166
+ ],
167
+ "tags": ["api", "500-error", "production-issue", "escalated", "engineering"],
168
+ "escalation_ticket": "ENG-445"
169
+ }
170
+ }