Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

refactor(swarm): mount the harness agent rail for single-agent runs

alan_cheng0b5f6c5d9032
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
index b01d96c603..d10841ddfb 100644
--- a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
+++ b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
@@ -9127,17 +9127,17 @@ class JiuWenSwarmDeepAdapter:
# for task-loop runs, or agent.<name>.invoke for single-round) under the root
# run span per iteration/round. It is the only thing that creates the
# task_iteration / invoke spans that llm.call + tool.* nest under. It
- # self-disables (before_* returns early when get_team_span() is None), so
+ # self-disables (before_* returns early when there is no run root span), so
# attaching it unconditionally is safe and also adapts to runtime
# enable/disable of agent_observability without rebuilding the agent.
+ # The harness rail owns the complete single-agent tier; team identity is
+ # supplied separately by the team blueprint.
try:
- from openjiuwen.agent_teams.observability.rail import ObservabilityRail
- from openjiuwen.harness.observability import AgentTraceBindingRail
+ from openjiuwen.harness.observability import AgentObservabilityRail
- rails_list.append(AgentTraceBindingRail())
- rails_list.append(ObservabilityRail())
+ rails_list.append(AgentObservabilityRail())
except Exception as exc:
- logger.warning("%s Failed to attach ObservabilityRail: %s", log_prefix, exc)
+ logger.warning("%s Failed to attach AgentObservabilityRail: %s", log_prefix, exc)
stage_timer.mark("observability_rail")
# Bind tenant checkpointer after rails exist (set_checkpoint runs earlier).
diff --git a/tests/unit_tests/agentserver/test_deep_adapter_rail_build_timing.py b/tests/unit_tests/agentserver/test_deep_adapter_rail_build_timing.py
index 2e4369ee60..07aaea9bfb 100644
--- a/tests/unit_tests/agentserver/test_deep_adapter_rail_build_timing.py
+++ b/tests/unit_tests/agentserver/test_deep_adapter_rail_build_timing.py
@@ -55,7 +55,7 @@ class _NoHooks:
events: dict = {}
-_OBSERVABILITY_RAIL_MODULE = "openjiuwen.agent_teams.observability.rail"
+_OBSERVABILITY_RAIL_MODULE = "openjiuwen.harness.observability"
@pytest.fixture(autouse=True)
@@ -69,7 +69,7 @@ def _stub_observability_rail(monkeypatch: pytest.MonkeyPatch) -> None:
means the function-level import resolves without the real one ever loading.
"""
stub_module = types.ModuleType(_OBSERVABILITY_RAIL_MODULE)
- stub_module.ObservabilityRail = lambda: object()
+ stub_module.AgentObservabilityRail = lambda: object()
monkeypatch.setitem(sys.modules, _OBSERVABILITY_RAIL_MODULE, stub_module)