From b125956ee5593ff497eb00a388535f309b7915d9 Mon Sep 17 00:00:00 2001 From: Adam Moussa <166072409+amoussa1229@users.noreply.github.com> Date: Fri, 8 May 2026 13:10:39 -0400 Subject: [PATCH] Add CLI entry point and fix Composio user_id - Add run.py with --route-only flag for Claude Code integration - Fix Composio user_id from "default" to "amoussa" to match connected accounts --- run.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tools.py | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100755 run.py diff --git a/run.py b/run.py new file mode 100755 index 0000000..3c2496b --- /dev/null +++ b/run.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +"""CLI entry point for the orchestration graph. + +Usage: + python3 run.py "Write a function that validates emails" + python3 run.py --route-only "Send a Slack message to #general" +""" +import sys +import os +import json + +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +from dotenv import load_dotenv + +load_dotenv(".env") + +from graph import app + + +def main(): + if len(sys.argv) < 2 or sys.argv[1] in ("-h", "--help"): + print("Usage: python3 run.py [--route-only] ") + sys.exit(1) + + route_only = "--route-only" in sys.argv + args = [a for a in sys.argv[1:] if a != "--route-only"] + task = " ".join(args) + + if route_only: + from langchain_core.messages import SystemMessage, HumanMessage + from models import get_orchestrator + + llm = get_orchestrator() + response = llm.invoke([ + SystemMessage(content="You are a task router. Respond with ONLY the agent name.\n" + "Available: implementer, reviewer, researcher, cross_reviewer, scanner, fast_coder, connector, done"), + HumanMessage(content=task), + ]) + print(response.content.strip().lower()) + return + + result = app.invoke({"task": task, "messages": []}) + print(f"[{result['route']}]") + print() + output = result.get("result", "") + if isinstance(output, list): + output = "\n".join(str(c) for c in output) + print(output) + + +if __name__ == "__main__": + main() diff --git a/tools.py b/tools.py index 0facd31..414c932 100644 --- a/tools.py +++ b/tools.py @@ -27,5 +27,5 @@ TOOL_SLUGS = [ def get_composio_tools(): client = Composio(provider=LanggraphProvider()) - tools = client.tools.get(user_id="default", tools=TOOL_SLUGS) + tools = client.tools.get(user_id="amoussa", tools=TOOL_SLUGS) return tools