iris-security-sdk 0.1.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.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: iris-security-sdk
3
+ Version: 0.1.0
4
+ Summary: IRIS — AI Agent Governance SDK. Govern AI agents locally.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/gimartinb/iris-sdk
7
+ Project-URL: Repository, https://github.com/gimartinb/iris-sdk
8
+ Keywords: ai-governance,ai-agents,colorado-ai-act,cedar-policy,llm,compliance
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Security
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: iris-security-core>=0.1.0
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: click>=8.1
23
+ Requires-Dist: rich>=13.0
24
+ Provides-Extra: anthropic
25
+ Requires-Dist: anthropic>=0.25; extra == "anthropic"
26
+ Provides-Extra: openai
27
+ Requires-Dist: openai>=1.30; extra == "openai"
28
+ Provides-Extra: langchain
29
+ Requires-Dist: langchain>=0.2; extra == "langchain"
30
+ Requires-Dist: langchain-core>=0.2; extra == "langchain"
31
+ Provides-Extra: crewai
32
+ Requires-Dist: crewai>=0.30; extra == "crewai"
33
+ Provides-Extra: all
34
+ Requires-Dist: iris-security-sdk[anthropic,crewai,langchain,openai]; extra == "all"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
38
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
39
+ Requires-Dist: ruff>=0.4; extra == "dev"
40
+ Requires-Dist: mypy>=1.10; extra == "dev"
41
+
42
+ # iris-security-sdk
43
+
44
+ IRIS — AI Agent Governance SDK. Govern AI agents locally.
45
+
46
+ Discover, register, and govern AI agents with Cedar policy evaluation,
47
+ compliance bundles, and local-first governance.
48
+
49
+ Part of the [IRIS SDK](https://github.com/gimartinb/iris-sdk).
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ pip install iris-security-sdk
55
+ ```
56
+
57
+ ## Optional integrations
58
+
59
+ ```bash
60
+ pip install iris-security-sdk[anthropic]
61
+ pip install iris-security-sdk[openai]
62
+ pip install iris-security-sdk[langchain]
63
+ pip install iris-security-sdk[crewai]
64
+ pip install iris-security-sdk[all]
65
+ ```
@@ -0,0 +1,24 @@
1
+ # iris-security-sdk
2
+
3
+ IRIS — AI Agent Governance SDK. Govern AI agents locally.
4
+
5
+ Discover, register, and govern AI agents with Cedar policy evaluation,
6
+ compliance bundles, and local-first governance.
7
+
8
+ Part of the [IRIS SDK](https://github.com/gimartinb/iris-sdk).
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ pip install iris-security-sdk
14
+ ```
15
+
16
+ ## Optional integrations
17
+
18
+ ```bash
19
+ pip install iris-security-sdk[anthropic]
20
+ pip install iris-security-sdk[openai]
21
+ pip install iris-security-sdk[langchain]
22
+ pip install iris-security-sdk[crewai]
23
+ pip install iris-security-sdk[all]
24
+ ```
@@ -0,0 +1,290 @@
1
+ """
2
+ IRIS Python SDK — AI Agent Governance, fully local.
3
+
4
+ The primary entry point for Python developers building AI agents.
5
+ Zero cloud infrastructure required. Cedar evaluation runs in-process.
6
+
7
+ Quickstart:
8
+ from iris import IrisAgent, iris_guard
9
+
10
+ agent = IrisAgent(
11
+ name="my-agent",
12
+ owner="platform-team",
13
+ compliance=["colorado-ai-act"]
14
+ )
15
+
16
+ @iris_guard(agent)
17
+ def call_payments_api(user_id: str) -> dict:
18
+ # IRIS intercepts this call and evaluates it against policy
19
+ ...
20
+ """
21
+
22
+ from __future__ import annotations
23
+ from typing import Optional, List, Callable, Any
24
+ from functools import wraps
25
+ from pathlib import Path
26
+ import os
27
+ import sys
28
+
29
+ # ── Re-export the full public API ──────────────────────────────────────────────
30
+ from iris_core.models.passport import (
31
+ AgentPassport,
32
+ DataClassification,
33
+ Environment,
34
+ ComplianceTag,
35
+ ToolPermission,
36
+ )
37
+ from iris_core.models.policy import PolicyResult, Violation, Severity
38
+ from iris_core.engine.cedar import CedarEngine, EvaluationContext
39
+ from iris_core.engine.compiler import PolicyCompiler, CompilationResult
40
+ from iris_core.compliance.registry import ComplianceRegistry
41
+ from iris_core.evidence.vault import EvidenceVault
42
+
43
+ __version__ = "0.1.0"
44
+ __all__ = [
45
+ # Main classes
46
+ "IrisAgent",
47
+ "iris_guard",
48
+ "iris_scan",
49
+ # Models
50
+ "AgentPassport",
51
+ "DataClassification",
52
+ "Environment",
53
+ "ComplianceTag",
54
+ "ToolPermission",
55
+ "EvaluationContext",
56
+ "PolicyResult",
57
+ "Violation",
58
+ "Severity",
59
+ # Engines
60
+ "CedarEngine",
61
+ "PolicyCompiler",
62
+ "CompilationResult",
63
+ "ComplianceRegistry",
64
+ "EvidenceVault",
65
+ ]
66
+
67
+
68
+ class IrisAgent:
69
+ """
70
+ The primary IRIS SDK entry point for Python developers.
71
+
72
+ Think of IrisAgent as the agent's passport officer. You declare who
73
+ the agent is and what it is allowed to do. IRIS handles the rest:
74
+ policy compilation, runtime evaluation, and compliance reporting.
75
+
76
+ Example:
77
+ agent = IrisAgent(
78
+ name="support-agent",
79
+ owner="platform-team@company.com",
80
+ team="platform",
81
+ data_classification=DataClassification.PII,
82
+ compliance=["colorado-ai-act", "soc2"],
83
+ is_high_risk_ai=True, # triggers Colorado AI Act checks
84
+ )
85
+
86
+ # Generate policy from natural language intent
87
+ result = agent.compile_policy(
88
+ intent="This agent can read support tickets and respond to customers. "
89
+ "It must never access payment data or write to any external system."
90
+ )
91
+
92
+ # Use as a decorator on any function that calls an AI tool
93
+ @agent.guard(tool="zendesk-api", action="read")
94
+ def fetch_ticket(ticket_id: str) -> dict:
95
+ ...
96
+ """
97
+
98
+ def __init__(
99
+ self,
100
+ name: str,
101
+ owner: str,
102
+ team: str = "",
103
+ data_classification: DataClassification = DataClassification.INTERNAL,
104
+ compliance: Optional[List[str]] = None,
105
+ environments: Optional[List[str]] = None,
106
+ is_high_risk_ai: bool = False,
107
+ policy_dir: Optional[Path] = None,
108
+ telemetry: bool = False, # opt-in only, never default True
109
+ environment: Optional[str] = None,
110
+ ):
111
+ compliance_tags = [ComplianceTag(c) for c in (compliance or [])]
112
+ envs = [Environment(e) for e in (environments or ["dev", "test", "staging", "production"])]
113
+ current_env = Environment(environment or os.environ.get("IRIS_ENV", "dev"))
114
+
115
+ self.passport = AgentPassport(
116
+ name=name,
117
+ owner=owner,
118
+ team=team,
119
+ data_classification=data_classification,
120
+ compliance_tags=compliance_tags,
121
+ environments=envs,
122
+ is_high_risk_ai=is_high_risk_ai,
123
+ )
124
+
125
+ self._current_env = current_env
126
+ self._policy_dir = policy_dir or Path.cwd() / "governance" / "agents" / name
127
+ self._engine = CedarEngine(policy_dir=self._policy_dir)
128
+ self._compiler = PolicyCompiler()
129
+ self._vault = EvidenceVault(agent_id=self.passport.agent_id)
130
+ self._telemetry = telemetry
131
+
132
+ # Load policy if it exists on disk
133
+ policy_file = self._policy_dir / "policy.cedar"
134
+ if policy_file.exists():
135
+ self._engine.load_policy_file(self.passport.agent_id, policy_file)
136
+
137
+ def compile_policy(
138
+ self,
139
+ intent: str,
140
+ write_to_disk: bool = True,
141
+ ) -> CompilationResult:
142
+ """
143
+ Compile natural language intent to Cedar policy.
144
+
145
+ The developer writes what they want. IRIS writes the Cedar.
146
+
147
+ Args:
148
+ intent: Plain English description of agent permissions.
149
+ write_to_disk: If True, writes policy.cedar and policy-intent.md
150
+ to the governance GitOps directory.
151
+ """
152
+ result = self._compiler.compile(intent, self.passport)
153
+
154
+ if write_to_disk and result.success:
155
+ self._policy_dir.mkdir(parents=True, exist_ok=True)
156
+ (self._policy_dir / "policy.cedar").write_text(result.cedar_policy)
157
+ (self._policy_dir / "policy-intent.md").write_text(result.intent_markdown)
158
+ (self._policy_dir / "passport.yaml").write_text(self.passport.to_yaml())
159
+ self._engine.load_policy(self.passport.agent_id, result.cedar_policy)
160
+ print(f"[IRIS] Policy compiled and written to {self._policy_dir}")
161
+
162
+ return result
163
+
164
+ def guard(
165
+ self,
166
+ tool: str,
167
+ action: str = "call",
168
+ data_region: Optional[str] = None,
169
+ destination_region: Optional[str] = None,
170
+ data_classification: Optional[str] = None,
171
+ ) -> Callable:
172
+ """
173
+ Decorator that intercepts function calls and evaluates them against policy.
174
+
175
+ This is the sidecar in decorator form. Use it on any function that
176
+ calls an external tool, API, or data source.
177
+
178
+ Example:
179
+ @agent.guard(tool="payments-api", action="read")
180
+ def get_payment_status(order_id: str) -> dict:
181
+ return payments_client.get(order_id)
182
+ """
183
+ def decorator(func: Callable) -> Callable:
184
+ @wraps(func)
185
+ def wrapper(*args, **kwargs) -> Any:
186
+ ctx = EvaluationContext(
187
+ agent_id=self.passport.agent_id,
188
+ action=action,
189
+ resource=tool,
190
+ resource_type="tool",
191
+ environment=self._current_env,
192
+ data_region=data_region,
193
+ destination_region=destination_region,
194
+ data_classification=data_classification,
195
+ )
196
+ result = self._engine.evaluate(self.passport, ctx)
197
+ self._vault.record(ctx, result)
198
+
199
+ if result.decision == "DENY":
200
+ raise IrisViolationError(result)
201
+ elif result.decision == "PERMIT_WITH_WARNINGS":
202
+ for v in result.violations:
203
+ print(f"[IRIS WARNING] {v.message}", file=sys.stderr)
204
+
205
+ return func(*args, **kwargs)
206
+ return wrapper
207
+ return decorator
208
+
209
+ def evaluate(self, context: EvaluationContext) -> PolicyResult:
210
+ """Direct policy evaluation without the decorator pattern."""
211
+ result = self._engine.evaluate(self.passport, context)
212
+ self._vault.record(context, result)
213
+ return result
214
+
215
+ def check_compliance(
216
+ self,
217
+ framework: Optional[str] = None,
218
+ ) -> List[Violation]:
219
+ """
220
+ Run a compliance check against the agent's passport and policy.
221
+ Equivalent to 'iris compliance check' from the CLI.
222
+ """
223
+ registry = ComplianceRegistry()
224
+ return registry.check_passport(
225
+ self.passport,
226
+ framework or [t.value for t in self.passport.compliance_tags],
227
+ )
228
+
229
+ @property
230
+ def is_ready_for_production(self) -> bool:
231
+ """Quick check: is this agent compliant enough for production?"""
232
+ violations = self.check_compliance()
233
+ critical = [v for v in violations if v.severity == Severity.CRITICAL]
234
+ return len(critical) == 0
235
+
236
+
237
+ class IrisViolationError(Exception):
238
+ """
239
+ Raised when an agent action is blocked by IRIS policy.
240
+
241
+ The structured error is returned to the calling agent with a plain-English
242
+ explanation of what was blocked and how to remediate.
243
+ """
244
+
245
+ def __init__(self, result: PolicyResult):
246
+ self.result = result
247
+ primary = result.violations[0] if result.violations else None
248
+ message = (
249
+ f"\n[IRIS POLICY VIOLATION]\n"
250
+ f"Decision: {result.decision}\n"
251
+ f"Agent: {result.agent_id}\n"
252
+ f"Action: {result.action} on {result.resource}\n"
253
+ f"Environment: {result.environment}\n"
254
+ )
255
+ if primary:
256
+ message += (
257
+ f"\nViolation: {primary.message}\n"
258
+ f"Rule: {primary.rule_id}\n"
259
+ f"Compliance: {', '.join(primary.compliance_refs)}\n"
260
+ f"Remediation: {primary.remediation}\n"
261
+ )
262
+ super().__init__(message)
263
+
264
+
265
+ def iris_scan(
266
+ directory: Optional[Path] = None,
267
+ framework: Optional[str] = None,
268
+ ) -> List[Violation]:
269
+ """
270
+ Scan a directory for agent passports and check compliance.
271
+ Equivalent to 'iris scan' from the CLI.
272
+
273
+ This is the traction metric for investors: every developer who runs
274
+ iris_scan() or 'iris scan' is a weekly active user.
275
+ """
276
+ scan_dir = directory or Path.cwd() / "governance"
277
+ registry = ComplianceRegistry()
278
+ violations = []
279
+
280
+ for passport_file in scan_dir.rglob("passport.yaml"):
281
+ try:
282
+ passport = AgentPassport.from_yaml(passport_file.read_text())
283
+ agent_violations = registry.check_passport(passport, framework)
284
+ violations.extend(agent_violations)
285
+ status = "PASS" if not agent_violations else f"FAIL ({len(agent_violations)} violations)"
286
+ print(f"[IRIS SCAN] {passport.name}: {status}")
287
+ except Exception as e:
288
+ print(f"[IRIS SCAN] Could not parse {passport_file}: {e}", file=sys.stderr)
289
+
290
+ return violations
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: iris-security-sdk
3
+ Version: 0.1.0
4
+ Summary: IRIS — AI Agent Governance SDK. Govern AI agents locally.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/gimartinb/iris-sdk
7
+ Project-URL: Repository, https://github.com/gimartinb/iris-sdk
8
+ Keywords: ai-governance,ai-agents,colorado-ai-act,cedar-policy,llm,compliance
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Topic :: Security
12
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ Requires-Dist: iris-security-core>=0.1.0
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: pydantic>=2.0
22
+ Requires-Dist: click>=8.1
23
+ Requires-Dist: rich>=13.0
24
+ Provides-Extra: anthropic
25
+ Requires-Dist: anthropic>=0.25; extra == "anthropic"
26
+ Provides-Extra: openai
27
+ Requires-Dist: openai>=1.30; extra == "openai"
28
+ Provides-Extra: langchain
29
+ Requires-Dist: langchain>=0.2; extra == "langchain"
30
+ Requires-Dist: langchain-core>=0.2; extra == "langchain"
31
+ Provides-Extra: crewai
32
+ Requires-Dist: crewai>=0.30; extra == "crewai"
33
+ Provides-Extra: all
34
+ Requires-Dist: iris-security-sdk[anthropic,crewai,langchain,openai]; extra == "all"
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
38
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
39
+ Requires-Dist: ruff>=0.4; extra == "dev"
40
+ Requires-Dist: mypy>=1.10; extra == "dev"
41
+
42
+ # iris-security-sdk
43
+
44
+ IRIS — AI Agent Governance SDK. Govern AI agents locally.
45
+
46
+ Discover, register, and govern AI agents with Cedar policy evaluation,
47
+ compliance bundles, and local-first governance.
48
+
49
+ Part of the [IRIS SDK](https://github.com/gimartinb/iris-sdk).
50
+
51
+ ## Install
52
+
53
+ ```bash
54
+ pip install iris-security-sdk
55
+ ```
56
+
57
+ ## Optional integrations
58
+
59
+ ```bash
60
+ pip install iris-security-sdk[anthropic]
61
+ pip install iris-security-sdk[openai]
62
+ pip install iris-security-sdk[langchain]
63
+ pip install iris-security-sdk[crewai]
64
+ pip install iris-security-sdk[all]
65
+ ```
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ iris/__init__.py
4
+ iris_security_sdk.egg-info/PKG-INFO
5
+ iris_security_sdk.egg-info/SOURCES.txt
6
+ iris_security_sdk.egg-info/dependency_links.txt
7
+ iris_security_sdk.egg-info/requires.txt
8
+ iris_security_sdk.egg-info/top_level.txt
@@ -0,0 +1,28 @@
1
+ iris-security-core>=0.1.0
2
+ pyyaml>=6.0
3
+ pydantic>=2.0
4
+ click>=8.1
5
+ rich>=13.0
6
+
7
+ [all]
8
+ iris-security-sdk[anthropic,crewai,langchain,openai]
9
+
10
+ [anthropic]
11
+ anthropic>=0.25
12
+
13
+ [crewai]
14
+ crewai>=0.30
15
+
16
+ [dev]
17
+ pytest>=8.0
18
+ pytest-asyncio>=0.23
19
+ pytest-cov>=5.0
20
+ ruff>=0.4
21
+ mypy>=1.10
22
+
23
+ [langchain]
24
+ langchain>=0.2
25
+ langchain-core>=0.2
26
+
27
+ [openai]
28
+ openai>=1.30
@@ -0,0 +1,69 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iris-security-sdk"
7
+ version = "0.1.0"
8
+ description = "IRIS — AI Agent Governance SDK. Govern AI agents locally."
9
+ readme = "README.md"
10
+ license = { text = "Apache-2.0" }
11
+ requires-python = ">=3.10"
12
+ keywords = [
13
+ "ai-governance",
14
+ "ai-agents",
15
+ "colorado-ai-act",
16
+ "cedar-policy",
17
+ "llm",
18
+ "compliance",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Developers",
23
+ "Topic :: Security",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "License :: OSI Approved :: Apache Software License",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ ]
30
+ dependencies = [
31
+ "iris-security-core>=0.1.0",
32
+ "pyyaml>=6.0",
33
+ "pydantic>=2.0",
34
+ "click>=8.1",
35
+ "rich>=13.0",
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ anthropic = ["anthropic>=0.25"]
40
+ openai = ["openai>=1.30"]
41
+ langchain = ["langchain>=0.2", "langchain-core>=0.2"]
42
+ crewai = ["crewai>=0.30"]
43
+ all = ["iris-security-sdk[anthropic,openai,langchain,crewai]"]
44
+ dev = [
45
+ "pytest>=8.0",
46
+ "pytest-asyncio>=0.23",
47
+ "pytest-cov>=5.0",
48
+ "ruff>=0.4",
49
+ "mypy>=1.10",
50
+ ]
51
+
52
+ [project.urls]
53
+ Homepage = "https://github.com/gimartinb/iris-sdk"
54
+ Repository = "https://github.com/gimartinb/iris-sdk"
55
+
56
+ [tool.setuptools.packages.find]
57
+ where = ["."]
58
+
59
+ [tool.ruff]
60
+ line-length = 100
61
+ target-version = "py310"
62
+
63
+ [tool.mypy]
64
+ python_version = "3.10"
65
+ strict = true
66
+
67
+ [tool.pytest.ini_options]
68
+ testpaths = ["tests"]
69
+ asyncio_mode = "auto"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+