Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /ViperJuice_Code-Index-MCP /scripts /launch_claude_agents.py
| #!/usr/bin/env python3 | |
| """ | |
| Launch Claude Code agents for MCP vs Native testing. | |
| Uses the Claude Code SDK approach. | |
| """ | |
| import subprocess | |
| import json | |
| import time | |
| import os | |
| from pathlib import Path | |
| # Test scenarios | |
| TEST_PROMPTS = { | |
| "semantic_search": [ | |
| "Find code that handles error recovery and retry logic", | |
| "Show me authentication implementation across the codebase", | |
| "Locate database connection pooling code" | |
| ], | |
| "sql_search": [ | |
| "Search for 'EnhancedDispatcher' class", | |
| "Find all async functions", | |
| "Search for TODO comments" | |
| ], | |
| "symbol_lookup": [ | |
| "Go to definition of EnhancedDispatcher", | |
| "Find the search method implementation", | |
| "Show all methods in SQLiteStore class" | |
| ] | |
| } | |
| def launch_claude_agent(use_mcp: bool, prompts: list): | |
| """Launch a Claude Code agent with or without MCP""" | |
| agent_type = "mcp" if use_mcp else "native" | |
| timestamp = int(time.time()) | |
| # Create transcript directory | |
| transcript_dir = Path("claude_agent_transcripts") | |
| transcript_dir.mkdir(exist_ok=True) | |
| # Create prompt file | |
| prompt_file = transcript_dir / f"{agent_type}_prompts_{timestamp}.txt" | |
| with open(prompt_file, 'w') as f: | |
| for prompt in prompts: | |
| f.write(prompt + '\n') | |
| # Launch command | |
| if use_mcp: | |
| # With MCP configuration | |
| cmd = [ | |
| "claude", "-p", | |
| f"Process these prompts one by one from {prompt_file}. " + | |
| "Use the code-index-mcp tools when available. " + | |
| "For each prompt, record the time taken and tools used.", | |
| "--save-transcript", str(transcript_dir / f"{agent_type}_transcript_{timestamp}.json") | |
| ] | |
| else: | |
| # Without MCP - native tools only | |
| cmd = [ | |
| "claude", "-p", | |
| f"Process these prompts one by one from {prompt_file}. " + | |
| "Use only native tools (Grep, Find, Read). " + | |
| "For each prompt, record the time taken and tools used.", | |
| "--no-mcp", # Hypothetical flag to disable MCP | |
| "--save-transcript", str(transcript_dir / f"{agent_type}_transcript_{timestamp}.json") | |
| ] | |
| print(f"Launching {agent_type} agent...") | |
| print(f"Command: {' '.join(cmd)}") | |
| # Note: In real implementation, we would run this command | |
| # For now, we'll create a sample transcript structure | |
| transcript = { | |
| "agent_type": agent_type, | |
| "timestamp": timestamp, | |
| "prompts": prompts, | |
| "results": [] | |
| } | |
| # Save sample transcript | |
| with open(transcript_dir / f"{agent_type}_transcript_{timestamp}.json", 'w') as f: | |
| json.dump(transcript, f, indent=2) | |
| return transcript_dir / f"{agent_type}_transcript_{timestamp}.json" | |
| def main(): | |
| """Run parallel Claude agents""" | |
| all_prompts = [] | |
| for prompts in TEST_PROMPTS.values(): | |
| all_prompts.extend(prompts) | |
| # Launch MCP agent | |
| mcp_transcript = launch_claude_agent(True, all_prompts) | |
| print(f"MCP transcript: {mcp_transcript}") | |
| # Launch Native agent | |
| native_transcript = launch_claude_agent(False, all_prompts) | |
| print(f"Native transcript: {native_transcript}") | |
| print("\nAgent tests launched. Check transcripts for results.") | |
| if __name__ == "__main__": | |
| main() | |
Xet Storage Details
- Size:
- 3.36 kB
- Xet hash:
- 0183db581542e6d64260bbac5c249719ed28f75f92b33b5d5440577061cea454
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.