feat(agents): autonomous guard-railed DML on source DBs for Debezium CDC

Add api/agent_ops.py: background loop performs small INSERT/UPDATE/DELETE on
public.sales_orders (PG), hr.employee_events (MySQL) and supplychain.events
(Mongo). Agent rows are tagged (notes/atc_agent); UPDATE/DELETE only ever touch
agent-created rows. Env kill-switch + interval + per-tick row cap. Endpoints
/api/agent-ops/{status,toggle,run-once}. Loop started in lifespan.
This commit is contained in:
mo
2026-06-27 01:25:08 +02:00
parent 96d490807a
commit 3c9661e7f9
3 changed files with 316 additions and 1 deletions
+4
View File
@@ -42,6 +42,7 @@ from pipeline_ops import router as pipeline_router
from hadoop_analytics import router as hadoop_router
from elasticsearch_api import router as elasticsearch_router
from sql_console import router as sql_router
from agent_ops import router as agent_ops_router, agent_dml_loop
from ssh_terminal import ssh_session
from node_registry import NODE_IDS, NODE_AGENT, NODE_REGISTRY, is_node_id
from node_ops import build_node_detail, probe_node, run_node_probe_task
@@ -711,9 +712,11 @@ async def lifespan(app: FastAPI):
meta = NODE_REGISTRY[nid]
await terminal_log(nid, f"{meta['label']} shell ready — click node to connect", level="info", phase="boot")
task = asyncio.create_task(heartbeat_loop())
dml_task = asyncio.create_task(agent_dml_loop())
add_feed("infra-sentinel", "ATC Command Center API online", "info")
yield
task.cancel()
dml_task.cancel()
if redis_client:
await redis_client.close()
@@ -725,6 +728,7 @@ app.include_router(pipeline_router)
app.include_router(hadoop_router)
app.include_router(elasticsearch_router)
app.include_router(sql_router)
app.include_router(agent_ops_router)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],