From 450575a9270c4ec096842029fc58102e11c8082a Mon Sep 17 00:00:00 2001 From: Schlaflied <200203syttt@gmail.com> Date: Mon, 23 Feb 2026 18:41:56 -0500 Subject: [PATCH] refactor(sdr-agent): reuse agent.start() in tui command and fix mock mode - Replace duplicated setup code in tui command with agent.start(mock_mode=mock) - Fix mock mode to use MockLLMProvider instead of llm=None - Add demo_contacts.json sample data for template testing - Untrack .claude/settings.json and add to .gitignore Co-Authored-By: Claude Sonnet 4.6 --- .claude/settings.json | 15 --- .gitignore | 1 + examples/templates/sdr_agent/__main__.py | 59 +---------- examples/templates/sdr_agent/agent.py | 6 +- .../templates/sdr_agent/demo_contacts.json | 97 +++++++++++++++++++ 5 files changed, 105 insertions(+), 73 deletions(-) delete mode 100644 .claude/settings.json create mode 100644 examples/templates/sdr_agent/demo_contacts.json diff --git a/.claude/settings.json b/.claude/settings.json deleted file mode 100644 index d03570d9..00000000 --- a/.claude/settings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "hooks": { - "PostToolUse": [ - { - "matcher": "Edit|Write|NotebookEdit", - "hooks": [ - { - "type": "command", - "command": "ruff check --fix \"$CLAUDE_FILE_PATH\" 2>/dev/null; ruff format \"$CLAUDE_FILE_PATH\" 2>/dev/null; true" - } - ] - } - ] - } -} diff --git a/.gitignore b/.gitignore index 60c65a7f..50487198 100644 --- a/.gitignore +++ b/.gitignore @@ -69,6 +69,7 @@ exports/* .claude/settings.local.json .claude/skills/ship-it/ +.claude/settings.json .venv diff --git a/examples/templates/sdr_agent/__main__.py b/examples/templates/sdr_agent/__main__.py index 0361943a..16ca4326 100644 --- a/examples/templates/sdr_agent/__main__.py +++ b/examples/templates/sdr_agent/__main__.py @@ -90,68 +90,15 @@ def tui(mock, verbose, debug): ) sys.exit(1) - from pathlib import Path - - from framework.llm import LiteLLMProvider - from framework.runner.tool_registry import ToolRegistry - from framework.runtime.agent_runtime import create_agent_runtime - from framework.runtime.execution_stream import EntryPointSpec - async def run_with_tui(): agent = SDRAgent() - agent._tool_registry = ToolRegistry() - - storage_path = Path.home() / ".hive" / "agents" / "sdr_agent" - storage_path.mkdir(parents=True, exist_ok=True) - - mcp_config_path = Path(__file__).parent / "mcp_servers.json" - if mcp_config_path.exists(): - agent._tool_registry.load_mcp_config(mcp_config_path) - - tools_path = Path(__file__).parent / "tools.py" - if tools_path.exists(): - agent._tool_registry.discover_from_module(tools_path) - # ↑ mirrors SDRAgent._setup() to ensure load_contacts_from_file is available in TUI - - if mock: - from framework.llm.mock import MockLLMProvider - llm = MockLLMProvider() - else: - llm = LiteLLMProvider( - model=agent.config.model, - api_key=agent.config.api_key, - api_base=agent.config.api_base, - ) - - tools = list(agent._tool_registry.get_tools().values()) - tool_executor = agent._tool_registry.get_executor() - graph = agent._build_graph() - - runtime = create_agent_runtime( - graph=graph, - goal=agent.goal, - storage_path=storage_path, - entry_points=[ - EntryPointSpec( - id="start", - name="Start SDR Campaign", - entry_node="intake", - trigger_type="manual", - isolation_level="isolated", - ), - ], - llm=llm, - tools=tools, - tool_executor=tool_executor, - ) - - await runtime.start() + await agent.start(mock_mode=mock) try: - app = AdenTUI(runtime) + app = AdenTUI(agent._agent_runtime) await app.run_async() finally: - await runtime.stop() + await agent.stop() asyncio.run(run_with_tui()) diff --git a/examples/templates/sdr_agent/agent.py b/examples/templates/sdr_agent/agent.py index a074523b..907b21d0 100644 --- a/examples/templates/sdr_agent/agent.py +++ b/examples/templates/sdr_agent/agent.py @@ -231,8 +231,10 @@ class SDRAgent: if tools_path.exists(): self._tool_registry.discover_from_module(tools_path) - llm = None - if not mock_mode: + if mock_mode: + from framework.llm.mock import MockLLMProvider + llm = MockLLMProvider() + else: llm = LiteLLMProvider( model=self.config.model, api_key=self.config.api_key, diff --git a/examples/templates/sdr_agent/demo_contacts.json b/examples/templates/sdr_agent/demo_contacts.json new file mode 100644 index 00000000..a5bb67e7 --- /dev/null +++ b/examples/templates/sdr_agent/demo_contacts.json @@ -0,0 +1,97 @@ +[ + { + "name": "Sarah Chen", + "email": "sarah.chen@techcorp.io", + "company": "TechCorp", + "title": "Learning & Development Manager", + "linkedin_url": "https://linkedin.com/in/sarah-chen-ld", + "connection_degree": "2nd", + "is_alumni": true, + "school_name": "University of Western Ontario", + "connections_count": 843, + "mutual_connections": 7, + "has_photo": true, + "company_domain_verified": true + }, + { + "name": "James Okafor", + "email": "james.okafor@edventure.co", + "company": "EdVenture", + "title": "Instructional Designer", + "linkedin_url": "https://linkedin.com/in/james-okafor-id", + "connection_degree": "1st", + "is_alumni": false, + "connections_count": 621, + "mutual_connections": 12, + "has_photo": true, + "company_domain_verified": true + }, + { + "name": "Emily Zhao", + "email": "emily.zhao@univedu.ca", + "company": "UniEdu", + "title": "Director of Digital Learning", + "linkedin_url": "https://linkedin.com/in/emily-zhao-dl", + "connection_degree": "2nd", + "is_alumni": true, + "school_name": "University of Western Ontario", + "connections_count": 1204, + "mutual_connections": 3, + "has_photo": true, + "company_domain_verified": true, + "active_job_posting": true + }, + { + "name": "Marcus Williams", + "email": "marcus@growthsales.io", + "company": "GrowthSales", + "title": "CEO", + "linkedin_url": "https://linkedin.com/in/marcus-williams-ceo", + "connection_degree": "3rd", + "is_alumni": false, + "connections_count": 6300, + "mutual_connections": 0, + "has_photo": true, + "company_domain_verified": false + }, + { + "name": "Priya Patel", + "email": "", + "company": "FutureLearn Inc.", + "title": "EdTech Product Manager", + "linkedin_url": "https://linkedin.com/in/priya-patel-edtech", + "connection_degree": "2nd", + "is_alumni": false, + "connections_count": 512, + "mutual_connections": 5, + "has_photo": true, + "company_domain_verified": true + }, + { + "name": "Alex Johnson", + "email": "alex@bizopp.biz", + "company": "Biz Opportunity Global", + "title": "Entrepreneur", + "linkedin_url": "https://linkedin.com/in/alex-johnson-biz", + "connection_degree": "3rd", + "is_alumni": false, + "connections_count": 38, + "mutual_connections": 0, + "has_photo": false, + "company_domain_verified": false + }, + { + "name": "Natalie Brown", + "email": "natalie.brown@learningpro.com", + "company": "LearningPro", + "title": "HR Learning Specialist", + "linkedin_url": "https://linkedin.com/in/natalie-brown-hr", + "connection_degree": "1st", + "is_alumni": true, + "school_name": "University of Western Ontario", + "connections_count": 389, + "mutual_connections": 9, + "has_photo": true, + "company_domain_verified": true + } +] \ No newline at end of file