Eastridge Analytics commited on
Commit ·
104d504
1
Parent(s): f831e98
commit cleanup
Browse files- graph-agentic-system-backup-20250923-132428.zip +0 -0
- graph-agentic-system/Makefile +0 -0
- graph-agentic-system/README.md +0 -0
- graph-agentic-system/docker-compose.yml +0 -29
- graph-agentic-system/mcp/Dockerfile +0 -12
- graph-agentic-system/mcp/main.py +0 -62
- graph-agentic-system/mcp/requirements.txt +0 -4
- graph-agentic-system/neo4j/Dockerfile +0 -4
- graph-agentic-system/ops/health/neo4j.ps1 +0 -2
- graph-agentic-system/ops/health/neo4j.sh +0 -2
- graph-agentic-system/ops/scripts/seed.py +0 -83
- mcp/__pycache__/main.cpython-311.pyc +0 -0
- ops/scripts/fresh_start.ps1 +3 -3
graph-agentic-system-backup-20250923-132428.zip
ADDED
|
Binary file (5.14 kB). View file
|
|
|
graph-agentic-system/Makefile
DELETED
|
File without changes
|
graph-agentic-system/README.md
DELETED
|
File without changes
|
graph-agentic-system/docker-compose.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
| 1 |
-
version: '3.8'
|
| 2 |
-
|
| 3 |
-
services:
|
| 4 |
-
neo4j:
|
| 5 |
-
image: neo4j:5.15-community
|
| 6 |
-
container_name: neo4j
|
| 7 |
-
ports:
|
| 8 |
-
- "7474:7474"
|
| 9 |
-
- "7687:7687"
|
| 10 |
-
environment:
|
| 11 |
-
- NEO4J_AUTH=-Force{NEO4J_AUTH}
|
| 12 |
-
- NEO4J_BOLT_URL=-Force{NEO4J_BOLT_URL}
|
| 13 |
-
volumes:
|
| 14 |
-
- neo4j_data:/data
|
| 15 |
-
|
| 16 |
-
postgres:
|
| 17 |
-
image: postgres:15
|
| 18 |
-
container_name: postgres
|
| 19 |
-
ports:
|
| 20 |
-
- "5432:5432"
|
| 21 |
-
environment:
|
| 22 |
-
- POSTGRES_PASSWORD=-Force{POSTGRES_PASSWORD}
|
| 23 |
-
- POSTGRES_DB=testdb
|
| 24 |
-
volumes:
|
| 25 |
-
- postgres_data:/var/lib/postgresql/data
|
| 26 |
-
|
| 27 |
-
volumes:
|
| 28 |
-
neo4j_data:
|
| 29 |
-
postgres_data:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph-agentic-system/mcp/Dockerfile
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
-
|
| 3 |
-
WORKDIR /app
|
| 4 |
-
|
| 5 |
-
COPY requirements.txt .
|
| 6 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 7 |
-
|
| 8 |
-
COPY . .
|
| 9 |
-
|
| 10 |
-
EXPOSE 8000
|
| 11 |
-
|
| 12 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph-agentic-system/mcp/main.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
from fastapi import FastAPI, Header, HTTPException
|
| 2 |
-
from neo4j import GraphDatabase
|
| 3 |
-
import os
|
| 4 |
-
import json
|
| 5 |
-
from datetime import datetime
|
| 6 |
-
|
| 7 |
-
app = FastAPI()
|
| 8 |
-
driver = GraphDatabase.driver(
|
| 9 |
-
os.getenv("NEO4J_BOLT_URL"),
|
| 10 |
-
auth=("neo4j", os.getenv("NEO4J_AUTH").split("/")[1])
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
VALID_API_KEYS = os.getenv("MCP_API_KEYS", "").split(",")
|
| 14 |
-
|
| 15 |
-
@app.get("/health")
|
| 16 |
-
def health():
|
| 17 |
-
return {"ok": True, "timestamp": datetime.now().isoformat()}
|
| 18 |
-
|
| 19 |
-
@app.post("/mcp")
|
| 20 |
-
async def execute_tool(request: dict, x_api_key: str = Header(None)):
|
| 21 |
-
# Verify API key
|
| 22 |
-
if x_api_key not in VALID_API_KEYS:
|
| 23 |
-
raise HTTPException(status_code=401, detail="Invalid API key")
|
| 24 |
-
|
| 25 |
-
tool = request.get("tool")
|
| 26 |
-
params = request.get("params", {})
|
| 27 |
-
|
| 28 |
-
if tool == "get_schema":
|
| 29 |
-
# Return node labels and relationships
|
| 30 |
-
with driver.session() as session:
|
| 31 |
-
result = session.run("CALL db.labels() YIELD label RETURN collect(label) as labels")
|
| 32 |
-
return {"labels": result.single()["labels"]}
|
| 33 |
-
|
| 34 |
-
elif tool == "query_graph":
|
| 35 |
-
# Execute parameterized query
|
| 36 |
-
query = params.get("query")
|
| 37 |
-
query_params = params.get("parameters", {})
|
| 38 |
-
with driver.session() as session:
|
| 39 |
-
result = session.run(query, query_params)
|
| 40 |
-
return {"data": [dict(record) for record in result]}
|
| 41 |
-
|
| 42 |
-
elif tool == "write_graph":
|
| 43 |
-
# Structured write operation
|
| 44 |
-
action = params.get("action")
|
| 45 |
-
if action == "create_node":
|
| 46 |
-
label = params.get("label")
|
| 47 |
-
properties = params.get("properties", {})
|
| 48 |
-
with driver.session() as session:
|
| 49 |
-
result = session.run(f"CREATE (n:{label} ) RETURN n", props=properties)
|
| 50 |
-
return {"created": dict(result.single()["n"])}
|
| 51 |
-
|
| 52 |
-
elif tool == "get_next_instruction":
|
| 53 |
-
# Get next pending instruction
|
| 54 |
-
with driver.session() as session:
|
| 55 |
-
result = session.run("""
|
| 56 |
-
MATCH (i:Instruction {status: 'pending'})
|
| 57 |
-
RETURN i ORDER BY i.sequence LIMIT 1
|
| 58 |
-
""")
|
| 59 |
-
record = result.single()
|
| 60 |
-
return {"instruction": dict(record["i"]) if record else None}
|
| 61 |
-
|
| 62 |
-
return {"error": "Unknown tool"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph-agentic-system/mcp/requirements.txt
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
fastapi==0.104.0
|
| 2 |
-
uvicorn==0.24.0
|
| 3 |
-
neo4j==5.14.0
|
| 4 |
-
pydantic==2.4.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph-agentic-system/neo4j/Dockerfile
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
FROM neo4j:5.23.0
|
| 2 |
-
ENV NEO4J_PLUGINS='["apoc"]'
|
| 3 |
-
ENV NEO4J_apoc_export_file_enabled=true
|
| 4 |
-
ENV NEO4J_apoc_import_file_enabled=true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
graph-agentic-system/ops/health/neo4j.ps1
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
docker-compose exec neo4j cypher-shell -u neo4j -p password "MATCH (n) RETURN count(n) LIMIT 1"
|
| 2 |
-
if (1 -eq 0) { echo " Neo4j healthy" }
|
|
|
|
|
|
|
|
|
graph-agentic-system/ops/health/neo4j.sh
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
docker-compose exec neo4j cypher-shell -u neo4j -p password "MATCH (n) RETURN count(n) LIMIT 1" && echo " Neo4j healthy"
|
|
|
|
|
|
|
|
|
graph-agentic-system/ops/scripts/seed.py
DELETED
|
@@ -1,83 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
import json
|
| 3 |
-
|
| 4 |
-
MCP_URL = "http://localhost:8000/mcp"
|
| 5 |
-
API_KEY = "dev-key-123"
|
| 6 |
-
|
| 7 |
-
def call_mcp(tool, params=None):
|
| 8 |
-
response = requests.post(
|
| 9 |
-
MCP_URL,
|
| 10 |
-
headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
|
| 11 |
-
json={"tool": tool, "params": params or {}}
|
| 12 |
-
)
|
| 13 |
-
if response.status_code == 200:
|
| 14 |
-
return response.json()
|
| 15 |
-
else:
|
| 16 |
-
print(f"Error: {response.status_code} - {response.text}")
|
| 17 |
-
return {"error": f"HTTP {response.status_code}: {response.text}"}
|
| 18 |
-
|
| 19 |
-
# Clear existing data
|
| 20 |
-
print("Clearing existing data...")
|
| 21 |
-
call_mcp("query_graph", {"query": "MATCH (n) DETACH DELETE n"})
|
| 22 |
-
|
| 23 |
-
# Create demo workflow
|
| 24 |
-
print("Creating workflow...")
|
| 25 |
-
workflow = call_mcp("write_graph", {
|
| 26 |
-
"action": "create_node",
|
| 27 |
-
"label": "Workflow",
|
| 28 |
-
"properties": {
|
| 29 |
-
"id": "demo-workflow-1",
|
| 30 |
-
"name": "Entity Resolution Demo",
|
| 31 |
-
"status": "active",
|
| 32 |
-
"max_iterations": 10,
|
| 33 |
-
"current_iteration": 0
|
| 34 |
-
}
|
| 35 |
-
})
|
| 36 |
-
print(f"Created workflow: {workflow}")
|
| 37 |
-
|
| 38 |
-
# Create three instructions
|
| 39 |
-
print("Creating instructions...")
|
| 40 |
-
instructions = [
|
| 41 |
-
{"id": "inst-1", "sequence": 1, "type": "discover_schema", "status": "pending", "pause_duration": 300},
|
| 42 |
-
{"id": "inst-2", "sequence": 2, "type": "generate_sql", "status": "pending", "pause_duration": 300},
|
| 43 |
-
{"id": "inst-3", "sequence": 3, "type": "review_results", "status": "pending", "pause_duration": 300}
|
| 44 |
-
]
|
| 45 |
-
|
| 46 |
-
for inst in instructions:
|
| 47 |
-
result = call_mcp("write_graph", {
|
| 48 |
-
"action": "create_node",
|
| 49 |
-
"label": "Instruction",
|
| 50 |
-
"properties": inst
|
| 51 |
-
})
|
| 52 |
-
print(f"Created instruction: {inst['id']}")
|
| 53 |
-
|
| 54 |
-
# Create relationships
|
| 55 |
-
print("Creating relationships...")
|
| 56 |
-
call_mcp("query_graph", {
|
| 57 |
-
"query": "MATCH (w:Workflow {id: 'demo-workflow-1'}), (i:Instruction {id: 'inst-1'}) CREATE (w)-[:HAS_INSTRUCTION]->(i)"
|
| 58 |
-
})
|
| 59 |
-
|
| 60 |
-
call_mcp("query_graph", {
|
| 61 |
-
"query": "MATCH (w:Workflow {id: 'demo-workflow-1'}), (i:Instruction {id: 'inst-2'}) CREATE (w)-[:HAS_INSTRUCTION]->(i)"
|
| 62 |
-
})
|
| 63 |
-
|
| 64 |
-
call_mcp("query_graph", {
|
| 65 |
-
"query": "MATCH (w:Workflow {id: 'demo-workflow-1'}), (i:Instruction {id: 'inst-3'}) CREATE (w)-[:HAS_INSTRUCTION]->(i)"
|
| 66 |
-
})
|
| 67 |
-
|
| 68 |
-
# Create instruction chain
|
| 69 |
-
call_mcp("query_graph", {
|
| 70 |
-
"query": "MATCH (i1:Instruction {id: 'inst-1'}), (i2:Instruction {id: 'inst-2'}) CREATE (i1)-[:NEXT_INSTRUCTION]->(i2)"
|
| 71 |
-
})
|
| 72 |
-
|
| 73 |
-
call_mcp("query_graph", {
|
| 74 |
-
"query": "MATCH (i2:Instruction {id: 'inst-2'}), (i3:Instruction {id: 'inst-3'}) CREATE (i2)-[:NEXT_INSTRUCTION]->(i3)"
|
| 75 |
-
})
|
| 76 |
-
|
| 77 |
-
# Create indexes
|
| 78 |
-
print("Creating indexes...")
|
| 79 |
-
call_mcp("query_graph", {"query": "CREATE INDEX workflow_id IF NOT EXISTS FOR (w:Workflow) ON (w.id)"})
|
| 80 |
-
call_mcp("query_graph", {"query": "CREATE INDEX instruction_id IF NOT EXISTS FOR (i:Instruction) ON (i.id)"})
|
| 81 |
-
call_mcp("query_graph", {"query": "CREATE INDEX instruction_status_seq IF NOT EXISTS FOR (i:Instruction) ON (i.status, i.sequence)"})
|
| 82 |
-
|
| 83 |
-
print(" Seeding complete!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mcp/__pycache__/main.cpython-311.pyc
CHANGED
|
Binary files a/mcp/__pycache__/main.cpython-311.pyc and b/mcp/__pycache__/main.cpython-311.pyc differ
|
|
|
ops/scripts/fresh_start.ps1
CHANGED
|
@@ -47,7 +47,7 @@ if ($ApiKey -ne "") {
|
|
| 47 |
(Get-Content ".env") -replace "LLM_MODEL=.*", "LLM_MODEL=$Model" | Set-Content ".env"
|
| 48 |
Write-Host "✅ Updated LLM configuration in .env" -ForegroundColor Green
|
| 49 |
} else {
|
| 50 |
-
Write-Host "⚠️ No API key provided. You
|
| 51 |
Write-Host " Add your OpenAI or Anthropic API key to the LLM_API_KEY variable" -ForegroundColor Gray
|
| 52 |
}
|
| 53 |
|
|
@@ -158,7 +158,7 @@ Write-Host " • Check health: docker-compose ps" -ForegroundColor White
|
|
| 158 |
Write-Host ""
|
| 159 |
Write-Host "🎯 Quick Test:" -ForegroundColor Yellow
|
| 160 |
Write-Host " 1. Open http://localhost:3000" -ForegroundColor White
|
| 161 |
-
Write-Host " 2. Ask:
|
| 162 |
Write-Host " 3. Watch the agent process the workflow!" -ForegroundColor White
|
| 163 |
Write-Host ""
|
| 164 |
|
|
@@ -167,4 +167,4 @@ if ($ApiKey -eq "") {
|
|
| 167 |
Write-Host ""
|
| 168 |
}
|
| 169 |
|
| 170 |
-
Write-Host "System is ready for use!
|
|
|
|
| 47 |
(Get-Content ".env") -replace "LLM_MODEL=.*", "LLM_MODEL=$Model" | Set-Content ".env"
|
| 48 |
Write-Host "✅ Updated LLM configuration in .env" -ForegroundColor Green
|
| 49 |
} else {
|
| 50 |
+
Write-Host "⚠️ No API key provided. You will need to edit .env manually" -ForegroundColor Yellow
|
| 51 |
Write-Host " Add your OpenAI or Anthropic API key to the LLM_API_KEY variable" -ForegroundColor Gray
|
| 52 |
}
|
| 53 |
|
|
|
|
| 158 |
Write-Host ""
|
| 159 |
Write-Host "🎯 Quick Test:" -ForegroundColor Yellow
|
| 160 |
Write-Host " 1. Open http://localhost:3000" -ForegroundColor White
|
| 161 |
+
Write-Host " 2. Ask: ""How many customers do we have?""" -ForegroundColor White
|
| 162 |
Write-Host " 3. Watch the agent process the workflow!" -ForegroundColor White
|
| 163 |
Write-Host ""
|
| 164 |
|
|
|
|
| 167 |
Write-Host ""
|
| 168 |
}
|
| 169 |
|
| 170 |
+
Write-Host "System is ready for use!" -ForegroundColor Green
|