oclaw/runtime/tools/public/get_ne_exec_job_tool.py
oliver 4827278a9c Enforce report-first short intents and async large execManagedNe batches.
Block CLI/inventory until ume_alarm_xlsx_report (or aggregate) succeeds, and return job_id for big NE batches via get_ne_exec_job.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 22:17:16 +08:00

35 lines
1.1 KiB
Python

from __future__ import annotations
from typing import Any
from runtime.tools.base import ToolSpec
from svc.jobs.ne_exec_jobs import get_ne_exec_job
def get_ne_exec_job_tool() -> ToolSpec:
def handler(args: dict[str, Any]) -> dict[str, Any]:
return get_ne_exec_job(str(args.get("job_id") or "").strip())
return ToolSpec(
name="get_ne_exec_job",
description=(
"Poll a background execManagedNe job started with async=true (or auto-async for large batches). "
"Pass job_id from the async ack. When status is succeeded/failed/timeout, result contains the full CLI output."
),
parameters={
"type": "object",
"properties": {
"job_id": {"type": "string", "description": "Job id returned by async execManagedNe."},
},
"required": ["job_id"],
"additionalProperties": False,
},
handler=handler,
tags=frozenset({"netx", "ops", "jobs", "read"}),
read_only=True,
risk_level="low",
timeout_s=8.0,
)
__all__ = ["get_ne_exec_job_tool"]