Artificial Intelligence

For any service-based business—from commercial cleaning to landscaping —revenue volatility is a constant. When revenue drops 70% month-over-month, standard BI dashboards are great at telling you what happened, but fall short of explaining why. Was it a failed marketing campaign, a seasonal slump, or an operational bottleneck? Answering this requires a manual, time-consuming data-pulling and analysis process.
This post details how we built a "Marketing Analyst Agent" using the AWS Strands SDK to automate this root cause analysis. This agent moves beyond simple data reporting to autonomously diagnose the underlying drivers of business performance, providing clear, evidence-backed insights on demand.
We selected AWS Strands for several key reasons that make it ideal for developing production-ready, customizable AI agents:
Tracing is a fundamental component of the Strands SDK's observability framework, providing detailed insights into the agent's execution. Using the OpenTelemetry standard, Strands captures the complete journey of a request, including every LLM interaction, tool call, and processing step.
For our project, we used Langfuse, an OpenTelemetry-compatible platform, to visualize these traces. This gave us a hierarchical view of the agent's execution, allowing us to:
As seen in our Langfuse dashboard, the trace for a single query like "invoke_agent Strands Agents" provides a clear, visual breakdown of the Agentic Loop. We can see the agent executing its plan, making sequential calls to tools like execute_tool_run_sql, and processing the results. This level of transparency is invaluable for identifying performance bottlenecks and ensuring the agent behaves as expected

At the heart of Strands is the Agentic Loop, the iterative process that enables the agent to function autonomously. Instead of following a predefined script, the agent cycles through a loop of reasoning, acting, and observing until it completes its task.8 For a complex query, this looks like:
This loop is what allows the agent to handle complex, multi-step analyses that would otherwise require a human analyst.
To give our agent the ability to both retrieve and analyze data, we designed a clean, two-tool architecture. The tools are simple Python functions exposed to the agent using the @tool decorator.

To validate the agent, we generated a synthetic dataset modeling the operations of a multi-location cleaning service, complete with seasonal trends and marketing campaign variables.
User Prompt: agent.ask("Why was cleaning revenue down in Seattle during February 2024?")
**#1. Dramatic Drop in Job Volume (Primary Factor)**
- February 2024: **8 jobs** vs January 2024: **20 jobs** (60% decrease)
- **Confidence: High** - Job count is directly measurable and clearly shows the primary issue
**#2. Revenue Impact Analysis**
- February 2024 revenue: **$1,577.46** (down 71% from January's $5,367.34)
- Average revenue per job was also lower: **$197.18** vs January's **$268.37** (26% decrease)
- **Confidence: High** - Clear mathematical relationship
**#3. Marketing Campaign Performance**
- February had significantly fewer campaign-driven jobs: **2 campaign jobs** vs **7** in January
- **Confidence: High** - Clear reduction in marketing effectiveness
**#4. Weather was NOT a Factor**
- February 2024 and 2023 had nearly identical weather patterns (avg temp ~10.5°C)
- **Confidence: High** - Weather data rules this out as a cause
**## Root Cause (Most Likely):**
1. **Reduced Marketing Activity**: Only 2 campaign-sourced jobs vs 7 in January suggests marketing campaigns may have been scaled back or performed poorly.
**## Recommendations:**
- Investigate marketing campaign performance and budget allocation for February 2024.
- Analyze technician scheduling and availability.
This output demonstrates the agent's effectiveness. It correctly identified the primary issue (a drop in job volume), traced it back to a specific cause (reduced marketing activity), and, just as importantly, proactively ruled out a plausible but incorrect hypothesis (weather).
Using AWS Strands, we were able to build a powerful analytical agent with a simple, modular architecture. Its code-first, open-source nature provided the flexibility and control we needed, while features like multi-model support and built-in observability make it a production-ready framework. By leveraging the model-driven Agentic Loop to orchestrate a clear separation of concerns—data retrieval (sql_tool) and analysis (ds_tool)—we created a system that can effectively diagnose business problems, moving beyond the limitations of traditional dashboards to provide true causal insights.
Share this:

Part 4 of our series on intent-driven development. Start with Part 1, or read Parts 2 and 3 first if you want the technical workflow before the outcomes. The first three posts in this series covered the mechanics: why the spec is now the source of truth, how to build the CLAUDE.md context layer, and how OpenSpec moves […]

Part 3 of our series on intent-driven development. Read Part 1 (spec-driven development with Kiro) and Part 2 (mastering the CLAUDE.md file) first. Part 1 of this series established the principle: in AI-assisted development, the spec is the source of truth, not the code. Part 2 covered the CLAUDE.md file — the context layer that ensures every AI session starts from […]

How to Master the CLAUDE.md File: The Context Layer That Makes Spec-Driven Development Work Part 2 of our series on intent-driven development. If you haven't read Part 1 — Code is No Longer the Source of Truth. Your Spec Is. — start there. In Part 1, we explored how spec-driven development with tools like Kiro shifts the source of truth from […]
Partner with CloudIQ to achieve immediate gains while building a strong foundation for long-term, transformative success.