Add --priority filter to loop command
Filters accounts by accountPriority (high/medium/low), as exported from Campaign Command Center. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"""CLI entrypoint for the Sales Prospecting Agent Loop (MVP).
|
"""CLI entrypoint for the Sales Prospecting Agent Loop (MVP).
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
python run.py loop [--account ID] [--tier strategic|enterprise|growth]
|
python run.py loop [--account ID] [--tier strategic|enterprise|growth] [--priority high|medium|low]
|
||||||
python run.py digest [--rep rep_sarah]
|
python run.py digest [--rep rep_sarah]
|
||||||
python run.py feedback --brief ID --action act_on|snooze|reject|won|lost [--note "..."]
|
python run.py feedback --brief ID --action act_on|snooze|reject|won|lost [--note "..."]
|
||||||
python run.py recalibrate
|
python run.py recalibrate
|
||||||
@@ -29,7 +29,7 @@ def cmd_loop(args):
|
|||||||
if args.domain_filter:
|
if args.domain_filter:
|
||||||
config.EXA_DOMAIN_FILTER = True
|
config.EXA_DOMAIN_FILTER = True
|
||||||
pipeline.run_all(tier=args.tier, account_id=args.account,
|
pipeline.run_all(tier=args.tier, account_id=args.account,
|
||||||
limit=args.limit, rep=args.rep)
|
limit=args.limit, rep=args.rep, priority=args.priority)
|
||||||
print("\n--- digest preview ---")
|
print("\n--- digest preview ---")
|
||||||
print(digest_mod.write_digest())
|
print(digest_mod.write_digest())
|
||||||
|
|
||||||
@@ -148,6 +148,8 @@ def main(argv=None):
|
|||||||
p_loop = sub.add_parser("loop", help="Run the harvest->deliver loop")
|
p_loop = sub.add_parser("loop", help="Run the harvest->deliver loop")
|
||||||
p_loop.add_argument("--account", help="single account id")
|
p_loop.add_argument("--account", help="single account id")
|
||||||
p_loop.add_argument("--tier", choices=["strategic", "enterprise", "growth"])
|
p_loop.add_argument("--tier", choices=["strategic", "enterprise", "growth"])
|
||||||
|
p_loop.add_argument("--priority", choices=["high", "medium", "low"],
|
||||||
|
help="only accounts with this Campaign Command Center priority")
|
||||||
p_loop.add_argument("--rep", help="only accounts assigned to this rep (name or id substring)")
|
p_loop.add_argument("--rep", help="only accounts assigned to this rep (name or id substring)")
|
||||||
p_loop.add_argument("--limit", type=int,
|
p_loop.add_argument("--limit", type=int,
|
||||||
help="process at most N accounts (strategic + least-recently-run first); "
|
help="process at most N accounts (strategic + least-recently-run first); "
|
||||||
|
|||||||
@@ -15,12 +15,15 @@ def _accounts() -> list[dict]:
|
|||||||
return json.loads((config.DATA_DIR / "accounts.json").read_text())["accounts"]
|
return json.loads((config.DATA_DIR / "accounts.json").read_text())["accounts"]
|
||||||
|
|
||||||
|
|
||||||
def load_accounts(tier: str | None = None, account_id: str | None = None) -> list[dict]:
|
def load_accounts(tier: str | None = None, account_id: str | None = None,
|
||||||
|
priority: str | None = None) -> list[dict]:
|
||||||
accts = _accounts()
|
accts = _accounts()
|
||||||
if account_id:
|
if account_id:
|
||||||
accts = [a for a in accts if a["accountId"] == account_id]
|
accts = [a for a in accts if a["accountId"] == account_id]
|
||||||
if tier:
|
if tier:
|
||||||
accts = [a for a in accts if a["accountTier"] == tier]
|
accts = [a for a in accts if a["accountTier"] == tier]
|
||||||
|
if priority:
|
||||||
|
accts = [a for a in accts if (a.get("accountPriority") or "").lower() == priority]
|
||||||
return accts
|
return accts
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ def run_all(
|
|||||||
account_id: str | None = None,
|
account_id: str | None = None,
|
||||||
limit: int | None = None,
|
limit: int | None = None,
|
||||||
rep: str | None = None,
|
rep: str | None = None,
|
||||||
|
priority: str | None = None,
|
||||||
) -> list[dict]:
|
) -> list[dict]:
|
||||||
config.ensure_dirs()
|
config.ensure_dirs()
|
||||||
if not config.LLM_CONFIGURED:
|
if not config.LLM_CONFIGURED:
|
||||||
@@ -147,7 +148,7 @@ def run_all(
|
|||||||
"OPENAI_MODEL), GEMINI_API_KEY, or ANTHROPIC_API_KEY in sales-agent/.env.")
|
"OPENAI_MODEL), GEMINI_API_KEY, or ANTHROPIC_API_KEY in sales-agent/.env.")
|
||||||
print("Refusing to run without a reasoning model (no mock fallback).")
|
print("Refusing to run without a reasoning model (no mock fallback).")
|
||||||
return []
|
return []
|
||||||
accounts = crm.load_accounts(tier=tier, account_id=account_id)
|
accounts = crm.load_accounts(tier=tier, account_id=account_id, priority=priority)
|
||||||
if rep:
|
if rep:
|
||||||
accounts = [a for a in accounts
|
accounts = [a for a in accounts
|
||||||
if rep.lower() in a["assignedRep"]["name"].lower()
|
if rep.lower() in a["assignedRep"]["name"].lower()
|
||||||
|
|||||||
Reference in New Issue
Block a user