Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions agentwatch/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@
from agentwatch.adapters.openai_agents import * # noqa: F401, F403
from agentwatch.adapters.openclaw import * # noqa: F401, F403
from agentwatch.adapters.smolagents import * # noqa: F401, F403

__all__ = [
"AutoGenAdapter",
"AutoGPTAdapter",
"ClaudeCodeEventParser",
"ClaudeCodeAdapter",
"watch_claude_code",
"AgentWatchCallbackHandler",
"create_langchain_handler",
"LangGraphAdapter",
"AgentWatchOpenAIAgentsAdapter",
"OpenClawAdapter",
"SmolagentsAdapter",
]
5 changes: 5 additions & 0 deletions agentwatch/alerting/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from agentwatch.alerting.engine import *

__all__ = [
"AlertingConfig",
"AlertingEngine",
]
28 changes: 28 additions & 0 deletions agentwatch/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,31 @@
SafetyPolicy,
)
from agentwatch.core.schema import *

__all__ = [
"EventBus",
"EventFilter",
"get_event_bus",
"DEFAULT_POLICY",
"RiskPattern",
"RiskScorer",
"SafetyEngine",
"SafetyPolicy",
"EventType",
"RiskLevel",
"AgentFramework",
"ExecutionStatus",
"TokenUsage",
"ToolCallData",
"ToolResultData",
"SafetyCheckData",
"MemoryData",
"ConfidenceData",
"AgentMessageData",
"CheckpointData",
"AgentEvent",
"AgentSession",
"TaskNode",
"PluginPermissions",
"PluginManifest",
]
6 changes: 6 additions & 0 deletions agentwatch/cost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
from agentwatch.cost.semantic_cache import SemanticCache
from agentwatch.cost.tracker import *

__all__ = [
"SemanticCache",
"SessionBudget",
"CostTracker",
]
12 changes: 12 additions & 0 deletions agentwatch/governance/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
from agentwatch.governance.compliance_reporter import *
from agentwatch.governance.engine import *

__all__ = [
"ComplianceReport",
"ComplianceReporter",
"Permission",
"AuditEventType",
"Role",
"Principal",
"AuditEntry",
"BUILTIN_ROLES",
"GovernanceEngine",
]
11 changes: 11 additions & 0 deletions agentwatch/memory/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
from agentwatch.memory.engine import *

__all__ = [
"MemoryType",
"ImportanceLevel",
"MemoryEntry",
"MemorySearchResult",
"ContradictionReport",
"EmbeddingProvider",
"MemoryStore",
"MemoryEngine",
]
10 changes: 10 additions & 0 deletions agentwatch/orchestration/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
from agentwatch.orchestration.engine import *

__all__ = [
"AgentRole",
"MessageType",
"AgentMessage",
"SubAgent",
"TaskGraph",
"SharedMemoryBus",
"OrchestrationEngine",
]
5 changes: 5 additions & 0 deletions agentwatch/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
from agentwatch.plugins.sandbox import *

__all__ = [
"SandboxViolationError",
"PermissionEnforcer",
]
7 changes: 7 additions & 0 deletions agentwatch/reasoning/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
from agentwatch.reasoning.auditor import *

__all__ = [
"JudgeCallback",
"StepAudit",
"AuditSummary",
"ReasoningAuditor",
]
11 changes: 11 additions & 0 deletions agentwatch/replay/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
from agentwatch.replay.engine import *

__all__ = [
"ReplaySpeed",
"DivergenceType",
"FailureCause",
"ReplayStep",
"Divergence",
"FailureAnalysis",
"ReplaySession",
"ReplayEngine",
]
10 changes: 10 additions & 0 deletions agentwatch/rollback/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
from agentwatch.rollback.engine import *

__all__ = [
"CheckpointType",
"RollbackStatus",
"Checkpoint",
"RollbackResult",
"FilesystemSnapshot",
"GitCheckpointer",
"RollbackEngine",
]
14 changes: 14 additions & 0 deletions agentwatch/scoring/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
from agentwatch.scoring.confidence import *

__all__ = [
"ANOMALY_GOAL_DRIFT",
"ANOMALY_TOOL_LOOP",
"ANOMALY_REPEATED_FAILURES",
"ANOMALY_HALLUCINATED_SUCCESS",
"ANOMALY_NO_PROGRESS",
"ANOMALY_HIGH_RISK_ACTION",
"ANOMALY_MEMORY_CONTRADICTION",
"ANOMALY_IRRELEVANT_TOOLS",
"ANOMALY_CONTEXT_EXPLOSION",
"ScoringResult",
"ConfidenceScorer",
]
6 changes: 6 additions & 0 deletions agentwatch/tracing/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
from agentwatch.tracing.collector import *
from agentwatch.tracing.otel import *

__all__ = [
"TraceSpan",
"Trace",
"TraceCollector",
]
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
# __init__.py re-exports: wildcard imports and implicit re-exports are intentional
"agentwatch/**/__init__.py" = ["F401", "F403"]
"agentwatch/*/__init__.py" = ["F401", "F403"]
# (F405: __all__ names resolve through those wildcards).
"agentwatch/**/__init__.py" = ["F401", "F403", "F405"]
"agentwatch/*/__init__.py" = ["F401", "F403", "F405"]

[tool.mypy]
python_version = "3.12"
Expand Down
54 changes: 54 additions & 0 deletions tests/test_package_exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Every wildcard-re-exporting package must declare a resolvable __all__."""

from __future__ import annotations

import importlib

import pytest

# Packages whose __init__ uses `from .sub import *`; each must pin its public
# surface with an explicit __all__ so `import *` is honest and knowable.
WILDCARD_PACKAGES = [
"adapters",
"alerting",
"core",
"cost",
"governance",
"memory",
"orchestration",
"plugins",
"reasoning",
"replay",
"rollback",
"scoring",
"tracing",
]


@pytest.mark.parametrize("pkg", WILDCARD_PACKAGES)
def test_package_defines_all(pkg):
module = importlib.import_module(f"agentwatch.{pkg}")
assert isinstance(getattr(module, "__all__", None), list)
assert module.__all__, "__all__ must not be empty"


@pytest.mark.parametrize("pkg", WILDCARD_PACKAGES)
def test_all_names_resolve(pkg):
module = importlib.import_module(f"agentwatch.{pkg}")
missing = [name for name in module.__all__ if not hasattr(module, name)]
assert not missing, f"agentwatch.{pkg}.__all__ lists undefined names: {missing}"


@pytest.mark.parametrize("pkg", WILDCARD_PACKAGES)
def test_all_has_no_duplicates(pkg):
names = importlib.import_module(f"agentwatch.{pkg}").__all__
assert len(names) == len(set(names))


@pytest.mark.parametrize("pkg", WILDCARD_PACKAGES)
def test_star_import_matches_all(pkg):
module = importlib.import_module(f"agentwatch.{pkg}")
ns: dict[str, object] = {}
exec(f"from agentwatch.{pkg} import *", ns) # noqa: S102
exported = {k for k in ns if not k.startswith("__")}
assert exported == set(module.__all__)
Loading