Spaces:
No application file
No application file
| import requests | |
| import json | |
| MCP_URL = "http://localhost:8000/mcp" | |
| API_KEY = "dev-key-123" | |
| def call_mcp(tool, params=None): | |
| response = requests.post( | |
| MCP_URL, | |
| headers={"X-API-Key": API_KEY, "Content-Type": "application/json"}, | |
| json={"tool": tool, "params": params or {}} | |
| ) | |
| return response.json() | |
| # Create workflow | |
| workflow = call_mcp("write_graph", { | |
| "action": "create_node", | |
| "label": "Workflow", | |
| "properties": { | |
| "id": "demo-workflow-1", | |
| "name": "Entity Resolution Demo", | |
| "status": "active", | |
| "max_iterations": 10, | |
| "current_iteration": 0 | |
| } | |
| }) | |
| print(f"Created workflow: {workflow}") | |
| # Create three instructions | |
| instructions = [ | |
| {"id": "inst-1", "sequence": 1, "type": "discover_schema", "status": "pending", "pause_duration": 300}, | |
| {"id": "inst-2", "sequence": 2, "type": "generate_sql", "status": "pending", "pause_duration": 300}, | |
| {"id": "inst-3", "sequence": 3, "type": "review_results", "status": "pending", "pause_duration": 300} | |
| ] | |
| for inst in instructions: | |
| result = call_mcp("write_graph", { | |
| "action": "create_node", | |
| "label": "Instruction", | |
| "properties": inst | |
| }) | |
| print(f"Created instruction: {inst['id']}") | |
| print(" Basic seeding complete! Workflow and instructions created.") | |
| print("Note: Relationships skipped due to parameterized query issue - but agent should still work!") | |