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 <noreply@anthropic.com>
This commit is contained in:
Schlaflied
2026-02-23 18:41:56 -05:00
parent eac2bb19b2
commit 450575a927
5 changed files with 105 additions and 73 deletions
+3 -56
View File
@@ -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())
+4 -2
View File
@@ -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,
@@ -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
}
]