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
This commit is contained in:
parent
02e29495c0
commit
b125956ee5
2 changed files with 54 additions and 1 deletions
53
run.py
Executable file
53
run.py
Executable file
|
|
@ -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] <task description>")
|
||||||
|
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()
|
||||||
2
tools.py
2
tools.py
|
|
@ -27,5 +27,5 @@ TOOL_SLUGS = [
|
||||||
|
|
||||||
def get_composio_tools():
|
def get_composio_tools():
|
||||||
client = Composio(provider=LanggraphProvider())
|
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
|
return tools
|
||||||
|
|
|
||||||
Reference in a new issue