kyvvu 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.
- kyvvu-0.12.0/LICENSE +17 -0
- kyvvu-0.12.0/PKG-INFO +399 -0
- kyvvu-0.12.0/README.md +345 -0
- kyvvu-0.12.0/kyvvu/__init__.py +62 -0
- kyvvu-0.12.0/kyvvu/__version__.py +6 -0
- kyvvu-0.12.0/kyvvu/_limits.py +22 -0
- kyvvu-0.12.0/kyvvu/_task_context.py +16 -0
- kyvvu-0.12.0/kyvvu/cli/__init__.py +4 -0
- kyvvu-0.12.0/kyvvu/cli/__main__.py +7 -0
- kyvvu-0.12.0/kyvvu/cli/agents.py +60 -0
- kyvvu-0.12.0/kyvvu/cli/auth.py +227 -0
- kyvvu-0.12.0/kyvvu/cli/client.py +111 -0
- kyvvu-0.12.0/kyvvu/cli/config.py +122 -0
- kyvvu-0.12.0/kyvvu/cli/init_cmd.py +173 -0
- kyvvu-0.12.0/kyvvu/cli/main.py +130 -0
- kyvvu-0.12.0/kyvvu/cli/policies.py +64 -0
- kyvvu-0.12.0/kyvvu/cli/serve.py +66 -0
- kyvvu-0.12.0/kyvvu/cli/templates/default/README.md.tmpl +16 -0
- kyvvu-0.12.0/kyvvu/cli/templates/default/agent.py.tmpl +96 -0
- kyvvu-0.12.0/kyvvu/cli/templates/default/env.example.tmpl +10 -0
- kyvvu-0.12.0/kyvvu/cli/templates/default/gitignore.tmpl +5 -0
- kyvvu-0.12.0/kyvvu/cli/templates/default/requirements.txt.tmpl +1 -0
- kyvvu-0.12.0/kyvvu/core.py +633 -0
- kyvvu-0.12.0/kyvvu/decorators.py +9 -0
- kyvvu-0.12.0/kyvvu/exceptions.py +223 -0
- kyvvu-0.12.0/kyvvu/integrations/__init__.py +10 -0
- kyvvu-0.12.0/kyvvu/integrations/_base.py +351 -0
- kyvvu-0.12.0/kyvvu/integrations/decorator.py +476 -0
- kyvvu-0.12.0/kyvvu/integrations/langchain.py +485 -0
- kyvvu-0.12.0/kyvvu/logging.py +11 -0
- kyvvu-0.12.0/kyvvu/schemas.py +233 -0
- kyvvu-0.12.0/kyvvu/templates/__init__.py +212 -0
- kyvvu-0.12.0/kyvvu/templates/condition_evaluator.py +71 -0
- kyvvu-0.12.0/kyvvu/templates/decorator.template.yaml +293 -0
- kyvvu-0.12.0/kyvvu/templates/helpers.py +91 -0
- kyvvu-0.12.0/kyvvu/templates/langchain.template.yaml +168 -0
- kyvvu-0.12.0/kyvvu/templates/loader.py +81 -0
- kyvvu-0.12.0/kyvvu/templates/matcher.py +40 -0
- kyvvu-0.12.0/kyvvu/templates/merge.py +56 -0
- kyvvu-0.12.0/kyvvu.egg-info/PKG-INFO +399 -0
- kyvvu-0.12.0/kyvvu.egg-info/SOURCES.txt +64 -0
- kyvvu-0.12.0/kyvvu.egg-info/dependency_links.txt +1 -0
- kyvvu-0.12.0/kyvvu.egg-info/entry_points.txt +2 -0
- kyvvu-0.12.0/kyvvu.egg-info/requires.txt +20 -0
- kyvvu-0.12.0/kyvvu.egg-info/top_level.txt +2 -0
- kyvvu-0.12.0/pyproject.toml +111 -0
- kyvvu-0.12.0/setup.cfg +4 -0
- kyvvu-0.12.0/tests/test_agent_key_flow.py +64 -0
- kyvvu-0.12.0/tests/test_config_precedence.py +60 -0
- kyvvu-0.12.0/tests/test_cross_context_task.py +184 -0
- kyvvu-0.12.0/tests/test_decorator.py +303 -0
- kyvvu-0.12.0/tests/test_decorator_async.py +154 -0
- kyvvu-0.12.0/tests/test_decorator_lifecycle.py +137 -0
- kyvvu-0.12.0/tests/test_decorator_template_integration.py +93 -0
- kyvvu-0.12.0/tests/test_decorator_template_loading.py +59 -0
- kyvvu-0.12.0/tests/test_env_var_prefix.py +39 -0
- kyvvu-0.12.0/tests/test_exception_reexports.py +67 -0
- kyvvu-0.12.0/tests/test_exceptions.py +163 -0
- kyvvu-0.12.0/tests/test_identity_acquisition.py +127 -0
- kyvvu-0.12.0/tests/test_init.py +130 -0
- kyvvu-0.12.0/tests/test_programmatic_task_api.py +217 -0
- kyvvu-0.12.0/tests/test_public_surface.py +53 -0
- kyvvu-0.12.0/tests/test_register_agent_side_effects.py +159 -0
- kyvvu-0.12.0/tests/test_safe_json.py +80 -0
- kyvvu-0.12.0/tests/test_stale_env_vars.py +25 -0
- kyvvu-0.12.0/tests/test_templates.py +525 -0
kyvvu-0.12.0/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Copyright 2026 Kyvvu B.V.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
|
14
|
+
|
|
15
|
+
This license applies only to the contents of the kyvvu-sdk/ directory
|
|
16
|
+
of the Kyvvu monorepo. Other directories in this monorepo are governed
|
|
17
|
+
by their own LICENSE files.
|
kyvvu-0.12.0/PKG-INFO
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kyvvu
|
|
3
|
+
Version: 0.12.0
|
|
4
|
+
Summary: Python SDK for AI compliance monitoring and policy enforcement under the EU AI Act
|
|
5
|
+
Author-email: "Kyvvu B.V." <info@kyvvu.com>
|
|
6
|
+
License: Copyright 2026 Kyvvu B.V.
|
|
7
|
+
|
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
you may not use this file except in compliance with the License.
|
|
10
|
+
You may obtain a copy of the License at
|
|
11
|
+
|
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
|
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
See the License for the specific language governing permissions and
|
|
18
|
+
limitations under the License.
|
|
19
|
+
|
|
20
|
+
This license applies only to the contents of the kyvvu-sdk/ directory
|
|
21
|
+
of the Kyvvu monorepo. Other directories in this monorepo are governed
|
|
22
|
+
by their own LICENSE files.
|
|
23
|
+
Project-URL: Homepage, https://github.com/kyvvu/platform
|
|
24
|
+
Keywords: ai,compliance,eu-ai-act,monitoring,logging,policy-enforcement
|
|
25
|
+
Classifier: Development Status :: 4 - Beta
|
|
26
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
27
|
+
Classifier: Intended Audience :: Developers
|
|
28
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
34
|
+
Requires-Python: >=3.10
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
License-File: LICENSE
|
|
37
|
+
Requires-Dist: kyvvu-engine<1.0.0,>=0.2.0
|
|
38
|
+
Requires-Dist: pyyaml>=6.0
|
|
39
|
+
Requires-Dist: typer>=0.12
|
|
40
|
+
Requires-Dist: rich>=13
|
|
41
|
+
Requires-Dist: httpx>=0.27
|
|
42
|
+
Requires-Dist: tomli-w>=1.0
|
|
43
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
44
|
+
Provides-Extra: langchain
|
|
45
|
+
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
48
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
50
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
51
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
52
|
+
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
53
|
+
Dynamic: license-file
|
|
54
|
+
|
|
55
|
+
# Kyvvu SDK
|
|
56
|
+
|
|
57
|
+
Python SDK for instrumenting AI agents with compliance logging and runtime
|
|
58
|
+
policy enforcement. The SDK translates agent actions into atomic behaviours,
|
|
59
|
+
evaluates them against policies via the embedded `kyvvu-engine`, and streams
|
|
60
|
+
an audit trail to the Kyvvu platform.
|
|
61
|
+
|
|
62
|
+
- **Documentation**: https://docs.kyvvu.com/sdk
|
|
63
|
+
- **PyPI**: `pip install kyvvu`
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## What the SDK does
|
|
68
|
+
|
|
69
|
+
1. **Registers your agent** with the Kyvvu API (`POST /api/v1/agents`) on
|
|
70
|
+
startup. This is a real HTTP call that acquires an `agent_id` and
|
|
71
|
+
evaluates agent-registration policies.
|
|
72
|
+
2. **Evaluates every step** your agent takes against loaded policies *before*
|
|
73
|
+
execution. Policies are fetched from the API and cached (this is done by
|
|
74
|
+
`kyvvu-engine`, which is included as a dependency).
|
|
75
|
+
3. **Records completed steps** into an in-memory per-task history so that
|
|
76
|
+
path-dependent policies (predecessors, sequences, rate limits) work.
|
|
77
|
+
4. **Flushes the audit trail** to the Kyvvu API on task completion.
|
|
78
|
+
|
|
79
|
+
The SDK makes HTTP calls at two points:
|
|
80
|
+
- **Agent registration** — `POST /api/v1/agents` (once at startup).
|
|
81
|
+
- **Policy fetch** — `GET /api/v1/policies` (on first evaluation, then
|
|
82
|
+
every `KV_POLICY_TTL_SECONDS`; handled by `kyvvu-engine`).
|
|
83
|
+
- **Log flush** — `POST` to the configured log endpoint (on `end_task()`;
|
|
84
|
+
handled by `kyvvu-engine`, off by default).
|
|
85
|
+
- **Incident webhook** — `POST` to the configured incident endpoint (on
|
|
86
|
+
policy violation; handled by `kyvvu-engine`, off by default).
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Quickstart
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from kyvvu import Kyvvu, StepType, Verb
|
|
94
|
+
|
|
95
|
+
kv = Kyvvu(api_key="KvKey-...", agent_key="my-bot")
|
|
96
|
+
kv.register_agent(name="My Bot", purpose="Customer support")
|
|
97
|
+
|
|
98
|
+
task_id = kv.start_task()
|
|
99
|
+
|
|
100
|
+
@kv.step(StepType.step_model, Verb.POST)
|
|
101
|
+
def chat(prompt: str) -> str:
|
|
102
|
+
return llm.complete(prompt)
|
|
103
|
+
|
|
104
|
+
result = chat("Hello")
|
|
105
|
+
kv.end_task()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Bring-your-own identity
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
# If agent_id is provisioned externally (Terraform, config file, admin console):
|
|
112
|
+
kv = Kyvvu(api_key="KvKey-...", agent_key="my-bot", agent_id="ag_abc123")
|
|
113
|
+
# No register_agent() call needed — start using @kv.step immediately.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Task lifecycle (programmatic API)
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
task_id = kv.start_task()
|
|
120
|
+
try:
|
|
121
|
+
result = my_agent_function()
|
|
122
|
+
except Exception as e:
|
|
123
|
+
kv.error_task(error=e)
|
|
124
|
+
raise
|
|
125
|
+
else:
|
|
126
|
+
kv.end_task()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
All three methods accept optional `context=`, `properties=`, and `meta=` kwargs for template matching and caller overrides.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Integration modes
|
|
134
|
+
|
|
135
|
+
The SDK supports two integration patterns. Both produce the same stream of
|
|
136
|
+
`Behavior` objects; they differ in how agent actions are captured.
|
|
137
|
+
|
|
138
|
+
### 1. Decorator integration (`@kv.step`)
|
|
139
|
+
|
|
140
|
+
For custom Python agents. Wrap each function with `@kv.step(step_type, verb)`.
|
|
141
|
+
The decorator handles evaluate → execute → record automatically.
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from kyvvu import Kyvvu, StepType, Verb, RiskClassification
|
|
145
|
+
|
|
146
|
+
kv = Kyvvu(
|
|
147
|
+
api_key="KvKey-...",
|
|
148
|
+
agent_key="gmail-assistant",
|
|
149
|
+
risk_classification=RiskClassification.HIGH,
|
|
150
|
+
)
|
|
151
|
+
kv.register_agent(name="Gmail Assistant")
|
|
152
|
+
|
|
153
|
+
class GmailAgent:
|
|
154
|
+
@kv.step(StepType.task_start)
|
|
155
|
+
def fetch_email(self):
|
|
156
|
+
return self._read_inbox()
|
|
157
|
+
|
|
158
|
+
@kv.step(StepType.step_model, Verb.POST,
|
|
159
|
+
properties={"model": {"name": "gpt-4o"}})
|
|
160
|
+
def generate_reply(self, email):
|
|
161
|
+
return llm.complete(email["body"])
|
|
162
|
+
|
|
163
|
+
@kv.step(StepType.task_end)
|
|
164
|
+
def finish(self):
|
|
165
|
+
pass # flushes audit log
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
See `examples/custom-agent/gmail-agent/agent.py` for a full working example.
|
|
169
|
+
|
|
170
|
+
### 2. LangChain / LangGraph callback handler
|
|
171
|
+
|
|
172
|
+
For LangChain-based agents. Construct a `Kyvvu` instance, register the agent,
|
|
173
|
+
then pass a `KyvvuLangChainHandler` as a callback. LLM calls, tool invocations,
|
|
174
|
+
and agent decisions are captured automatically.
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from kyvvu import Kyvvu
|
|
178
|
+
from kyvvu.schemas import Environment, RiskClassification
|
|
179
|
+
from kyvvu.integrations.langchain import KyvvuLangChainHandler
|
|
180
|
+
|
|
181
|
+
kv = Kyvvu(
|
|
182
|
+
api_key="KvKey-...",
|
|
183
|
+
agent_key="finance-agent",
|
|
184
|
+
environment=Environment.DEVELOPMENT,
|
|
185
|
+
risk_classification=RiskClassification.LIMITED,
|
|
186
|
+
)
|
|
187
|
+
kv.register_agent(
|
|
188
|
+
name="Finance Agent",
|
|
189
|
+
purpose="Stock ticker lookup",
|
|
190
|
+
metadata={"framework": "langchain", "tools": ["search"]},
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
handler = KyvvuLangChainHandler(kv)
|
|
194
|
+
result = agent.invoke(query, config={"callbacks": [handler]})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
The handler is a pure adapter — it does not manage identity or registration.
|
|
198
|
+
Same `Kyvvu()` + `register_agent()` pattern as the decorator integration.
|
|
199
|
+
|
|
200
|
+
See `examples/langchain-agent/finance-agent/agent.py` for a full working example.
|
|
201
|
+
|
|
202
|
+
### Behaviour templates
|
|
203
|
+
|
|
204
|
+
Both integrations use YAML templates to map framework events to the v0.05
|
|
205
|
+
atomic behaviour vocabulary (`step.model`, `step.resource`, `task.start`, etc.).
|
|
206
|
+
Built-in templates are provided:
|
|
207
|
+
|
|
208
|
+
```python
|
|
209
|
+
from kyvvu.templates import BehaviorTemplate
|
|
210
|
+
|
|
211
|
+
dec = BehaviorTemplate.from_builtin("decorator")
|
|
212
|
+
lc = BehaviorTemplate.from_builtin("langchain")
|
|
213
|
+
|
|
214
|
+
# Custom template from file
|
|
215
|
+
custom = BehaviorTemplate.from_path("/path/to/template.yaml")
|
|
216
|
+
kv = Kyvvu(api_key="...", agent_key="bot", template=custom)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Or set `KV_TEMPLATE_LOCATION` to a YAML file path.
|
|
220
|
+
|
|
221
|
+
### Async support
|
|
222
|
+
|
|
223
|
+
The `@kv.step` decorator automatically detects `async def` functions and wraps them correctly:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
@kv.step(StepType.step_model, Verb.POST)
|
|
227
|
+
async def chat(prompt: str) -> str:
|
|
228
|
+
return await openai_client.chat.completions.create(
|
|
229
|
+
model="gpt-4o", messages=[{"role": "user", "content": prompt}]
|
|
230
|
+
)
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Policy evaluation and recording are synchronous (sub-millisecond, in-process) — only the decorated function call is awaited. Error handling, blocked-step propagation, and task lifecycle all work identically to sync functions.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Project structure
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
kyvvu-sdk/
|
|
241
|
+
├── kyvvu/
|
|
242
|
+
│ ├── __init__.py # Public API surface (__all__)
|
|
243
|
+
│ ├── __version__.py # Version string (0.11.0)
|
|
244
|
+
│ ├── core.py # Kyvvu class — registration, task API, runner
|
|
245
|
+
│ ├── schemas.py # Enums, Behavior, EvalContext (re-exports from engine)
|
|
246
|
+
│ ├── exceptions.py # Exception hierarchy + KyvvuBlockedError
|
|
247
|
+
│ ├── logging.py # setup_logging re-export from engine
|
|
248
|
+
│ ├── _task_context.py # ContextVar for active task_id
|
|
249
|
+
│ ├── _limits.py # Truncation constants for input/output capture
|
|
250
|
+
│ ├── decorators.py # Re-export shim (logic in integrations/decorator.py)
|
|
251
|
+
│ ├── templates/
|
|
252
|
+
│ │ ├── __init__.py # BehaviorTemplate class
|
|
253
|
+
│ │ ├── loader.py # YAML loading and validation
|
|
254
|
+
│ │ ├── matcher.py # First-match-wins rule evaluation
|
|
255
|
+
│ │ ├── merge.py # Deep-merge utility
|
|
256
|
+
│ │ ├── helpers.py # String interpolation for templates
|
|
257
|
+
│ │ ├── condition_evaluator.py
|
|
258
|
+
│ │ ├── decorator.template.yaml
|
|
259
|
+
│ │ └── langchain.template.yaml
|
|
260
|
+
│ ├── integrations/
|
|
261
|
+
│ │ ├── __init__.py # FrameworkAdapter export
|
|
262
|
+
│ │ ├── _base.py # FrameworkAdapter base class
|
|
263
|
+
│ │ ├── decorator.py # @kv.step implementation
|
|
264
|
+
│ │ └── langchain.py # KyvvuLangChainHandler
|
|
265
|
+
│ └── cli/
|
|
266
|
+
│ ├── main.py # Typer app (kyvvu command)
|
|
267
|
+
│ ├── auth.py # kyvvu auth login/logout
|
|
268
|
+
│ ├── agents.py # kyvvu agents list/register
|
|
269
|
+
│ ├── policies.py # kyvvu policies list
|
|
270
|
+
│ ├── config.py # kyvvu config show/set
|
|
271
|
+
│ ├── init_cmd.py # kyvvu init (scaffold .kyvvu.toml)
|
|
272
|
+
│ ├── serve.py # kyvvu serve (start kyvvu-serve)
|
|
273
|
+
│ └── client.py # HTTP client for CLI commands
|
|
274
|
+
├── tests/ # 351 tests
|
|
275
|
+
│ ├── conftest.py
|
|
276
|
+
│ ├── test_decorator*.py # Decorator integration tests
|
|
277
|
+
│ ├── test_programmatic_task_api.py
|
|
278
|
+
│ ├── test_identity_acquisition.py
|
|
279
|
+
│ ├── test_register_agent_side_effects.py
|
|
280
|
+
│ ├── templates/ # Template matching/loading tests
|
|
281
|
+
│ ├── integrations/
|
|
282
|
+
│ │ ├── langchain/ # 10 LangChain handler test files
|
|
283
|
+
│ │ └── test_framework_adapter_base.py
|
|
284
|
+
│ └── cli/ # CLI command tests
|
|
285
|
+
├── pyproject.toml
|
|
286
|
+
├── pytest.ini
|
|
287
|
+
└── .env.example
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## Configuration
|
|
293
|
+
|
|
294
|
+
The `Kyvvu` constructor accepts explicit kwargs or reads from environment
|
|
295
|
+
variables. Precedence: kwargs > env vars > `.env` in cwd > defaults.
|
|
296
|
+
|
|
297
|
+
| Parameter | Env var | Default | Purpose |
|
|
298
|
+
|-----------|---------|---------|---------|
|
|
299
|
+
| `api_url` | `KV_API_URL` | `https://platform.kyvvu.com` | Kyvvu API base URL |
|
|
300
|
+
| `api_key` | `KV_API_KEY` | — | Bearer API key (`KvKey-...`) |
|
|
301
|
+
| `agent_key` | `KV_AGENT_KEY` | — | Stable agent identifier for policy fetch |
|
|
302
|
+
| `agent_id` | — | — | Pre-provisioned agent ID (skips registration) |
|
|
303
|
+
| `environment` | `KV_ENV` | `development` | Deployment environment |
|
|
304
|
+
| `risk_classification` | — | `minimal` | EU AI Act risk tier |
|
|
305
|
+
| `template` | `KV_TEMPLATE_LOCATION` | built-in | Path to YAML template |
|
|
306
|
+
| `timeout` | — | `10` | HTTP timeout (seconds) |
|
|
307
|
+
|
|
308
|
+
Engine-level settings (`KV_POLICY_TTL_SECONDS`, `KV_LOG_ENDPOINT`, etc.) are
|
|
309
|
+
documented in the [kyvvu-engine README](../kyvvu-engine/README.md#configuration).
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## CLI
|
|
314
|
+
|
|
315
|
+
The SDK includes a CLI (`kyvvu` command) for development and debugging:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
kyvvu --version
|
|
319
|
+
kyvvu auth login
|
|
320
|
+
kyvvu agents list
|
|
321
|
+
kyvvu policies list
|
|
322
|
+
kyvvu config show
|
|
323
|
+
kyvvu init # scaffold .kyvvu.toml
|
|
324
|
+
kyvvu serve # start local kyvvu-serve
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Install CLI dependencies (included by default): `typer`, `rich`, `httpx`.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## Development
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
# Install in editable mode (from monorepo root)
|
|
335
|
+
pip install -e ./kyvvu-engine && pip install -e "./kyvvu-sdk[dev,langchain]"
|
|
336
|
+
|
|
337
|
+
# Run all tests (351 tests)
|
|
338
|
+
cd kyvvu-sdk
|
|
339
|
+
python -m pytest tests/ -v
|
|
340
|
+
|
|
341
|
+
# Type checking
|
|
342
|
+
mypy --strict kyvvu/
|
|
343
|
+
|
|
344
|
+
# Linting
|
|
345
|
+
ruff check kyvvu/ tests/
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Public API surface
|
|
351
|
+
|
|
352
|
+
The following symbols are the public API (`kyvvu.__all__`):
|
|
353
|
+
|
|
354
|
+
**Core**: `Kyvvu`, `enrich`, `setup_logging`
|
|
355
|
+
|
|
356
|
+
**Exceptions**: `KyvvuError`, `KyvvuAPIError`, `KyvvuBlockedError`,
|
|
357
|
+
`KyvvuConfigError`, `KyvvuKeyRevokedError`, `KyvvuRateLimitError`,
|
|
358
|
+
`KyvvuTimeoutError`, `KyvvuValidationError`
|
|
359
|
+
|
|
360
|
+
**Vocabulary**: `StepType`, `Verb`, `Scope`, `Behavior`, `EvalContext`,
|
|
361
|
+
`EvalResult`, `PolicyResult`, `Action`
|
|
362
|
+
|
|
363
|
+
**Agent registration**: `Environment`, `RiskClassification`
|
|
364
|
+
|
|
365
|
+
**Submodule exports** (importable from submodules):
|
|
366
|
+
- `kyvvu.templates.BehaviorTemplate`, `kyvvu.templates.deep_merge`
|
|
367
|
+
- `kyvvu.integrations.FrameworkAdapter`
|
|
368
|
+
- `kyvvu.integrations.langchain.KyvvuLangChainHandler`
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Releasing
|
|
373
|
+
|
|
374
|
+
1. Edit `VERSIONS` at the repo root.
|
|
375
|
+
2. Run `./scripts/bump-version.sh`.
|
|
376
|
+
3. Merge to `main`.
|
|
377
|
+
4. Tag: `git tag sdk-v0.x.y && git push origin sdk-v0.x.y`.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Licence
|
|
382
|
+
|
|
383
|
+
The Kyvvu SDK is licensed under the **Apache License 2.0**. See `LICENSE`
|
|
384
|
+
in this directory.
|
|
385
|
+
|
|
386
|
+
**Important:** The SDK depends on `kyvvu-engine` at runtime, which is
|
|
387
|
+
separately licensed under the **Business Source License 1.1** (BSL 1.1).
|
|
388
|
+
The SDK's permissive license does not extend to the engine. Bundling,
|
|
389
|
+
vendoring, or depending on the SDK does not grant rights to the engine
|
|
390
|
+
beyond what BSL 1.1 permits. See `kyvvu-engine/LICENSE` for the engine's
|
|
391
|
+
terms.
|
|
392
|
+
|
|
393
|
+
Production use of the engine requires a Kyvvu commercial subscription
|
|
394
|
+
or license agreement: licensing@kyvvu.com
|
|
395
|
+
|
|
396
|
+
By using Kyvvu you agree to the
|
|
397
|
+
[Terms of Service](https://kyvvu.com/terms-of-service/),
|
|
398
|
+
[Privacy Policy](https://kyvvu.com/privacy-policy/), and
|
|
399
|
+
[Acceptable Use Policy](https://kyvvu.com/aup/).
|