veris-ai 1.10.1__tar.gz → 1.11.1__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.
Potentially problematic release.
This version of veris-ai might be problematic. Click here for more details.
- {veris_ai-1.10.1 → veris_ai-1.11.1}/.github/workflows/test.yml +1 -1
- {veris_ai-1.10.1 → veris_ai-1.11.1}/PKG-INFO +4 -20
- {veris_ai-1.10.1 → veris_ai-1.11.1}/README.md +3 -1
- {veris_ai-1.10.1 → veris_ai-1.11.1}/pyproject.toml +26 -30
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/README.md +4 -4
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/api_client.py +3 -3
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/observability.py +2 -1
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/tool_mock.py +29 -6
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_agents_wrapper_simple.py +1 -1
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_tool_mock.py +9 -5
- {veris_ai-1.10.1 → veris_ai-1.11.1}/uv.lock +416 -435
- {veris_ai-1.10.1 → veris_ai-1.11.1}/.cursor/rules/documentation-management.mdc +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/.github/workflows/release.yml +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/.gitignore +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/.pre-commit-config.yaml +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/CHANGELOG.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/CLAUDE.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/LICENSE +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/examples/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/examples/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/examples/import_options.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/examples/openai_agents_example.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/agents_wrapper.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/jaeger_interface/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/jaeger_interface/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/jaeger_interface/client.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/jaeger_interface/models.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/models.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/src/veris_ai/utils.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/conftest.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/fixtures/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/fixtures/http_server.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/fixtures/simple_app.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_agents_wrapper_extract.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_mcp_protocol_server_mocked.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_utils.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.1}/tests/test_veris_runner_tool_options.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: veris-ai
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.11.1
|
|
4
4
|
Summary: A Python package for Veris AI tools
|
|
5
5
|
Project-URL: Homepage, https://github.com/veris-ai/veris-python-sdk
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/veris-ai/veris-python-sdk/issues
|
|
@@ -21,28 +21,12 @@ Requires-Dist: opentelemetry-sdk>=1.34.1
|
|
|
21
21
|
Requires-Dist: pydantic>=2.0.0
|
|
22
22
|
Requires-Dist: requests>=2.31.0
|
|
23
23
|
Requires-Dist: tenacity>=9.1.2
|
|
24
|
-
Provides-Extra: agents
|
|
25
|
-
Requires-Dist: openai-agents>=0.0.1; extra == 'agents'
|
|
26
|
-
Provides-Extra: dev
|
|
27
|
-
Requires-Dist: black>=23.7.0; extra == 'dev'
|
|
28
|
-
Requires-Dist: mypy>=1.5.1; extra == 'dev'
|
|
29
|
-
Requires-Dist: openai-agents>=0.2.5; extra == 'dev'
|
|
30
|
-
Requires-Dist: pre-commit>=3.3.3; extra == 'dev'
|
|
31
|
-
Requires-Dist: pytest-asyncio>=0.21.1; extra == 'dev'
|
|
32
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
33
|
-
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
34
|
-
Requires-Dist: ruff>=0.11.4; extra == 'dev'
|
|
35
|
-
Provides-Extra: fastapi
|
|
36
|
-
Requires-Dist: fastapi; extra == 'fastapi'
|
|
37
|
-
Requires-Dist: fastapi-mcp>=0.4.0; extra == 'fastapi'
|
|
38
|
-
Provides-Extra: instrument
|
|
39
|
-
Requires-Dist: opentelemetry-api; extra == 'instrument'
|
|
40
|
-
Requires-Dist: opentelemetry-sdk; extra == 'instrument'
|
|
41
|
-
Requires-Dist: wrapt; extra == 'instrument'
|
|
42
24
|
Description-Content-Type: text/markdown
|
|
43
25
|
|
|
44
26
|
# Veris AI Python SDK
|
|
45
27
|
|
|
28
|
+
For more information visit us at https://veris.ai
|
|
29
|
+
|
|
46
30
|
A Python package for Veris AI tools with simulation capabilities and FastAPI MCP (Model Context Protocol) integration.
|
|
47
31
|
|
|
48
32
|
## Quick Reference
|
|
@@ -151,7 +135,7 @@ What this enables:
|
|
|
151
135
|
|
|
152
136
|
End-to-end propagation with the simulator:
|
|
153
137
|
- The simulator injects W3C headers when connecting to your FastAPI MCP endpoints
|
|
154
|
-
- The SDK injects W3C headers on `/
|
|
138
|
+
- The SDK injects W3C headers on `/v3/tool_mock` and logging requests back to the simulator
|
|
155
139
|
- Result: customer agent spans and tool mocks appear under the same distributed trace
|
|
156
140
|
|
|
157
141
|
## Function Mocking
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Veris AI Python SDK
|
|
2
2
|
|
|
3
|
+
For more information visit us at https://veris.ai
|
|
4
|
+
|
|
3
5
|
A Python package for Veris AI tools with simulation capabilities and FastAPI MCP (Model Context Protocol) integration.
|
|
4
6
|
|
|
5
7
|
## Quick Reference
|
|
@@ -108,7 +110,7 @@ What this enables:
|
|
|
108
110
|
|
|
109
111
|
End-to-end propagation with the simulator:
|
|
110
112
|
- The simulator injects W3C headers when connecting to your FastAPI MCP endpoints
|
|
111
|
-
- The SDK injects W3C headers on `/
|
|
113
|
+
- The SDK injects W3C headers on `/v3/tool_mock` and logging requests back to the simulator
|
|
112
114
|
- Result: customer agent spans and tool mocks appear under the same distributed trace
|
|
113
115
|
|
|
114
116
|
## Function Mocking
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "veris-ai"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.11.1"
|
|
8
8
|
description = "A Python package for Veris AI tools"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -28,30 +28,6 @@ dependencies = [
|
|
|
28
28
|
"tenacity>=9.1.2",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
|
-
[project.optional-dependencies]
|
|
32
|
-
dev = [
|
|
33
|
-
"ruff>=0.11.4",
|
|
34
|
-
"pytest>=7.4.0",
|
|
35
|
-
"pytest-asyncio>=0.21.1",
|
|
36
|
-
"pytest-cov>=4.1.0",
|
|
37
|
-
"black>=23.7.0",
|
|
38
|
-
"mypy>=1.5.1",
|
|
39
|
-
"pre-commit>=3.3.3",
|
|
40
|
-
"openai-agents>=0.2.5",
|
|
41
|
-
]
|
|
42
|
-
fastapi = [
|
|
43
|
-
"fastapi",
|
|
44
|
-
"fastapi-mcp>=0.4.0",
|
|
45
|
-
]
|
|
46
|
-
agents = [
|
|
47
|
-
"openai-agents>=0.0.1",
|
|
48
|
-
]
|
|
49
|
-
instrument = [
|
|
50
|
-
"wrapt",
|
|
51
|
-
"opentelemetry-api",
|
|
52
|
-
"opentelemetry-sdk",
|
|
53
|
-
]
|
|
54
|
-
|
|
55
31
|
[project.urls]
|
|
56
32
|
"Homepage" = "https://github.com/veris-ai/veris-python-sdk"
|
|
57
33
|
"Bug Tracker" = "https://github.com/veris-ai/veris-python-sdk/issues"
|
|
@@ -63,6 +39,17 @@ packages = ["src/veris_ai"]
|
|
|
63
39
|
testpaths = ["tests"]
|
|
64
40
|
python_files = ["test_*.py"]
|
|
65
41
|
|
|
42
|
+
[tool.mypy]
|
|
43
|
+
ignore_missing_imports = false
|
|
44
|
+
|
|
45
|
+
[[tool.mypy.overrides]]
|
|
46
|
+
module = [
|
|
47
|
+
"fastapi.*",
|
|
48
|
+
"fastapi_mcp.*",
|
|
49
|
+
"agents.*",
|
|
50
|
+
]
|
|
51
|
+
ignore_missing_imports = true
|
|
52
|
+
|
|
66
53
|
[tool.ruff]
|
|
67
54
|
line-length = 100
|
|
68
55
|
target-version = "py311"
|
|
@@ -171,13 +158,22 @@ veris-ai = { workspace = true }
|
|
|
171
158
|
|
|
172
159
|
[dependency-groups]
|
|
173
160
|
dev = [
|
|
174
|
-
"
|
|
175
|
-
"fastapi-mcp>=0.4.0",
|
|
176
|
-
"mypy>=1.17.0",
|
|
177
|
-
"openai-agents>=0.0.1",
|
|
161
|
+
"ruff>=0.12.4",
|
|
178
162
|
"pytest>=8.4.1",
|
|
179
163
|
"pytest-asyncio>=1.1.0",
|
|
180
164
|
"pytest-cov>=6.2.1",
|
|
181
|
-
"
|
|
165
|
+
"mypy>=1.17.0",
|
|
182
166
|
"types-requests>=2.32.4.20250611",
|
|
167
|
+
"pre-commit>=3.3.3",
|
|
168
|
+
"uvicorn>=0.30.0",
|
|
169
|
+
]
|
|
170
|
+
fastapi = [
|
|
171
|
+
"fastapi>=0.116.1",
|
|
172
|
+
"fastapi-mcp>=0.4.0",
|
|
173
|
+
]
|
|
174
|
+
agents = [
|
|
175
|
+
"openai-agents>=0.2.5",
|
|
176
|
+
]
|
|
177
|
+
instrument = [
|
|
178
|
+
"wrapt>=1.14.0",
|
|
183
179
|
]
|
|
@@ -27,16 +27,16 @@ This module contains the core implementation of the Veris AI Python SDK. Each co
|
|
|
27
27
|
|
|
28
28
|
### Mock Flow
|
|
29
29
|
1. **Decoration**: `@veris.mock()` captures function metadata
|
|
30
|
-
2. **
|
|
31
|
-
3. **API Call**: POST to
|
|
30
|
+
2. **Session Check**: Presence of session ID determines behavior
|
|
31
|
+
3. **API Call**: POST to VERIS API endpoint `/v3/tool_mock` (auto-configured)
|
|
32
32
|
4. **Type Conversion**: Response converted using `extract_json_schema()`
|
|
33
33
|
|
|
34
34
|
**Implementation**: [`tool_mock.py:200-250`](tool_mock.py)
|
|
35
35
|
|
|
36
36
|
### Spy Flow
|
|
37
|
-
1. **Pre-execution Logging**: Call details sent to
|
|
37
|
+
1. **Pre-execution Logging**: Call details sent to `v3/log_tool_call?session_id={session_id}`
|
|
38
38
|
2. **Function Execution**: Original function runs normally
|
|
39
|
-
3. **Post-execution Logging**: Response sent to
|
|
39
|
+
3. **Post-execution Logging**: Response sent to `v3/log_tool_response?session_id={session_id}`
|
|
40
40
|
|
|
41
41
|
**Implementation**: [`tool_mock.py:250-300`](tool_mock.py)
|
|
42
42
|
|
|
@@ -63,15 +63,15 @@ class SimulatorAPIClient:
|
|
|
63
63
|
@property
|
|
64
64
|
def tool_mock_endpoint(self) -> str:
|
|
65
65
|
"""Get the tool mock endpoint URL."""
|
|
66
|
-
return urljoin(self._get_base_url(), "
|
|
66
|
+
return urljoin(self._get_base_url(), "v3/tool_mock")
|
|
67
67
|
|
|
68
68
|
def get_log_tool_call_endpoint(self, session_id: str) -> str:
|
|
69
69
|
"""Get the log tool call endpoint URL."""
|
|
70
|
-
return urljoin(self._get_base_url(), f"
|
|
70
|
+
return urljoin(self._get_base_url(), f"v3/log_tool_call?session_id={session_id}")
|
|
71
71
|
|
|
72
72
|
def get_log_tool_response_endpoint(self, session_id: str) -> str:
|
|
73
73
|
"""Get the log tool response endpoint URL."""
|
|
74
|
-
return urljoin(self._get_base_url(), f"
|
|
74
|
+
return urljoin(self._get_base_url(), f"v3/log_tool_response?session_id={session_id}")
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
# Global singleton instance
|
|
@@ -16,7 +16,7 @@ logger = getLogger(__name__)
|
|
|
16
16
|
def init_observability() -> None: # noqa: PLR0912
|
|
17
17
|
"""Initialize tracing/export and set W3C propagation.
|
|
18
18
|
|
|
19
|
-
- Initializes
|
|
19
|
+
- Initializes Traceloop if available (acts as OTel bootstrap/exporter)
|
|
20
20
|
- Sets global propagator to TraceContext + Baggage (W3C)
|
|
21
21
|
- Instruments MCP, requests, httpx if instrumentation packages are present
|
|
22
22
|
- Adds a request hook to capture outbound traceparent for debugging
|
|
@@ -35,6 +35,7 @@ def init_observability() -> None: # noqa: PLR0912
|
|
|
35
35
|
logfire.instrument_mcp()
|
|
36
36
|
|
|
37
37
|
except Exception as e:
|
|
38
|
+
# Tracing is optional; continue without Traceloop
|
|
38
39
|
msg = "Logfire not found: " + str(e)
|
|
39
40
|
raise RuntimeError(msg) from e
|
|
40
41
|
|
|
@@ -62,13 +62,14 @@ class VerisSDK:
|
|
|
62
62
|
FastApiMCP,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
|
65
|
+
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token", auto_error=False)
|
|
66
66
|
|
|
67
67
|
async def authenticate_request(
|
|
68
|
-
|
|
69
|
-
token: str = Depends(oauth2_scheme),
|
|
68
|
+
request: Request, # noqa: ARG001
|
|
69
|
+
token: str | None = Depends(oauth2_scheme),
|
|
70
70
|
) -> None:
|
|
71
|
-
|
|
71
|
+
if token:
|
|
72
|
+
self.set_session_id(token)
|
|
72
73
|
|
|
73
74
|
# Create auth config with dependencies
|
|
74
75
|
auth_config = AuthConfig(
|
|
@@ -267,6 +268,17 @@ def mock_tool_call(
|
|
|
267
268
|
return_type_obj = type_hints.pop("return", Any)
|
|
268
269
|
# Get function docstring
|
|
269
270
|
docstring = inspect.getdoc(func) or ""
|
|
271
|
+
|
|
272
|
+
# Clean up parameters for V3 - just send values, not the nested dict
|
|
273
|
+
clean_params: dict[str, Any] = {}
|
|
274
|
+
for key, value in parameters.items():
|
|
275
|
+
if isinstance(value, dict) and "value" in value:
|
|
276
|
+
# Extract just the value from the nested structure
|
|
277
|
+
clean_params[key] = value["value"]
|
|
278
|
+
else:
|
|
279
|
+
# Already clean or unexpected format
|
|
280
|
+
clean_params[key] = value
|
|
281
|
+
|
|
270
282
|
# Determine response expectation
|
|
271
283
|
payload = {
|
|
272
284
|
"session_id": session_id,
|
|
@@ -274,7 +286,7 @@ def mock_tool_call(
|
|
|
274
286
|
"cache_response": bool(options.cache_response),
|
|
275
287
|
"tool_call": {
|
|
276
288
|
"function_name": func.__name__,
|
|
277
|
-
"parameters":
|
|
289
|
+
"parameters": clean_params,
|
|
278
290
|
"return_type": json.dumps(extract_json_schema(return_type_obj)),
|
|
279
291
|
"docstring": docstring,
|
|
280
292
|
},
|
|
@@ -299,9 +311,20 @@ def log_tool_call(
|
|
|
299
311
|
"""Log tool call synchronously to the VERIS logging endpoint."""
|
|
300
312
|
api_client = get_api_client()
|
|
301
313
|
endpoint = api_client.get_log_tool_call_endpoint(session_id)
|
|
314
|
+
|
|
315
|
+
# Clean up parameters for V3 - just send values, not the nested dict
|
|
316
|
+
clean_params: dict[str, Any] = {}
|
|
317
|
+
for key, value in parameters.items():
|
|
318
|
+
if isinstance(value, dict) and "value" in value:
|
|
319
|
+
# Extract just the value from the nested structure
|
|
320
|
+
clean_params[key] = value["value"]
|
|
321
|
+
else:
|
|
322
|
+
# Already clean or unexpected format
|
|
323
|
+
clean_params[key] = value
|
|
324
|
+
|
|
302
325
|
payload = {
|
|
303
326
|
"function_name": function_name,
|
|
304
|
-
"parameters":
|
|
327
|
+
"parameters": clean_params,
|
|
305
328
|
"docstring": docstring,
|
|
306
329
|
}
|
|
307
330
|
try:
|
|
@@ -244,7 +244,7 @@ async def test_runner_with_session_calls_endpoint(
|
|
|
244
244
|
|
|
245
245
|
# Verify the call had correct structure
|
|
246
246
|
first_call = mock_veris_endpoint["calls"][0]
|
|
247
|
-
assert first_call["endpoint"] == "http://localhost:8000/
|
|
247
|
+
assert first_call["endpoint"] == "http://localhost:8000/v3/tool_mock"
|
|
248
248
|
assert first_call["payload"]["session_id"] == "test-session-123"
|
|
249
249
|
assert "add_numbers" in str(first_call["payload"]) or "veris_tool_function" in str(
|
|
250
250
|
first_call["payload"]
|
|
@@ -91,8 +91,9 @@ async def test_mock_http_error(simulation_env):
|
|
|
91
91
|
|
|
92
92
|
@pytest.mark.asyncio
|
|
93
93
|
async def test_mock_missing_endpoint():
|
|
94
|
-
"""Test that missing endpoint raises
|
|
95
|
-
|
|
94
|
+
"""Test that missing endpoint raises ConnectError when invalid URL is used."""
|
|
95
|
+
# Use invalid URL that will trigger ConnectError
|
|
96
|
+
with patch.dict(os.environ, {"VERIS_API_URL": "http://invalid-nonexistent-domain-12345.local"}):
|
|
96
97
|
|
|
97
98
|
@veris.mock()
|
|
98
99
|
async def test_func():
|
|
@@ -101,15 +102,18 @@ async def test_mock_missing_endpoint():
|
|
|
101
102
|
# Set session_id to enable simulation mode
|
|
102
103
|
veris.set_session_id("test-session")
|
|
103
104
|
|
|
104
|
-
#
|
|
105
|
-
# We'll test that the connection fails with httpx.ConnectError
|
|
105
|
+
# Invalid domain will cause ConnectError
|
|
106
106
|
with pytest.raises(httpx.ConnectError):
|
|
107
107
|
await test_func()
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
@pytest.mark.asyncio
|
|
111
111
|
async def test_mock_invalid_endpoint(simulation_env):
|
|
112
|
-
|
|
112
|
+
# Use invalid URL that will trigger ConnectError
|
|
113
|
+
with (
|
|
114
|
+
patch.dict(os.environ, {"VERIS_API_URL": "http://invalid-nonexistent-domain-67890.local"}),
|
|
115
|
+
pytest.raises(httpx.ConnectError),
|
|
116
|
+
):
|
|
113
117
|
|
|
114
118
|
@veris.mock()
|
|
115
119
|
async def test_func():
|