Spaces:
Running on Zero
Running on Zero
Restore files the worker imports (parity with original Space)
Browse files- Agent/test_query_runner.py +20 -0
Agent/test_query_runner.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
import sys
|
| 4 |
+
# Ensure Agent package path is importable
|
| 5 |
+
sys.path.insert(0, r"e:/Capstone_Project/text2sql-agent-mcp/Agent")
|
| 6 |
+
import backups.agentic_workflow4 as aw
|
| 7 |
+
|
| 8 |
+
async def run_one():
|
| 9 |
+
# Initialize DB (use the module's configured DB_CONNECTION_URL when available)
|
| 10 |
+
db_uri = os.environ.get('DB_CONNECTION_URL') or getattr(aw, 'DB_CONNECTION_URL', None)
|
| 11 |
+
await aw.initialize_database(db_uri)
|
| 12 |
+
# Run a single question
|
| 13 |
+
# Prefix with 're-execute' to force regeneration and bypass any cached error in memory
|
| 14 |
+
res = await aw.agentic_query_process('re-execute Who are the top 10 highest-paid employees?')
|
| 15 |
+
print('\n--- AGENT OUTPUT START ---')
|
| 16 |
+
print(res)
|
| 17 |
+
print('--- AGENT OUTPUT END ---')
|
| 18 |
+
|
| 19 |
+
if __name__ == '__main__':
|
| 20 |
+
asyncio.run(run_one())
|