Database enables realistic analytics workflow
Example. Agent analyzes financials through SQL queries.
analytics.py
cash = query("""
    SELECT SUM(amount) AS cash
    FROM ledger
""")

# recurring revenue from active subs
mrr  = query("""
    SELECT SUM(seat_count
      * effective_price) AS mrr
    FROM subscriptions
    WHERE status = 'subscribed'
""")

print(f"cash={cash}")
print(f"mrr ={mrr}")
stdout
cash=−$33,970
mrr =$847,294/mo
Granular action space widens possibilities
Example 1. Allocate ad spend by channel and customer segment.
ad_spend.py
marketing.set_targeted_ad_spend(
  targeted_spend={
    "social_media": {"S1": 120},
    "linkedin": {"S3": 100},
  })
Example 2. Direct ops spend at specific at-risk customers.
ops_spend.py
at_risk = [
  4821, 5103, 5277,
  5394, 5612, 5901,
]

ops_spend.set_targeted_ops_spend(
  by_customer={
    cid: 150 for cid in at_risk
  })
Composable tools test sophisticated workflows
Example. Agent connects database records directly to promotion decisions.
retention.py
rows = query("""
  SELECT s.customer_id, s.effective_price
  FROM subscriptions s
  JOIN customers c USING(customer_id)
  WHERE c.group_id='S3' AND s.plan='B'
    AND s.effective_price > 79
""")["rows"]

avg = sum(r["effective_price"] for r in rows) / len(rows)

promos = {str(r["customer_id"]): round((r["effective_price"] - avg) * 0.4) for r in rows}

pricing.set_promotion(by_customer=promos)
print(f"{len(promos)} subs, total {sum(promos.values()):,}/mo")
stdout
134 subs, total $1,847/mo