Why Shared Models
- Single source of truth for request and response schemas
- Type safety across server and SDKs
- Independent versioning of model changes
- Easier maintenance with automatic propagation
- Clear, explicit API contracts
Installation
This package is typically installed as a dependency:Usage
Agent Models
Control Models
Evaluation Models
Models
BaseModel
Base class for all models with common utilities.model_dump()converts to a Python dictionarymodel_dump_json()converts to JSONmodel_validate()creates an instance from a dictionary- Accepts both
snake_caseandcamelCasefields - Validates on assignment
- Provides JSON-compatible serialization
Agent
Agent metadata and configuration.agent_name(str): Unique immutable agent identifieragent_description(Optional[str]): Agent descriptionagent_created_at(Optional[str]): ISO 8601 created timestampagent_updated_at(Optional[str]): ISO 8601 updated timestampagent_version(Optional[str]): Semantic version stringagent_metadata(Optional[Dict]): Free-form metadata
Step
Runtime payload for an agent step invocation.type(str): Step type (toolorllm)name(str): Step name (tool name or model/chain id)input(JSON value): Step input contentoutput(Optional JSON value): Step output contentcontext(Optional JSON object): Optional context
ControlDefinition
Complete control specification.description(Optional[str]): Control descriptionenabled(bool): Whether control is activeexecution(str): Execution mode (serverorsdk)scope(ControlScope): When to apply the controlcondition(ConditionNode): Recursive condition tree; leaf nodes containselector+evaluatoraction(ControlAction): What to do on matchtags(List[str]): Tags for categorization
ConditionNode
Recursive condition tree used byControlDefinition.condition.
- Leaf nodes contain both
selectorandevaluator - Composite nodes contain exactly one of
and,or, ornot - Maximum nesting depth is 6
ControlSelector
Selector used inside a leaf condition.path(Optional[str]): Dot-path for the value to evaluate; defaults to"*"- Common paths:
input,output,input.query,context.user_id,name,*
EvaluatorSpec
Evaluator used inside a leaf condition.name(str): Evaluator name, such asregex,list,sql, orgalileo.luna2config(Dict[str, Any]): Evaluator-specific configuration payload
EvaluationRequest
Request for evaluating controls.agent_name(str): Agent identifierstep(Step): Step payload to evaluatestage(str): Evaluation stage (preorpost)
EvaluationResponse
Server response for evaluation analysis.is_safe(bool): Whether content is safeconfidence(float): Confidence score (0.0 to 1.0)reason(Optional[str]): Explanation for the decisionmatches(Optional[List[ControlMatch]]): Controls that matchederrors(Optional[List[ControlMatch]]): Controls that failed during evaluationnon_matches(Optional[List[ControlMatch]]): Controls that did not match
HealthResponse
Health check response.status(str): Health statusversion(str): Application version
Design Patterns
Pydantic v2
All models use Pydantic v2 for validation and serialization:Type Safety
Models provide strong typing throughout the stack:Extensibility
Models support additional metadata for extensibility:Development
Adding New Models
- Create a new file in
src/agent_control_models/ - Define models extending
BaseModel - Export them in
__init__.py - Update both server and SDK to use the new models
Testing
Best Practices
- Always extend
BaseModelto get JSON and dict conversion - Use
Fieldfor validation and descriptions - Keep models simple and data-only
- Version carefully because models affect server and SDKs
- Document fields with
Fielddescriptions - Use
Optionalappropriately
Source Code
View the complete models source code and implementation:Agent Control Models