Solace Agent Mesh Retail Weather Example

Retail Analytics Example with Solace Agent Mesh

Demo built by Benjamin Gottstein

Introduction

Solace Agent Mesh (SAM) is an innovative platform that enables you to create intelligent, interconnected agents that can work together to solve complex business problems. Think of it as a way to build AI-powered assistants that can access different data sources, analyze information, and provide actionable insights through a wide variety of interfaces (gateways) like chat and events.

In this example, we will walk through building a comprehensive retail analytics example that showcases how multiple specialized agents can collaborate to provide valuable business intelligence. Our example will simulate a DIY retail environment where different agents handle customer data, sales information, product catalogs, and even external data like weather forecasts.

Why Use Agent Mesh for Retail?

Retail businesses typically have data scattered across multiple systems - customer databases, inventory management, sales platforms, and external partners. Solace Agent Mesh excels in this environment because it allows you to:

  • Connect disparate data sources through specialized agents

  • Perform complex analytics using natural language queries

  • Generate actionable insights by combining multiple data streams

  • Create dynamic reports that adapt to changing business needs

  • Leverage external data like weather forecasts for demand planning

What We Will Build

Our retail example will feature four specialized agents:

  1. Customer SQL Agent - Manages customer demographics and profiles

  2. Sales SQL Agent - Handles transaction data and sales analytics

  3. Product SQL Agent - Maintains product catalog and inventory information

  4. Geo-Weather Agent - Provides location-based weather forecasts for demand planning

By the end of this example, you will be able to ask questions like “Show me the worst-performing products and create a sales strategy based on next week’s weather forecast” and get comprehensive, data-driven responses.

Prerequisites

Before we begin, make sure you have:

Download Example Files

To get started quickly, download the sample configuration and data files:

product_master.csv (3.9 KB)
customer_data.csv (7.2 KB)
sales_orders.csv (5.8 KB)
geo-weather.yaml (3.5 KB)
customers-sql-agent.yaml (6.3 KB)
products-sql-agent.yaml (6.3 KB)
sales-sql-agent.yaml (6.3 KB)

Place the CSV files in your data directory and the YAML files in your <sam-home>/configs/agents directory.

Step 1: Setting Up Your Environment

Create and activate a Python virtual environment and install Solace Agent Mesh according to the official documentation. Once installed, verify your installation by running:


sam --version

Step 2: Installing Required Plugins

SAM uses a plugin-based architecture. We’ll install the SQL database and geo-information plugins:

  1. Open the plugin catalog:

sam plugin catalog

  1. This opens a browser interface. Refresh the page to see available plugins.

  2. Install the sam_sql_database plugin and name it customers-sql-agent

  3. Install the sam_geo_information plugin and name it geo-weather-agent

Step 3: Configuring Your Agents

Setting Up Data Sources

Create a data directory in your SAM home directory and add the three included CSV files that will serve as our retail data sources:

customer_data.csv - Customer demographics and information

product_master.csv - Product catalog with categories, prices, and descriptions

sales_orders.csv - Transaction data linking customers and products

You can generate realistic sample data using AI tools. Here’s an example prompt:

“Create three CSV files for a DIY retailer that are joinable by ID - one for product master data, one for sales orders across Europe from online and store channels, and one for customers with demographics.”

Agent Configuration Files

Place the included YAML configuration files in your <sam-home>/configs/agents directory, replacing the customer-sql-agent.yaml

Environment Variables

To get a free geocoding API key, visit: https://geocode.maps.co/

Set up the following environment variables in your SAM home directory:


export PRODUCTS_SQL_AGENT_DB_TYPE="sqlite"

export PRODUCTS_SQL_AGENT_DB_NAME="products-db"

export SALES_SQL_AGENT_DB_TYPE="sqlite"

export SALES_SQL_AGENT_DB_NAME="sales-db"

export CUSTOMERS_SQL_AGENT_DB_TYPE="sqlite"

export CUSTOMERS_SQL_AGENT_DB_NAME="customers-db"

export GEOCODING_API_KEY="your-api-key-here"

Step 4: Starting Your Agent Mesh

Launch your configured agent mesh:


sam run

Navigate to the SAM web interface localhost:8000 and verify that all four agents appear in the “Agents” tab.

Step 5: Testing Your Retail Example

Now for the exciting part - let’s see our agents in action! Here are some example scenarios to try:

Basic Data Exploration

Start with simple queries to understand your data:


Hi, how can you help me?

Which data do you have available?

Which types of reports could you create?

Retrieve all available data from the databases

Note: These requests can take a while to run depending on the dataset sizes and quantities.

Further Data Exploration with SAM

Weather-Based Demand Forecasting

This scenario demonstrates how external data can enhance retail analytics:


1. "Retrieve the worst performing products from the database - don't analyze them yet"

2. "Provide more detailed analysis for [specific product]"

3. "Compare these products against better-performing ones"

4. "Retrieve the weather forecast for the next 4 days in Germany"

5. "Help me create a plan to boost sales of these products based on the weather forecast"

Customer Demographics Analysis

Explore buying patterns across different customer segments:


1. "Retrieve product, customer and sales data to analyze demographic buying behavior"

2. "Create a diagram showing buying trends of the 26-35 age group per channel"

3. "Add the top 3 products sold per channel in this age group"

4. "Generate a product master data audit report"

Step 6: Understanding Agent Collaboration

One of the most powerful features of this setup is watching how agents collaborate. When you ask a complex question, you’ll see:

  1. Query routing - SAM determines which agents have relevant data

  2. Data retrieval - Multiple agents fetch information simultaneously

  3. Data synthesis - Results are combined and analyzed

  4. Insight generation - Actionable recommendations are provided

Use the Workflow view in the SAM interface to see this collaboration in real-time.

Best Practices for Complex Queries

For optimal performance and results:

  1. Break complex requests into steps - Instead of one massive query, guide the system through your thought process

  2. Be specific about your goals - Tell SAM what kind of analysis or report you’re looking for

  3. Use the Activities view - Monitor how agents are collaborating

  4. Iterate on results - Ask follow-up questions to refine your analysis

Extending Your Agent Mesh

Once you have the basic setup working, consider these enhancements:

Additional Data Sources

  • Inventory levels and stock movements

  • Supplier information and lead times

  • Marketing campaign performance

  • Customer service interactions

Advanced Analytics

  • Seasonal trend analysis

  • Price optimization recommendations

  • Customer lifetime value calculations

  • Inventory turnover analysis

External Integrations

  • Social media sentiment analysis

  • Economic indicators

  • Competitor pricing data

  • Supply chain disruption alerts

Troubleshooting Common Issues

Agents not appearing: Check that your YAML files are in the correct directory and properly formatted.

Database connection errors: Verify your environment variables are set correctly.

API key issues: Ensure your geocoding API key is valid and has sufficient quota.

Slow responses: Start with simpler queries and build complexity gradually.

Conclusion

Congratulations! You’ve built a sophisticated retail analytics system using Solace Agent Mesh. This example showcases how modern businesses can break down data silos and create intelligent, responsive analytics platforms.

Your agent mesh can now:

  • Answer complex business questions in natural language

  • Combine data from multiple sources automatically

  • Generate insights that would typically require multiple tools and manual analysis

  • Adapt to new questions and scenarios without additional programming

Next Steps

Now that you have a working retail example, consider these next steps:

  1. Customize the data - Replace the sample data with information relevant to your industry or use case

  2. Add more agents - Integrate additional data sources or external APIs

  3. Explore advanced features - Investigate SAM’s workflow capabilities and agent orchestration

  4. Share your results - Use this example to showcase the power of agent-based analytics to colleagues or clients

  5. Join the community - Connect with other SAM users to share experiences and learn new techniques

The retail industry is rapidly evolving, and tools like Solace Agent Mesh provide the flexibility and intelligence needed to stay competitive. By democratizing access to complex analytics through natural language interfaces, you’re not just building a example - you’re exploring the future of business intelligence.

Ready to take your agent mesh to the next level? Start experimenting with your own data and use cases, and discover what insights are waiting to be uncovered! Share with us what you build with Solace Agent Mesh.

1 Like