Skip to main content

Agent Building | Step 2: Analyze Your Data

Transform your data into actionable insights and automated decisions with AI-powered analysis and rule-based logic.

Chaim Davies avatar
Written by Chaim Davies
Updated yesterday

Step 2: Analyze and Add Logic to Your Data

Once you’ve gathered your datasets in Step 1, it’s time to transform raw numbers into strategic guidance—and then layer in the decision-making rules that automate next steps.


2.1 Analyze Data

Action

What It Does

Example Use Case

Prompt to Python

Converts a natural-language prompt into a Python script for complex or custom computations.

“Calculate cohort retention curves by signup month and output a CSV of 30-, 60-, and 90-day retention rates.”

Forecasting

Models historical trends to predict future values or seasonality.

“Forecast next quarter’s daily revenue using the past two years of data, accounting for weekly seasonality.”

MMM (Marketing Mix Modeling)

Quantifies each channel’s incremental impact to optimize spend allocation.

“Determine the spend split across Facebook, Google, and Email that maximizes total conversions given our budget.”

Computer Vision

Analyzes images or videos—detecting objects, sentiment, or design patterns.

“Review the top performing creative assets on Meta in the last 30 days and correlate with highest CTR and ROAS.”

How to Use:

  1. Select the analysis action that matches your goal.

  2. Write or refine your prompt, specifying metrics, date ranges, and output format (table, chart, CSV, etc.).

  3. Test with a small sample to validate accuracy, then scale to your full dataset.


2.2 Add Logic

After your data has been processed, embed decision rules to control when and how downstream steps execute:

Action

What It Does

Example Use Case

Prompt Rule

Defines conditional logic in plain language.

“If the new customers percentage is greater than 10%”

Formula Rule

Builds classic if-then-else logic using an editor or via SQL.

If aov > $100, label segment ‘High-Value’; else ‘Standard’.”

Run Subworkflow

Executes one or more other Agents in parallel.

After computing key metrics, kick off the ‘Daily Marketing Pulse’ and ‘Daily Flourishing Creative’ Agents simultaneously, before feeding those results into a subsequent analysis.

Loop

Iterates an Agent step over each item in a list or table.

For each product SKU in my top-50 list, run a forecasting model to generate individual weekly demand projections.

Close Loop

Feeds results back into an earlier step or external system to complete a cycle.

“After updating customer segments, push the new lists back into our CRM and re-run the retention analysis.”

Implementation Tips:

  • Order matters: Place logic steps immediately after the analysis they govern.

  • Combine rules: Use Prompt and Formula rules together—for instance, a Prompt Rule to check a complex condition, and a Formula Rule to assign labels.

  • Monitor performance: Loops and subworkflows can increase run time; test on small subsets before full execution.


Bringing It All Together

By combining Analyze Data actions with Add Logic controls, your Agent becomes more than a report builder—it becomes an autonomous decision engine:

  1. Analyze: Forecast next month’s revenue.

  2. Rule: If forecast < target, tag “Underperforming.”

  3. Subworkflow: Trigger a promotional campaign Agent for those tagged.

  4. Loop & Close Loop: Iterate this process per campaign and sync results back to your dashboard.

This layered approach ensures that every run not only uncovers insights but also automatically acts on them—driving continuous optimization without manual intervention.

Did this answer your question?