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 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "alpha-engine-lib"
version = "0.41.0"
version = "0.42.0"
description = "Shared utilities for the Alpha Engine modules: preflight, logging, ArcticDB, dates, decision capture, cost telemetry, Anthropic payload chokepoint, artifact freshness, RAG, agent schemas, SSM secrets, Telegram + SNS alerts, EC2 spot resilience, SSM log-capture, SSM dispatcher, Step-Functions execution-state projection, and S3-conditional-PUT writer locks. Full surface documented in README."
readme = "README.md"
# EC2 still runs Python 3.9 on the always-on micro instance (boto3 drops
Expand Down
2 changes: 1 addition & 1 deletion src/alpha_engine_lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""alpha-engine-lib — shared utilities for Alpha Engine modules."""

__version__ = "0.41.0"
__version__ = "0.42.0"
13 changes: 11 additions & 2 deletions src/alpha_engine_lib/agent_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,19 @@
# ── Literals ─────────────────────────────────────────────────────────────


RegimeLiteral = Literal["bull", "neutral", "bear", "caution"]
RegimeLiteral = Literal["bull", "neutral", "bear"]
"""Macro market regime — output of the macro_economist agent and the
macro critic. Drives sector_modifiers downstream and the executor's
graduated drawdown gate."""
graduated drawdown gate.

3-class Ang-Bekaert taxonomy. The legacy 4th value ``"caution"`` was
retired in v0.42.0 (plan: caution-regime-retirement-260528.md): the
rule-based caution override at the macro-agent layer double-counted
signals already weighted into the continuous ``regime_intensity_z``
META_FEATURE. Portfolio-protective drawdown state is now a separate
axis (``drawdown_tier: Literal["risk_on","caution","risk_off"]``)
emitted by the predictor's drawdown leg; consumers compose the two
axes via most-protective override at decision time."""


CIORawDecisionLiteral = Literal["ADVANCE", "REJECT", "NO_ADVANCE_DEADLOCK"]
Expand Down
27 changes: 27 additions & 0 deletions tests/test_agent_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,33 @@ def test_regime_literal_enforced(self):
with pytest.raises(ValidationError):
MacroEconomistRawOutput(market_regime="exuberant")

def test_regime_literal_is_3class_caution_rejected(self):
# v0.42.0 retired "caution" from the macro market_regime taxonomy
# per caution-regime-retirement-260528.md. The 3-class Ang-Bekaert
# taxonomy (bull/neutral/bear) is the institutional baseline; the
# rule-based caution override at the macro-agent layer was double-
# counted by the continuous regime_intensity_z META_FEATURE.
# Portfolio-protective hysteresis (risk_on/caution/risk_off) is a
# separate axis emitted by the predictor drawdown leg.
from alpha_engine_lib.agent_schemas import (
MacroCriticOutput,
MacroEconomistRawOutput,
)

with pytest.raises(ValidationError):
MacroEconomistRawOutput(market_regime="caution")
with pytest.raises(ValidationError):
MacroCriticOutput(
action="revise", critique="elevated stress", suggested_regime="caution",
)

def test_regime_literal_accepts_all_3_classes(self):
from alpha_engine_lib.agent_schemas import MacroEconomistRawOutput

for regime in ("bull", "neutral", "bear"):
out = MacroEconomistRawOutput(market_regime=regime)
assert out.market_regime == regime


class TestMacroCriticOutput:
def test_accept_action(self):
Expand Down