Skip to content
Open
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
27 changes: 23 additions & 4 deletions engine/src/agent_control_engine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
from agent_control_evaluators import get_evaluator_instance
from agent_control_models import (
ConditionNode,
ControlDefinition,
ControlAction,
ControlMatch,
ControlScope,
EvaluationRequest,
EvaluationResponse,
EvaluatorResult,
Expand All @@ -42,12 +43,30 @@ def _compile_regex(pattern: str) -> Any:
return re2.compile(pattern)


class ControlDefinitionLike(Protocol):
"""Runtime control shape required by the engine."""

enabled: bool
execution: Literal["server", "sdk"]
scope: ControlScope
condition: ConditionNode
action: ControlAction


class ControlWithIdentity(Protocol):
"""Protocol for a control with identity information."""

id: int
name: str
control: ControlDefinition
@property
def id(self) -> int:
"""Database identity for the control."""

@property
def name(self) -> str:
"""Human-readable name for the control."""

@property
def control(self) -> ControlDefinitionLike:
"""Runtime control payload used during evaluation."""


@dataclass
Expand Down
28 changes: 28 additions & 0 deletions models/src/agent_control_models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@
StepSchema,
)
from .controls import (
BooleanTemplateParameter,
ConditionNode,
ControlAction,
ControlDefinition,
ControlDefinitionRuntime,
ControlMatch,
ControlScope,
ControlSelector,
EnumTemplateParameter,
EvaluatorResult,
EvaluatorSpec,
JsonValue,
RegexTemplateParameter,
SteeringContext,
StringListTemplateParameter,
StringTemplateParameter,
TemplateControlInput,
TemplateDefinition,
TemplateParameterBase,
TemplateParameterDefinition,
TemplateValue,
)
from .errors import (
ERROR_TITLES,
Expand Down Expand Up @@ -74,6 +86,8 @@
PaginationInfo,
PatchControlRequest,
PatchControlResponse,
RenderControlTemplateRequest,
RenderControlTemplateResponse,
StepKey,
ValidateControlDataRequest,
ValidateControlDataResponse,
Expand Down Expand Up @@ -104,9 +118,21 @@
"ControlMatch",
"ControlScope",
"ControlSelector",
"ControlDefinitionRuntime",
"EvaluatorSpec",
"EvaluatorResult",
"SteeringContext",
"JsonValue",
"TemplateValue",
"TemplateParameterBase",
"StringTemplateParameter",
"StringListTemplateParameter",
"EnumTemplateParameter",
"BooleanTemplateParameter",
"RegexTemplateParameter",
"TemplateParameterDefinition",
"TemplateDefinition",
"TemplateControlInput",
# Error models
"ProblemDetail",
"ErrorCode",
Expand All @@ -132,6 +158,8 @@
"PaginationInfo",
"PatchControlRequest",
"PatchControlResponse",
"RenderControlTemplateRequest",
"RenderControlTemplateResponse",
"StepKey",
"ValidateControlDataRequest",
"ValidateControlDataResponse",
Expand Down
Loading
Loading