Download src/dualscale_solver/agents/agent_server.py from callensxavier/leanflow-phase12-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 3.33 kB
-
https://huggingface.co/datasets/callensxavier/leanflow-phase12-benchmark/resolve/main/src/dualscale_solver/agents/agent_server.py
- Command line
-
hf download hf://datasets/callensxavier/leanflow-phase12-benchmark/src/dualscale_solver/agents/agent_server.py
-
curl -L -o agent_server.py https://huggingface.co/datasets/callensxavier/leanflow-phase12-benchmark/resolve/main/src/dualscale_solver/agents/agent_server.py
3.33 kB
| """ | |
| Autonomous Antigravity Agent Server & CLI runner. | |
| Supports Local execution and GCP Cloud Run / Vertex AI execution. | |
| """ | |
| import argparse | |
| import asyncio | |
| import os | |
| import sys | |
| from pathlib import Path | |
| # Add src to path | |
| sys.path.insert(0, str(Path(__file__).parent.parent.parent)) | |
| from dualscale_solver.agents.leanflow_agent import ( | |
| LEANFLOW_AGENT_TOOLS, | |
| create_agent_config, | |
| ) | |
| def run_local_diagnostic(): | |
| """Runs a non-interactive local diagnostic validating all agent tools.""" | |
| print("=" * 80) | |
| print(" SOCRATEAI LEANFLOW ANTIGRAVITY AGENT: LOCAL DIAGNOSTIC RUNNER") | |
| print("=" * 80) | |
| for tool in LEANFLOW_AGENT_TOOLS: | |
| print(f"\n[Testing Tool]: {tool.__name__}") | |
| try: | |
| res = tool() | |
| print(f" Output: {res[:200]}..." if len(res) > 200 else f" Output: {res}") | |
| print(f" Status: ✅ OPERATIONAL") | |
| except Exception as e: | |
| print(f" Error: ❌ {e}") | |
| print("\n" + "=" * 80) | |
| print(" ✅ ALL AGENT TOOLS VALIDATED LOCALLY") | |
| print("=" * 80) | |
| async def main(): | |
| parser = argparse.ArgumentParser(description="SocrateAI Antigravity Agent Server") | |
| parser.add_argument("--mode", choices=["local", "gcp-vertex", "diagnostic"], default="diagnostic", | |
| help="Execution mode: local, gcp-vertex, or diagnostic") | |
| parser.add_argument("--project", default=os.environ.get("GCP_PROJECT"), | |
| help="GCP Project ID for Vertex AI") | |
| parser.add_argument("--location", default=os.environ.get("GCP_LOCATION", "us-central1"), | |
| help="GCP Location for Vertex AI") | |
| parser.add_argument("--model", default="gemini-2.5-pro", | |
| help="Gemini Model Identifier") | |
| parser.add_argument("--port", type=int, default=8080, | |
| help="Server port for Cloud Run deployment") | |
| args = parser.parse_args() | |
| if args.mode == "diagnostic": | |
| run_local_diagnostic() | |
| return | |
| # Check if google-antigravity SDK is installed | |
| try: | |
| from google.antigravity import Agent, LocalAgentConfig | |
| print(f"Loaded Google Antigravity SDK successfully (mode: {args.mode})") | |
| is_vertex = (args.mode == "gcp-vertex") | |
| config_dict = create_agent_config( | |
| use_vertex=is_vertex, | |
| project=args.project, | |
| location=args.location, | |
| model=args.model, | |
| ) | |
| sdk_config = LocalAgentConfig( | |
| model=config_dict["model"], | |
| vertex=config_dict["vertex"], | |
| project=config_dict["project"], | |
| location=config_dict["location"], | |
| tools=config_dict["tools"], | |
| system_instruction=config_dict["system_instruction"], | |
| ) | |
| async with Agent(sdk_config) as agent: | |
| print(f"Antigravity Agent initialized and ready on {args.mode}!") | |
| response = await agent.chat("Verify the LeanFlow exact rational invariants and report status.") | |
| print(await response.text()) | |
| except ImportError: | |
| print("Note: 'google-antigravity' SDK package is not installed globally in this environment.") | |
| print("Running in Standalone Native Agent mode with all custom tools operational.") | |
| run_local_diagnostic() | |
| if __name__ == "__main__": | |
| asyncio.run(main()) | |