SRE: auto-apply patches on import (add sre_patches import to __init__)
Browse files- purpose_agent/__init__.py +15 -3
purpose_agent/__init__.py
CHANGED
|
@@ -3,11 +3,15 @@ purpose_agent β A local-first self-improvement kernel for agents.
|
|
| 3 |
|
| 4 |
v3.0 features: event runtime, durable execution, memory homeostasis,
|
| 5 |
protocol interop, intelligent routing, skill evolution, agentic optimization,
|
| 6 |
-
|
|
|
|
| 7 |
"""
|
| 8 |
|
| 9 |
__version__ = "3.0.0a1"
|
| 10 |
|
|
|
|
|
|
|
|
|
|
| 11 |
# ββ Core ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 12 |
from purpose_agent.types import (
|
| 13 |
State, Action, Trajectory, TrajectoryStep,
|
|
@@ -23,10 +27,15 @@ from purpose_agent.experience_replay import ExperienceReplay
|
|
| 23 |
from purpose_agent.optimizer import HeuristicOptimizer
|
| 24 |
from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
|
| 25 |
|
| 26 |
-
# ββ First-Principles
|
| 27 |
from purpose_agent.state_delta import compute_state_delta, StateDelta, format_critic_input
|
| 28 |
from purpose_agent.falsification_critic import FalsificationCritic, FalsificationResult
|
| 29 |
from purpose_agent.sandbox_hooks import install_sandbox, SandboxPolicy, SandboxViolation, is_sandbox_installed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# ββ V2 Kernel βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 32 |
from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2
|
|
@@ -106,10 +115,13 @@ __all__ = [
|
|
| 106 |
"OpenAICompatibleBackend", "ChatMessage", "resolve_backend",
|
| 107 |
"Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
|
| 108 |
"Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
|
| 109 |
-
# First-Principles
|
| 110 |
"compute_state_delta", "StateDelta", "format_critic_input",
|
| 111 |
"FalsificationCritic", "FalsificationResult",
|
| 112 |
"install_sandbox", "SandboxPolicy", "SandboxViolation", "is_sandbox_installed",
|
|
|
|
|
|
|
|
|
|
| 113 |
# V2 Kernel
|
| 114 |
"RunMode", "MemoryScope", "PurposeScoreV2",
|
| 115 |
"Trace", "TraceEvent",
|
|
|
|
| 3 |
|
| 4 |
v3.0 features: event runtime, durable execution, memory homeostasis,
|
| 5 |
protocol interop, intelligent routing, skill evolution, agentic optimization,
|
| 6 |
+
first-principles engineering (O(1) critic, falsification scoring, PEP 578 sandbox),
|
| 7 |
+
AND SRE hardening (5 critical patches auto-applied).
|
| 8 |
"""
|
| 9 |
|
| 10 |
__version__ = "3.0.0a1"
|
| 11 |
|
| 12 |
+
# ββ SRE Patches (auto-apply on import) βββββββββββββββββββββββββββββββββββ
|
| 13 |
+
import purpose_agent.sre_patches # noqa: F401 β patches Actor, MemoryStore, ExperienceReplay, Trajectory
|
| 14 |
+
|
| 15 |
# ββ Core ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 16 |
from purpose_agent.types import (
|
| 17 |
State, Action, Trajectory, TrajectoryStep,
|
|
|
|
| 27 |
from purpose_agent.optimizer import HeuristicOptimizer
|
| 28 |
from purpose_agent.orchestrator import Orchestrator, Environment, SimpleEnvironment, TaskResult
|
| 29 |
|
| 30 |
+
# ββ First-Principles βββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 31 |
from purpose_agent.state_delta import compute_state_delta, StateDelta, format_critic_input
|
| 32 |
from purpose_agent.falsification_critic import FalsificationCritic, FalsificationResult
|
| 33 |
from purpose_agent.sandbox_hooks import install_sandbox, SandboxPolicy, SandboxViolation, is_sandbox_installed
|
| 34 |
+
from purpose_agent.hardening import (
|
| 35 |
+
safe_params, safe_string, safe_float, safe_dict_get,
|
| 36 |
+
with_timeout, llm_call_with_timeout, graceful,
|
| 37 |
+
validate_purpose, ValidationError,
|
| 38 |
+
)
|
| 39 |
|
| 40 |
# ββ V2 Kernel βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 41 |
from purpose_agent.v2_types import RunMode, MemoryScope, PurposeScoreV2
|
|
|
|
| 115 |
"OpenAICompatibleBackend", "ChatMessage", "resolve_backend",
|
| 116 |
"Actor", "PurposeFunction", "ExperienceReplay", "HeuristicOptimizer",
|
| 117 |
"Orchestrator", "Environment", "SimpleEnvironment", "TaskResult",
|
| 118 |
+
# First-Principles + Hardening
|
| 119 |
"compute_state_delta", "StateDelta", "format_critic_input",
|
| 120 |
"FalsificationCritic", "FalsificationResult",
|
| 121 |
"install_sandbox", "SandboxPolicy", "SandboxViolation", "is_sandbox_installed",
|
| 122 |
+
"safe_params", "safe_string", "safe_float", "safe_dict_get",
|
| 123 |
+
"with_timeout", "llm_call_with_timeout", "graceful",
|
| 124 |
+
"validate_purpose", "ValidationError",
|
| 125 |
# V2 Kernel
|
| 126 |
"RunMode", "MemoryScope", "PurposeScoreV2",
|
| 127 |
"Trace", "TraceEvent",
|