Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Main entry point for the MCP Agent Hackathon system. | |
| Supports multiple modes: server, client, and agents. | |
| """ | |
| import sys | |
| import os | |
| import argparse | |
| import asyncio | |
| import logging | |
| # Add the current directory to Python path for imports | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| from utils.api_config import api_config | |
| def run_client(model_type="anthropic"): | |
| """Run the MCP client with agent system.""" | |
| print("π€ Starting MCP Client...") | |
| from client import main as client_main, set_model_type | |
| # Set the model type | |
| try: | |
| set_model_type(model_type) | |
| print(f"β Model set to: {model_type}") | |
| except Exception as e: | |
| print(f"β Error setting model: {e}") | |
| print("π Falling back to default (anthropic)") | |
| model_type = "anthropic" | |
| set_model_type(model_type) | |
| client_main() | |
| def run_agents(): | |
| """Run the modular agent system directly.""" | |
| print("π§ Starting Modular Agent System...") | |
| from agents import create_agent_system | |
| # Create the agent system | |
| agent_system = create_agent_system() | |
| coordinator = agent_system.get_coordinator() | |
| print("\nπ€ **Multi-Agent System Demo** π€") | |
| print(f"π Available Agents: {', '.join(agent_system.list_agents())}") | |
| print("=" * 60) | |
| # Interactive mode | |
| print("\n㪠**Interactive Mode** (type 'quit' to exit)") | |
| print("π― **Try these examples:**") | |
| print("β’ 'Find hotels in Paris'") | |
| print("β’ 'What's the weather like today?'") | |
| print("β’ 'Analyze sentiment: This is amazing!'") | |
| print("β’ 'Find hiking trails near Denver'") | |
| print("-" * 60) | |
| while True: | |
| try: | |
| query = input("\nπ£οΈ Your Query: ").strip() | |
| if not query: | |
| continue | |
| if query.lower() in ['quit', 'exit', 'q']: | |
| print("π Goodbye!") | |
| break | |
| print(f"\nπ Processing: {query}") | |
| print("-" * 40) | |
| result = coordinator.process_query(query) | |
| print(result) | |
| print("\n" + "=" * 60) | |
| except KeyboardInterrupt: | |
| print("\n\nπ Goodbye!") | |
| break | |
| except Exception as e: | |
| print(f"β Error: {str(e)}") | |
| def main(): | |
| """Main entry point with command line argument parsing.""" | |
| parser = argparse.ArgumentParser( | |
| description="Voyager AI - Smart Travel & Lifestyle Assistant", | |
| formatter_class=argparse.RawDescriptionHelpFormatter, | |
| epilog=""" | |
| Examples: | |
| python app.py # Start with default Anthropic model | |
| python app.py --model deepseek # Start with DeepSeek model | |
| python app.py --check-apis # Check API connectivity first | |
| python app.py --help # Show this help message | |
| """ | |
| ) | |
| parser.add_argument( | |
| '--check-apis', | |
| action='store_true', | |
| help='Check API connectivity before starting' | |
| ) | |
| parser.add_argument( | |
| '--model', | |
| choices=['anthropic', 'deepseek'], | |
| default='anthropic', | |
| help='AI model to use: "anthropic" for Claude Sonnet 4, "deepseek" for DeepSeek V3 (default: anthropic)' | |
| ) | |
| args = parser.parse_args() | |
| # Check API status if requested | |
| if args.check_apis: | |
| api_config.print_status() | |
| print() | |
| # Always run in client mode | |
| run_client(args.model) | |
| if __name__ == "__main__": | |
| main() |