stackConsult commited on
Commit
97376e1
·
verified ·
1 Parent(s): 9e10bc3

Integrate DataEnrichmentManager into outreach_agent - add enrichment to contact validation

Browse files
Files changed (1) hide show
  1. outreach_agent.py +16 -2
outreach_agent.py CHANGED
@@ -2,17 +2,19 @@ import logging
2
  from typing import Dict, Any, Optional, List, Callable
3
  # Import lead_scoring_agent for lead scoring integration
4
  from lead_scoring_agent import score_lead
 
5
 
6
  class OutreachAgent:
7
  """
8
  OutreachAgent handles lead intake, message tailoring, and multi-channel delivery.
9
  Integrates lead_scoring_agent to score leads at intake for prioritization and routing.
10
  """
11
- def __init__(self, channel_handlers: Optional[Dict[str, Callable]]=None):
12
- self.logger = logging.getLogger("OutreachAgent")
13
  self.lead_assets = {}
14
  self.analytics = []
15
  self.channel_handlers = channel_handlers or {}
 
 
16
 
17
  def intake_lead(self, lead_profile: Dict[str, Any]) -> Dict[str, Any]:
18
  """
@@ -35,6 +37,18 @@ class OutreachAgent:
35
  def validate_and_enrich_profile(self, profile: Dict[str, Any]) -> Dict[str, Any]:
36
  # Enrich with historical, persona, engagements, etc.
37
  # Preserve scoring metadata from lead_scoring_agent
 
 
 
 
 
 
 
 
 
 
 
 
38
  required_fields = ['persona', 'channel_fit']
39
  for field in required_fields:
40
  if field not in profile:
 
2
  from typing import Dict, Any, Optional, List, Callable
3
  # Import lead_scoring_agent for lead scoring integration
4
  from lead_scoring_agent import score_lead
5
+ from data_enrichment import DataEnrichmentManager
6
 
7
  class OutreachAgent:
8
  """
9
  OutreachAgent handles lead intake, message tailoring, and multi-channel delivery.
10
  Integrates lead_scoring_agent to score leads at intake for prioritization and routing.
11
  """
12
+ def __init__(self, username: str, channel_handlers: Optional[Dict[str, Callable]]=None): self.logger = logging.getLogger("OutreachAgent")
 
13
  self.lead_assets = {}
14
  self.analytics = []
15
  self.channel_handlers = channel_handlers or {}
16
+ self.username = username
17
+ self.enrichment_manager = DataEnrichmentManager(username)
18
 
19
  def intake_lead(self, lead_profile: Dict[str, Any]) -> Dict[str, Any]:
20
  """
 
37
  def validate_and_enrich_profile(self, profile: Dict[str, Any]) -> Dict[str, Any]:
38
  # Enrich with historical, persona, engagements, etc.
39
  # Preserve scoring metadata from lead_scoring_agent
40
+
41
+ # ENRICHMENT STEP: Use DataEnrichmentManager to enrich profile with 14 APIs
42
+ try:
43
+ enriched_data = self.enrichment_manager.enrich_contact_full(profile)
44
+ if enriched_data:
45
+ # Merge enriched data into profile (preserve existing fields)
46
+ for key, value in enriched_data.items():
47
+ if key not in profile or not profile[key]: # Only update if field is missing
48
+ profile[key] = value
49
+ self.logger.info(f"Profile enriched with {len(enriched_data)} data sources")
50
+ except Exception as e:
51
+ self.logger.warning(f"Enrichment failed: {e}. Continuing with available data.")
52
  required_fields = ['persona', 'channel_fit']
53
  for field in required_fields:
54
  if field not in profile: