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
2 changes: 1 addition & 1 deletion adaptive_runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Adaptive Runtime
"""

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .state_engine import StateEngine
from .state_engine import StateEngine
from .context_engine import ContextEngine, ContextResult
from .confidence_engine import ConfidenceEngine, ConfidenceResult
from .decision_engine import DecisionEngine, DecisionResult
Expand Down
6 changes: 3 additions & 3 deletions adaptive_runtime/core/confidence_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Confidence Engine - adaptive probabilistic confidence scoring.
"""

Expand Down Expand Up @@ -79,7 +79,7 @@ def calculate(self, event: dict, context_risk: str) -> ConfidenceResult:
)
metrics.record("confidence.final", final)
logger.info(
"Confidence → base=%.2f decay=%.2f hist=%.2f ctx=%.2f final=%.4f",
"Confidence base=%.2f decay=%.2f hist=%.2f ctx=%.2f final=%.4f",
base, decay, hist_weight, ctx_adj, final,
)
return result
Expand All @@ -104,7 +104,7 @@ def _history_weight(self, context_risk: str) -> float:
if len(relevant) < 3:
return 1.0
success_rate = sum(1 for r in relevant if r.success) / len(relevant)
# Map [0, 1] success rate → [0.6, 1.1] weight
# Map [0, 1] success rate [0.6, 1.1] weight
return 0.6 + success_rate * 0.5


4 changes: 2 additions & 2 deletions adaptive_runtime/core/context_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Context Engine - transforms raw events into contextual understanding.
"""

Expand Down Expand Up @@ -85,7 +85,7 @@ def analyze(self, event: dict) -> ContextResult:

metrics.record("context.pressure", pressure)
logger.info(
"Context → risk=%s stability=%s ctx=%s pressure=%.2f",
"Context risk=%s stability=%s ctx=%s pressure=%.2f",
risk, stability, context_label, pressure,
)
return result
Expand Down
6 changes: 3 additions & 3 deletions adaptive_runtime/core/decision_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Decision Engine - generates adaptive runtime decisions.
"""

Expand All @@ -17,7 +17,7 @@ class DecisionResult(BaseModel):
metadata: dict = {}


# Each rule: (context_label, risk_level, min_confidence) → action
# Each rule: (context_label, risk_level, min_confidence) action
# Evaluated top-to-bottom; first match wins.

_RULES: list[tuple[str | None, str | None, float, str, str]] = [
Expand Down Expand Up @@ -78,7 +78,7 @@ def decide(
)
metrics.record("decision.confidence", confidence)
logger.info(
"Decision → action=%s confidence=%.3f reason=%s priority=%s",
"Decision action=%s confidence=%.3f reason=%s priority=%s",
action, confidence, reason, priority,
)
return result
Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/core/recovery_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Recovery Engine - self-healing runtime resilience.
"""

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/core/state_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
State Engine - manages runtime persistence and state memory.
"""

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/observability/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .logger import get_logger
from .logger import get_logger
from .metrics import metrics, MetricsCollector

__all__ = ["get_logger", "metrics", "MetricsCollector"]
Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/observability/logger.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Structured logger for Adaptive Runtime.
"""

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/observability/metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
In-memory lightweight metrics collector.
"""

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .runtime_manager import Runtime, RuntimeResult
from .runtime_manager import Runtime, RuntimeResult
from .event_bus import EventBus
from .cache import TTLCache

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/runtime/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import asyncio
import time
import os
import sys
Expand Down
4 changes: 2 additions & 2 deletions adaptive_runtime/runtime/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Lightweight TTL-based in-memory cache for the runtime.
"""

Expand All @@ -13,7 +13,7 @@ class TTLCache:
"""

def __init__(self, default_ttl: float = 60.0):
self._store: dict[str, tuple[any, float]] = {} # key → (value, expires_at)
self._store: dict[str, tuple[any, float]] = {} # key (value, expires_at)
self._default_ttl = default_ttl
self._lock = Lock()

Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/runtime/event_bus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Async event bus - pub/sub within a single runtime process.
"""

Expand Down
4 changes: 2 additions & 2 deletions adaptive_runtime/runtime/runtime_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Runtime Manager - central orchestrator of all engines.

Usage:
Expand Down Expand Up @@ -96,7 +96,7 @@ async def stop(self) -> None:
async def process(self, event: dict) -> RuntimeResult:
"""
Full pipeline:
Event → Context → Confidence → Decision → State → Recovery
Event Context Confidence Decision State Recovery
"""
if not self._started:
await self.start()
Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .sqlite_store import SQLiteStore
from .sqlite_store import SQLiteStore
from .memory_store import MemoryStore

__all__ = ["SQLiteStore", "MemoryStore"]
Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/storage/memory_store.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
In-process memory store - useful for testing or ephemeral agents.
Mirrors the SQLiteStore async API.
"""
Expand Down
2 changes: 1 addition & 1 deletion adaptive_runtime/storage/sqlite_store.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
"""
Async SQLite persistence layer for runtime state and snapshots.
"""

Expand Down
Loading