coreason-manifest 0.10.0__tar.gz → 0.12.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/PKG-INFO +48 -71
- coreason_manifest-0.12.0/README.md +95 -0
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/pyproject.toml +6 -2
- coreason_manifest-0.12.0/src/coreason_manifest/__init__.py +51 -0
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/base.py → coreason_manifest-0.12.0/src/coreason_manifest/common.py +18 -1
- coreason_manifest-0.12.0/src/coreason_manifest/governance.py +83 -0
- coreason_manifest-0.12.0/src/coreason_manifest/schemas/coreason-v2.schema.json +462 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/__init__.py +1 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/governance.py +144 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/io.py +132 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/resolver.py +67 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/spec/__init__.py +1 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/spec/contracts.py +34 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/spec/definitions.py +196 -0
- coreason_manifest-0.12.0/src/coreason_manifest/v2/validator.py +48 -0
- coreason_manifest-0.10.0/README.md +0 -119
- coreason_manifest-0.10.0/src/coreason_manifest/__init__.py +0 -98
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/__init__.py +0 -60
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/agent.py +0 -370
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/audit.py +0 -181
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/events.py +0 -423
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/message.py +0 -188
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/simulation.py +0 -79
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/simulation_config.py +0 -46
- coreason_manifest-0.10.0/src/coreason_manifest/definitions/topology.py +0 -341
- coreason_manifest-0.10.0/src/coreason_manifest/recipes.py +0 -84
- coreason_manifest-0.10.0/src/coreason_manifest/schemas/agent.schema.json +0 -1051
- coreason_manifest-0.10.0/src/coreason_manifest/schemas/recipe.schema.json +0 -813
- coreason_manifest-0.10.0/src/coreason_manifest/v1/__init__.py +0 -15
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/LICENSE +0 -0
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/NOTICE +0 -0
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/src/coreason_manifest/schemas/__init__.py +0 -0
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/src/coreason_manifest/utils/__init__.py +0 -0
- {coreason_manifest-0.10.0 → coreason_manifest-0.12.0}/src/coreason_manifest/utils/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coreason_manifest
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: This package is the definitive source of truth. If it isn't in the manifest, it doesn't exist. If it violates the manifest, it doesn't run.
|
|
5
5
|
License: # The Prosperity Public License 3.0.0
|
|
6
6
|
|
|
@@ -68,6 +68,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
68
68
|
Classifier: Programming Language :: Python :: 3.12
|
|
69
69
|
Classifier: Operating System :: OS Independent
|
|
70
70
|
Requires-Dist: coreason-identity (>=0.4.1,<0.5.0)
|
|
71
|
+
Requires-Dist: jsonschema (>=4.19.0,<5.0.0)
|
|
71
72
|
Requires-Dist: loguru (>=0.7.2,<0.8.0)
|
|
72
73
|
Requires-Dist: pydantic (>=2.12.5,<3.0.0)
|
|
73
74
|
Requires-Dist: pyyaml (>=6.0.3,<7.0.0)
|
|
@@ -87,31 +88,25 @@ The definitive source of truth for CoReason-AI Asset definitions. "The Blueprint
|
|
|
87
88
|
|
|
88
89
|
## Overview
|
|
89
90
|
|
|
90
|
-
`coreason-manifest` serves as the **Shared Kernel** for the Coreason ecosystem. It contains the canonical Pydantic definitions, schemas, and data structures for Agents
|
|
91
|
+
`coreason-manifest` serves as the **Shared Kernel** for the Coreason ecosystem. It contains the canonical Pydantic definitions, schemas, and data structures for Agents and Workflows (Recipes).
|
|
91
92
|
|
|
92
93
|
It provides the **"Blueprint"** that all other services (Builder, Engine, Simulator) rely on. It focuses on strict typing, schema validation, and serialization, ensuring that if it isn't in the manifest, it doesn't exist.
|
|
93
94
|
|
|
95
|
+
### Standards Clarification
|
|
96
|
+
*Note: The "Coreason Agent Manifest" (CAM) is a proprietary, strict governance schema designed for the CoReason Platform. It is distinct from the Oracle/Linux Foundation "Open Agent Specification," though we aim for future interoperability via adapters.*
|
|
97
|
+
|
|
94
98
|
## Features
|
|
95
99
|
|
|
96
|
-
* **
|
|
97
|
-
* **Strict Typing:** Enforces type safety
|
|
98
|
-
* **
|
|
99
|
-
* **
|
|
100
|
-
* **
|
|
101
|
-
* **
|
|
102
|
-
* **Ergonomic Factory Methods:** Simplified construction of `ChatMessage` and `GenAIOperation`.
|
|
103
|
-
* **Token Arithmetic:** Support for `+` and `+=` operators on `GenAITokenUsage`.
|
|
104
|
-
* **Flexible Tooling:** `ToolCallRequestPart` accepts JSON strings with automatic parsing.
|
|
105
|
-
* **Enhanced Tracing:** `ReasoningTrace` includes flexible metadata for execution state.
|
|
100
|
+
* **Coreason Agent Manifest (CAM):** Strict Pydantic models for Agent definitions (`AgentDefinition`) and Recipes (`Recipe`).
|
|
101
|
+
* **Strict Typing:** Enforces type safety for critical interfaces.
|
|
102
|
+
* **Governance & Policy:** Enforce organizational rules (domains, risk levels) on agents via `GovernanceConfig`.
|
|
103
|
+
* **Ergonomic Factory Methods:** Simplified construction of manifests.
|
|
104
|
+
* **Flexible Tooling:** Support for external tool definitions (`ToolDefinition`) and risk levels (`ToolRiskLevel`).
|
|
105
|
+
* **Topology Visualization:** Workflows are defined as graph topologies (`Workflow`).
|
|
106
106
|
|
|
107
107
|
## Serialization & Base Model
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
* Use `.dump()` to get a JSON-compatible dictionary (where UUIDs/datetimes are strings).
|
|
112
|
-
* Use `.to_json()` to get a JSON string.
|
|
113
|
-
|
|
114
|
-
For a detailed rationale, see [docs/coreason_base_model_rationale.md](docs/coreason_base_model_rationale.md).
|
|
109
|
+
Core definitions (e.g., `Manifest`, `Workflow`, `AgentDefinition`) inherit from Pydantic's `BaseModel`. Shared configuration models like `GovernanceConfig` inherit from `CoReasonBaseModel` for enhanced serialization capabilities.
|
|
115
110
|
|
|
116
111
|
## Installation
|
|
117
112
|
|
|
@@ -124,75 +119,57 @@ pip install coreason-manifest
|
|
|
124
119
|
This library is used to define and validate Agent configurations programmatically.
|
|
125
120
|
|
|
126
121
|
```python
|
|
127
|
-
import
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
AgentDependencies,
|
|
136
|
-
ToolRequirement,
|
|
137
|
-
ToolRiskLevel,
|
|
138
|
-
PolicyConfig,
|
|
139
|
-
ObservabilityConfig,
|
|
140
|
-
TraceLevel
|
|
122
|
+
from coreason_manifest import (
|
|
123
|
+
Recipe,
|
|
124
|
+
ManifestMetadata,
|
|
125
|
+
AgentStep,
|
|
126
|
+
Workflow,
|
|
127
|
+
InterfaceDefinition,
|
|
128
|
+
StateDefinition,
|
|
129
|
+
PolicyDefinition
|
|
141
130
|
)
|
|
142
131
|
|
|
143
132
|
# 1. Define Metadata
|
|
144
|
-
metadata =
|
|
145
|
-
id=uuid.uuid4(),
|
|
146
|
-
version="1.0.0", # Strict SemVer
|
|
133
|
+
metadata = ManifestMetadata(
|
|
147
134
|
name="Research Agent",
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
version="1.0.0"
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# 2. Define Workflow
|
|
139
|
+
workflow = Workflow(
|
|
140
|
+
start="step1",
|
|
141
|
+
steps={
|
|
142
|
+
"step1": AgentStep(
|
|
143
|
+
id="step1",
|
|
144
|
+
agent="gpt-4-researcher",
|
|
145
|
+
next="step2"
|
|
146
|
+
),
|
|
147
|
+
# ... define other steps
|
|
148
|
+
}
|
|
150
149
|
)
|
|
151
150
|
|
|
152
|
-
#
|
|
153
|
-
|
|
151
|
+
# 3. Instantiate Manifest
|
|
152
|
+
manifest = Recipe(
|
|
153
|
+
apiVersion="coreason.ai/v2",
|
|
154
|
+
kind="Recipe",
|
|
154
155
|
metadata=metadata,
|
|
155
|
-
interface=
|
|
156
|
+
interface=InterfaceDefinition(
|
|
156
157
|
inputs={"topic": {"type": "string"}},
|
|
157
158
|
outputs={"summary": {"type": "string"}}
|
|
158
159
|
),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
temperature=0.0,
|
|
163
|
-
system_prompt="You are a helpful assistant."
|
|
164
|
-
)
|
|
165
|
-
),
|
|
166
|
-
dependencies=AgentDependencies(
|
|
167
|
-
tools=[
|
|
168
|
-
ToolRequirement(
|
|
169
|
-
uri="mcp://search-service/google",
|
|
170
|
-
hash="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", # Valid SHA256
|
|
171
|
-
scopes=["search:read"],
|
|
172
|
-
risk_level=ToolRiskLevel.STANDARD
|
|
173
|
-
)
|
|
174
|
-
],
|
|
175
|
-
libraries=("pandas==2.0.0",)
|
|
176
|
-
),
|
|
177
|
-
policy=PolicyConfig(
|
|
178
|
-
budget_caps={"total_cost": 5.0}
|
|
179
|
-
),
|
|
180
|
-
observability=ObservabilityConfig(
|
|
181
|
-
trace_level=TraceLevel.FULL,
|
|
182
|
-
retention_policy="90_days"
|
|
183
|
-
),
|
|
184
|
-
# Mandatory Integrity Hash
|
|
185
|
-
integrity_hash="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
|
|
160
|
+
state=StateDefinition(),
|
|
161
|
+
policy=PolicyDefinition(max_retries=3),
|
|
162
|
+
workflow=workflow
|
|
186
163
|
)
|
|
187
164
|
|
|
188
|
-
print(f"
|
|
165
|
+
print(f"Manifest '{manifest.metadata.name}' created successfully.")
|
|
189
166
|
```
|
|
190
167
|
|
|
191
168
|
For full details, see the [Usage Documentation](docs/usage.md).
|
|
192
169
|
|
|
193
170
|
## Documentation
|
|
194
171
|
|
|
195
|
-
* [
|
|
196
|
-
* [
|
|
197
|
-
* [
|
|
172
|
+
* [Usage Guide](docs/usage.md): How to load and create manifests.
|
|
173
|
+
* [Governance & Policy Enforcement](docs/governance_policy_enforcement.md): Validating agents against organizational rules.
|
|
174
|
+
* [Coreason Agent Manifest (CAM)](docs/cap/specification.md): The Canonical YAML Authoring Format.
|
|
198
175
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Coreason Manifest
|
|
2
|
+
|
|
3
|
+
The definitive source of truth for CoReason-AI Asset definitions. "The Blueprint."
|
|
4
|
+
|
|
5
|
+
[](https://github.com/CoReason-AI/coreason-manifest)
|
|
6
|
+
[](https://github.com/CoReason-AI/coreason-manifest/actions)
|
|
7
|
+
[](https://github.com/astral-sh/ruff)
|
|
8
|
+
[](docs/product_requirements.md)
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
`coreason-manifest` serves as the **Shared Kernel** for the Coreason ecosystem. It contains the canonical Pydantic definitions, schemas, and data structures for Agents and Workflows (Recipes).
|
|
13
|
+
|
|
14
|
+
It provides the **"Blueprint"** that all other services (Builder, Engine, Simulator) rely on. It focuses on strict typing, schema validation, and serialization, ensuring that if it isn't in the manifest, it doesn't exist.
|
|
15
|
+
|
|
16
|
+
### Standards Clarification
|
|
17
|
+
*Note: The "Coreason Agent Manifest" (CAM) is a proprietary, strict governance schema designed for the CoReason Platform. It is distinct from the Oracle/Linux Foundation "Open Agent Specification," though we aim for future interoperability via adapters.*
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
* **Coreason Agent Manifest (CAM):** Strict Pydantic models for Agent definitions (`AgentDefinition`) and Recipes (`Recipe`).
|
|
22
|
+
* **Strict Typing:** Enforces type safety for critical interfaces.
|
|
23
|
+
* **Governance & Policy:** Enforce organizational rules (domains, risk levels) on agents via `GovernanceConfig`.
|
|
24
|
+
* **Ergonomic Factory Methods:** Simplified construction of manifests.
|
|
25
|
+
* **Flexible Tooling:** Support for external tool definitions (`ToolDefinition`) and risk levels (`ToolRiskLevel`).
|
|
26
|
+
* **Topology Visualization:** Workflows are defined as graph topologies (`Workflow`).
|
|
27
|
+
|
|
28
|
+
## Serialization & Base Model
|
|
29
|
+
|
|
30
|
+
Core definitions (e.g., `Manifest`, `Workflow`, `AgentDefinition`) inherit from Pydantic's `BaseModel`. Shared configuration models like `GovernanceConfig` inherit from `CoReasonBaseModel` for enhanced serialization capabilities.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install coreason-manifest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
This library is used to define and validate Agent configurations programmatically.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from coreason_manifest import (
|
|
44
|
+
Recipe,
|
|
45
|
+
ManifestMetadata,
|
|
46
|
+
AgentStep,
|
|
47
|
+
Workflow,
|
|
48
|
+
InterfaceDefinition,
|
|
49
|
+
StateDefinition,
|
|
50
|
+
PolicyDefinition
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# 1. Define Metadata
|
|
54
|
+
metadata = ManifestMetadata(
|
|
55
|
+
name="Research Agent",
|
|
56
|
+
version="1.0.0"
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# 2. Define Workflow
|
|
60
|
+
workflow = Workflow(
|
|
61
|
+
start="step1",
|
|
62
|
+
steps={
|
|
63
|
+
"step1": AgentStep(
|
|
64
|
+
id="step1",
|
|
65
|
+
agent="gpt-4-researcher",
|
|
66
|
+
next="step2"
|
|
67
|
+
),
|
|
68
|
+
# ... define other steps
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# 3. Instantiate Manifest
|
|
73
|
+
manifest = Recipe(
|
|
74
|
+
apiVersion="coreason.ai/v2",
|
|
75
|
+
kind="Recipe",
|
|
76
|
+
metadata=metadata,
|
|
77
|
+
interface=InterfaceDefinition(
|
|
78
|
+
inputs={"topic": {"type": "string"}},
|
|
79
|
+
outputs={"summary": {"type": "string"}}
|
|
80
|
+
),
|
|
81
|
+
state=StateDefinition(),
|
|
82
|
+
policy=PolicyDefinition(max_retries=3),
|
|
83
|
+
workflow=workflow
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
print(f"Manifest '{manifest.metadata.name}' created successfully.")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
For full details, see the [Usage Documentation](docs/usage.md).
|
|
90
|
+
|
|
91
|
+
## Documentation
|
|
92
|
+
|
|
93
|
+
* [Usage Guide](docs/usage.md): How to load and create manifests.
|
|
94
|
+
* [Governance & Policy Enforcement](docs/governance_policy_enforcement.md): Validating agents against organizational rules.
|
|
95
|
+
* [Coreason Agent Manifest (CAM)](docs/cap/specification.md): The Canonical YAML Authoring Format.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "coreason_manifest"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.12.0"
|
|
4
4
|
description = "This package is the definitive source of truth. If it isn't in the manifest, it doesn't exist. If it violates the manifest, it doesn't run."
|
|
5
5
|
authors = ["Gowtham A Rao <gowtham.rao@coreason.ai>"]
|
|
6
6
|
license = "Prosperity-3.0"
|
|
@@ -13,6 +13,7 @@ loguru = "^0.7.2"
|
|
|
13
13
|
pydantic = "^2.12.5"
|
|
14
14
|
pyyaml = "^6.0.3"
|
|
15
15
|
coreason-identity = "^0.4.1"
|
|
16
|
+
jsonschema = "^4.19.0"
|
|
16
17
|
|
|
17
18
|
[tool.poetry.group.dev.dependencies]
|
|
18
19
|
pytest = "^9.0.2"
|
|
@@ -32,7 +33,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
32
33
|
|
|
33
34
|
[project]
|
|
34
35
|
name = "coreason_manifest"
|
|
35
|
-
version = "0.
|
|
36
|
+
version = "0.12.0"
|
|
36
37
|
description = "This package is the definitive source of truth. If it isn't in the manifest, it doesn't exist. If it violates the manifest, it doesn't run."
|
|
37
38
|
readme = "README.md"
|
|
38
39
|
requires-python = ">=3.12"
|
|
@@ -59,6 +60,9 @@ target-version = "py312"
|
|
|
59
60
|
select = ["E", "F", "B", "I"]
|
|
60
61
|
ignore = []
|
|
61
62
|
|
|
63
|
+
[tool.ruff.lint.isort]
|
|
64
|
+
known-first-party = ["coreason_manifest"]
|
|
65
|
+
|
|
62
66
|
[tool.mypy]
|
|
63
67
|
python_version = "3.12"
|
|
64
68
|
strict = true
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Copyright (c) 2025 CoReason, Inc.
|
|
2
|
+
#
|
|
3
|
+
# This software is proprietary and dual-licensed.
|
|
4
|
+
# Licensed under the Prosperity Public License 3.0 (the "License").
|
|
5
|
+
# A copy of the license is available at https://prosperitylicense.com/versions/3.0.0
|
|
6
|
+
# For details, see the LICENSE file.
|
|
7
|
+
# Commercial use beyond a 30-day trial requires a separate license.
|
|
8
|
+
#
|
|
9
|
+
# Source Code: https://github.com/CoReason-AI/coreason-manifest
|
|
10
|
+
|
|
11
|
+
from .v2.io import dump_to_yaml, load_from_yaml
|
|
12
|
+
from .v2.spec.contracts import InterfaceDefinition, PolicyDefinition, StateDefinition
|
|
13
|
+
from .v2.spec.definitions import (
|
|
14
|
+
AgentDefinition,
|
|
15
|
+
AgentStep,
|
|
16
|
+
CouncilStep,
|
|
17
|
+
LogicStep,
|
|
18
|
+
ManifestMetadata,
|
|
19
|
+
ManifestV2,
|
|
20
|
+
Step,
|
|
21
|
+
SwitchStep,
|
|
22
|
+
ToolDefinition,
|
|
23
|
+
Workflow,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__version__ = "0.12.0"
|
|
27
|
+
|
|
28
|
+
Manifest = ManifestV2
|
|
29
|
+
Recipe = ManifestV2
|
|
30
|
+
load = load_from_yaml
|
|
31
|
+
dump = dump_to_yaml
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"Manifest",
|
|
35
|
+
"Recipe",
|
|
36
|
+
"load",
|
|
37
|
+
"dump",
|
|
38
|
+
"__version__",
|
|
39
|
+
"ManifestMetadata",
|
|
40
|
+
"AgentStep",
|
|
41
|
+
"Workflow",
|
|
42
|
+
"AgentDefinition",
|
|
43
|
+
"ToolDefinition",
|
|
44
|
+
"Step",
|
|
45
|
+
"LogicStep",
|
|
46
|
+
"SwitchStep",
|
|
47
|
+
"CouncilStep",
|
|
48
|
+
"InterfaceDefinition",
|
|
49
|
+
"StateDefinition",
|
|
50
|
+
"PolicyDefinition",
|
|
51
|
+
]
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
#
|
|
9
9
|
# Source Code: https://github.com/CoReason-AI/coreason-manifest
|
|
10
10
|
|
|
11
|
+
from enum import Enum
|
|
11
12
|
from typing import Any, Dict
|
|
12
13
|
|
|
13
|
-
from pydantic import BaseModel, ConfigDict
|
|
14
|
+
from pydantic import AnyUrl, BaseModel, ConfigDict, PlainSerializer
|
|
15
|
+
from typing_extensions import Annotated
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
class CoReasonBaseModel(BaseModel):
|
|
@@ -45,3 +47,18 @@ class CoReasonBaseModel(BaseModel):
|
|
|
45
47
|
kwargs.setdefault("by_alias", True)
|
|
46
48
|
kwargs.setdefault("exclude_none", True)
|
|
47
49
|
return self.model_dump_json(**kwargs)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Strict URI type that serializes to string
|
|
53
|
+
StrictUri = Annotated[
|
|
54
|
+
AnyUrl,
|
|
55
|
+
PlainSerializer(lambda x: str(x), return_type=str),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ToolRiskLevel(str, Enum):
|
|
60
|
+
"""Risk level for the tool."""
|
|
61
|
+
|
|
62
|
+
SAFE = "safe"
|
|
63
|
+
STANDARD = "standard"
|
|
64
|
+
CRITICAL = "critical"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Copyright (c) 2025 CoReason, Inc.
|
|
2
|
+
#
|
|
3
|
+
# This software is proprietary and dual-licensed.
|
|
4
|
+
# Licensed under the Prosperity Public License 3.0 (the "License").
|
|
5
|
+
# A copy of the license is available at https://prosperitylicense.com/versions/3.0.0
|
|
6
|
+
# For details, see the LICENSE file.
|
|
7
|
+
# Commercial use beyond a 30-day trial requires a separate license.
|
|
8
|
+
#
|
|
9
|
+
# Source Code: https://github.com/CoReason-AI/coreason-manifest
|
|
10
|
+
|
|
11
|
+
"""Governance and Policy Enforcement module for Coreason Agents.
|
|
12
|
+
|
|
13
|
+
This module provides tools to validate an AgentDefinition against a set of organizational rules.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from typing import List, Optional
|
|
17
|
+
|
|
18
|
+
from pydantic import ConfigDict, Field
|
|
19
|
+
|
|
20
|
+
from coreason_manifest.common import CoReasonBaseModel, ToolRiskLevel
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class GovernanceConfig(CoReasonBaseModel):
|
|
24
|
+
"""Configuration for governance rules.
|
|
25
|
+
|
|
26
|
+
Attributes:
|
|
27
|
+
allowed_domains: List of allowed domains for tool URIs.
|
|
28
|
+
max_risk_level: Maximum allowed risk level for tools.
|
|
29
|
+
require_auth_for_critical_tools: Whether authentication is required for agents using CRITICAL tools.
|
|
30
|
+
allow_inline_tools: Whether to allow inline tool definitions (which lack risk scoring).
|
|
31
|
+
allow_custom_logic: Whether to allow LogicNodes and conditional Edges with custom code.
|
|
32
|
+
strict_url_validation: Enforce strict, normalized URL validation.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(extra="forbid", frozen=True)
|
|
36
|
+
|
|
37
|
+
allowed_domains: Optional[List[str]] = Field(
|
|
38
|
+
None, description="If provided, all Tool URIs must match one of these domains."
|
|
39
|
+
)
|
|
40
|
+
max_risk_level: Optional[ToolRiskLevel] = Field(
|
|
41
|
+
None, description="If provided, no tool can exceed this risk level."
|
|
42
|
+
)
|
|
43
|
+
require_auth_for_critical_tools: bool = Field(
|
|
44
|
+
True,
|
|
45
|
+
description="If an agent uses a CRITICAL tool, agent.metadata.requires_auth must be True.",
|
|
46
|
+
)
|
|
47
|
+
allow_inline_tools: bool = Field(
|
|
48
|
+
True, description="Whether to allow inline tool definitions (which lack risk scoring)."
|
|
49
|
+
)
|
|
50
|
+
allow_custom_logic: bool = Field(
|
|
51
|
+
False, description="Whether to allow LogicNodes and conditional Edges with custom code."
|
|
52
|
+
)
|
|
53
|
+
strict_url_validation: bool = Field(True, description="Enforce strict, normalized URL validation.")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ComplianceViolation(CoReasonBaseModel):
|
|
57
|
+
"""Details of a compliance violation.
|
|
58
|
+
|
|
59
|
+
Attributes:
|
|
60
|
+
rule: Name of the rule broken.
|
|
61
|
+
message: Human readable details.
|
|
62
|
+
component_id: Name of the tool or component causing the issue.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
model_config = ConfigDict(extra="forbid", frozen=True)
|
|
66
|
+
|
|
67
|
+
rule: str = Field(..., description="Name of the rule broken, e.g., 'domain_restriction'.")
|
|
68
|
+
message: str = Field(..., description="Human readable details.")
|
|
69
|
+
component_id: Optional[str] = Field(None, description="Name of the tool or component causing the issue.")
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class ComplianceReport(CoReasonBaseModel):
|
|
73
|
+
"""Report of compliance checks.
|
|
74
|
+
|
|
75
|
+
Attributes:
|
|
76
|
+
passed: Whether the agent passed all checks.
|
|
77
|
+
violations: List of violations found.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
model_config = ConfigDict(extra="forbid", frozen=True)
|
|
81
|
+
|
|
82
|
+
passed: bool = Field(..., description="Whether the agent passed all checks.")
|
|
83
|
+
violations: List[ComplianceViolation] = Field(default_factory=list, description="List of violations found.")
|