Files
microdao-daarion/scripts/demo_trace.py
Apple ef3473db21 snapshot: NODE1 production state 2026-02-09
Complete snapshot of /opt/microdao-daarion/ from NODE1 (144.76.224.179).
This represents the actual running production code that has diverged
significantly from the previous main branch.

Key changes from old main:
- Gateway (http_api.py): expanded from ~40KB to 164KB with full agent support
- Router: new /v1/agents/{id}/infer endpoint with vision + DeepSeek routing
- Behavior Policy: SOWA v2.2 (3-level: FULL/ACK/SILENT)
- Agent Registry: config/agent_registry.yml as single source of truth
- 13 agents configured (was 3)
- Memory service integration
- CrewAI teams and roles

Excluded from snapshot: venv/, .env, data/, backups, .tgz archives

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-09 08:46:46 -08:00

46 lines
1.2 KiB
Python

import hashlib
import hmac
import json
import os
import time
import uuid
import requests
INTEGRATION_BASE_URL = os.getenv("INTEGRATION_BASE_URL", "http://localhost:8800")
AGX_HMAC_SECRET = os.getenv("AGX_HMAC_SECRET", "")
TRACE_ID = os.getenv("AGX_TRACE_ID", "trace-demo-001")
def sign(body: dict):
if not AGX_HMAC_SECRET:
return {}
ts = str(int(time.time() * 1000))
nonce = str(uuid.uuid4())
body_json = json.dumps(body, separators=(",", ":"), sort_keys=True)
payload = f"{ts}.{nonce}.{body_json}"
sig = hmac.new(AGX_HMAC_SECRET.encode(), payload.encode(), hashlib.sha256).hexdigest()
return {
"X-AGX-SIGNATURE": sig,
"X-AGX-TIMESTAMP": ts,
"X-AGX-NONCE": nonce,
"Content-Type": "application/json"
}
def main():
payload = {
"assetRef": {"source": "demo", "deviceId": "demo-device-1"},
"metric": "soil_moisture",
"value": 21.7,
"ts": int(time.time() * 1000),
"schema_version": "1.0"
}
headers = sign(payload)
headers["X-AGX-TRACE-ID"] = TRACE_ID
r = requests.post(f"{INTEGRATION_BASE_URL}/write/observation", data=json.dumps(payload), headers=headers, timeout=20)
print(r.status_code, r.text)
if __name__ == "__main__":
main()