INNER CODE UNIT · Python
create_watcher
bunkeriot/BunkerM · backend/app/agent-api/main.py:282
async def create_watcher(body: WatcherCreate, x_api_key: str = Header(...)):
_auth(x_api_key)
_require_activation()
with _lock:
data = _load_agents()
total = len(data["watchers"]) + len(data["jobs"])
if total >= COMMUNITY_MAX_AGENTS:
raise HTTPException(
status_code=403,
detail=f"Community limit: max {COMMUNITY_MAX_AGENTS} agents. Upgrade at bunkerai.dev",
)
watcher = {
"id": str(uuid.uuid4()),
"description": body.description,
"topic": body.topic,
"condition_operator": body.condition_operator,
"condition_value": body.condition_value,
"response_template": body.response_template,