from active_runtime.app.agent_observability_hooks import AgentObservabilityHooks def test_agent_observability_closed_loop(): hooks = AgentObservabilityHooks() started = hooks.start("user1", "group1", "openclaw") execution_id = started["execution_id"] hooks.delegate(execution_id, "hermes") hooks.delegate(execution_id, "codex") hooks.tokens(execution_id, 100, 200) result = hooks.finish(execution_id) record = result["record"] assert record["used_hermes"] is True assert "codex" in record["path"] assert record["total_tokens"] == 300