Skip to content

Commit b11c020

Browse files
committed
feat: integrate Foundry agent configuration into multiple services
- Added environment variable support for Foundry agent configuration in the ecommerce catalog search, checkout support, order status, product detail enrichment, inventory alerts triggers, health check, JIT replenishment, reservation validation, logistics carrier selection, ETA computation, returns support, route issue detection, product management services. - Enhanced the BaseRetailAgent to support SLM-first routing with optional LLM upgrade. - Updated the FoundryAgentConfig to include project name and modified the app factory to build service apps with optional SLM and LLM configurations.
1 parent efb7ca3 commit b11c020

File tree

24 files changed

+867
-15
lines changed
  • apps
    • crm-campaign-intelligence/src/crm_campaign_intelligence
    • crm-profile-aggregation/src/crm_profile_aggregation
    • crm-segmentation-personalization/src/crm_segmentation_personalization
    • crm-support-assistance/src/crm_support_assistance
    • ecommerce-cart-intelligence/src/ecommerce_cart_intelligence
    • ecommerce-checkout-support/src/ecommerce_checkout_support
    • ecommerce-order-status/src/ecommerce_order_status
    • ecommerce-product-detail-enrichment/src/ecommerce_product_detail_enrichment
    • inventory-alerts-triggers/src/inventory_alerts_triggers
    • inventory-health-check/src/inventory_health_check
    • inventory-jit-replenishment/src/inventory_jit_replenishment
    • inventory-reservation-validation/src/inventory_reservation_validation
    • logistics-carrier-selection/src/logistics_carrier_selection
    • logistics-eta-computation/src/logistics_eta_computation
    • logistics-returns-support/src/logistics_returns_support
    • logistics-route-issue-detection/src/logistics_route_issue_detection
    • product-management-acp-transformation/src/product_management_acp_transformation
    • product-management-assortment-optimization/src/product_management_assortment_optimization
    • product-management-consistency-validation/src/product_management_consistency_validation
    • product-management-normalization-classification/src/product_management_normalization_classification
  • lib/src/holiday_peak_lib

24 files changed

+867
-15
lines changed

apps/crm-campaign-intelligence/src/crm_campaign_intelligence/main.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""CRM campaign intelligence service."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,38 @@
710

811
SERVICE_NAME = "crm-campaign-intelligence"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
44+
1045
app = build_service_app(
1146
SERVICE_NAME,
1247
agent_class=CampaignIntelligenceAgent,
@@ -20,5 +55,7 @@
2055
memory_settings.blob_account_url,
2156
memory_settings.blob_container,
2257
),
58+
slm_config=slm_config,
59+
llm_config=llm_config,
2360
mcp_setup=register_mcp_tools,
2461
)

apps/crm-profile-aggregation/src/crm_profile_aggregation/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""CRM profile aggregation service."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,37 @@
710

811
SERVICE_NAME = "crm-profile-aggregation"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
1044
app = build_service_app(
1145
SERVICE_NAME,
1246
agent_class=ProfileAggregationAgent,
@@ -20,5 +54,7 @@
2054
memory_settings.blob_account_url,
2155
memory_settings.blob_container,
2256
),
57+
slm_config=slm_config,
58+
llm_config=llm_config,
2359
mcp_setup=register_mcp_tools,
2460
)

apps/crm-segmentation-personalization/src/crm_segmentation_personalization/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""CRM segmentation and personalization service."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -10,6 +13,37 @@
1013

1114
SERVICE_NAME = "crm-segmentation-personalization"
1215
memory_settings = MemorySettings()
16+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
17+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
18+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
19+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
20+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
21+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
22+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
23+
24+
slm_config = (
25+
FoundryAgentConfig(
26+
endpoint=endpoint,
27+
agent_id=slm_agent_id,
28+
deployment_name=slm_deployment,
29+
project_name=project_name,
30+
stream=stream,
31+
)
32+
if endpoint and slm_agent_id
33+
else None
34+
)
35+
36+
llm_config = (
37+
FoundryAgentConfig(
38+
endpoint=endpoint,
39+
agent_id=llm_agent_id,
40+
deployment_name=llm_deployment,
41+
project_name=project_name,
42+
stream=stream,
43+
)
44+
if endpoint and llm_agent_id
45+
else None
46+
)
1347
app = build_service_app(
1448
SERVICE_NAME,
1549
agent_class=SegmentationPersonalizationAgent,
@@ -23,5 +57,7 @@
2357
memory_settings.blob_account_url,
2458
memory_settings.blob_container,
2559
),
60+
slm_config=slm_config,
61+
llm_config=llm_config,
2662
mcp_setup=register_mcp_tools,
2763
)

apps/crm-support-assistance/src/crm_support_assistance/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""CRM support assistance service."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,37 @@
710

811
SERVICE_NAME = "crm-support-assistance"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
1044
app = build_service_app(
1145
SERVICE_NAME,
1246
agent_class=SupportAssistanceAgent,
@@ -20,5 +54,7 @@
2054
memory_settings.blob_account_url,
2155
memory_settings.blob_container,
2256
),
57+
slm_config=slm_config,
58+
llm_config=llm_config,
2359
mcp_setup=register_mcp_tools,
2460
)

apps/ecommerce-cart-intelligence/src/ecommerce_cart_intelligence/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""Ecommerce Cart Intelligence service entrypoint."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,37 @@
710

811
SERVICE_NAME = "ecommerce-cart-intelligence"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
1044
app = build_service_app(
1145
SERVICE_NAME,
1246
agent_class=CartIntelligenceAgent,
@@ -20,5 +54,7 @@
2054
memory_settings.blob_account_url,
2155
memory_settings.blob_container,
2256
),
57+
slm_config=slm_config,
58+
llm_config=llm_config,
2359
mcp_setup=register_mcp_tools,
2460
)

apps/ecommerce-catalog-search/src/ecommerce_catalog_search/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""Ecommerce Catalog Search service entrypoint."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,37 @@
710

811
SERVICE_NAME = "ecommerce-catalog-search"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
1044
app = build_service_app(
1145
SERVICE_NAME,
1246
agent_class=CatalogSearchAgent,
@@ -20,5 +54,7 @@
2054
memory_settings.blob_account_url,
2155
memory_settings.blob_container,
2256
),
57+
slm_config=slm_config,
58+
llm_config=llm_config,
2359
mcp_setup=register_mcp_tools,
2460
)

apps/ecommerce-checkout-support/src/ecommerce_checkout_support/main.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""Ecommerce Checkout Support service entrypoint."""
2+
import os
3+
4+
from holiday_peak_lib.agents import FoundryAgentConfig
25
from holiday_peak_lib.agents.memory import ColdMemory, HotMemory, WarmMemory
36
from holiday_peak_lib.app_factory import build_service_app
47
from holiday_peak_lib.config import MemorySettings
@@ -7,6 +10,37 @@
710

811
SERVICE_NAME = "ecommerce-checkout-support"
912
memory_settings = MemorySettings()
13+
endpoint = os.getenv("PROJECT_ENDPOINT") or os.getenv("FOUNDRY_ENDPOINT")
14+
project_name = os.getenv("PROJECT_NAME") or os.getenv("FOUNDRY_PROJECT_NAME")
15+
stream = (os.getenv("FOUNDRY_STREAM") or "").lower() in {"1", "true", "yes"}
16+
slm_agent_id = os.getenv("FOUNDRY_AGENT_ID_FAST")
17+
llm_agent_id = os.getenv("FOUNDRY_AGENT_ID_RICH")
18+
slm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_FAST")
19+
llm_deployment = os.getenv("MODEL_DEPLOYMENT_NAME_RICH")
20+
21+
slm_config = (
22+
FoundryAgentConfig(
23+
endpoint=endpoint,
24+
agent_id=slm_agent_id,
25+
deployment_name=slm_deployment,
26+
project_name=project_name,
27+
stream=stream,
28+
)
29+
if endpoint and slm_agent_id
30+
else None
31+
)
32+
33+
llm_config = (
34+
FoundryAgentConfig(
35+
endpoint=endpoint,
36+
agent_id=llm_agent_id,
37+
deployment_name=llm_deployment,
38+
project_name=project_name,
39+
stream=stream,
40+
)
41+
if endpoint and llm_agent_id
42+
else None
43+
)
1044
app = build_service_app(
1145
SERVICE_NAME,
1246
agent_class=CheckoutSupportAgent,
@@ -20,5 +54,7 @@
2054
memory_settings.blob_account_url,
2155
memory_settings.blob_container,
2256
),
57+
slm_config=slm_config,
58+
llm_config=llm_config,
2359
mcp_setup=register_mcp_tools,
2460
)

0 commit comments

Comments
 (0)