tensorcost 1.3.0__tar.gz → 1.3.2__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.
Files changed (63) hide show
  1. {tensorcost-1.3.0 → tensorcost-1.3.2}/PKG-INFO +4 -4
  2. {tensorcost-1.3.0 → tensorcost-1.3.2}/pyproject.toml +4 -4
  3. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_config.py +7 -0
  4. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_agent_run.py +19 -0
  5. {tensorcost-1.3.0 → tensorcost-1.3.2}/.gitignore +0 -0
  6. {tensorcost-1.3.0 → tensorcost-1.3.2}/.py-credentials.example +0 -0
  7. {tensorcost-1.3.0 → tensorcost-1.3.2}/CHANGELOG.md +0 -0
  8. {tensorcost-1.3.0 → tensorcost-1.3.2}/LICENSE +0 -0
  9. {tensorcost-1.3.0 → tensorcost-1.3.2}/PUBLISHING.md +0 -0
  10. {tensorcost-1.3.0 → tensorcost-1.3.2}/README.md +0 -0
  11. {tensorcost-1.3.0 → tensorcost-1.3.2}/scripts/load-pypi-creds.sh +0 -0
  12. {tensorcost-1.3.0 → tensorcost-1.3.2}/scripts/publish.sh +0 -0
  13. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/__init__.py +0 -0
  14. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_admit_client.py +0 -0
  15. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_applied_mode.py +0 -0
  16. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_attribution.py +0 -0
  17. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_circuit.py +0 -0
  18. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_compliance_guard.py +0 -0
  19. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_compliance_team.py +0 -0
  20. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_decision.py +0 -0
  21. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_dlp.py +0 -0
  22. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_errors.py +0 -0
  23. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_layer.py +0 -0
  24. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_models.py +0 -0
  25. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_prewarm.py +0 -0
  26. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/__init__.py +0 -0
  27. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/_anthropic.py +0 -0
  28. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/_bedrock.py +0 -0
  29. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/_detect.py +0 -0
  30. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/_openai.py +0 -0
  31. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_providers/_vertex.py +0 -0
  32. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_proxy_client.py +0 -0
  33. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_retry.py +0 -0
  34. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_runtime.py +0 -0
  35. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_sdk_layer.py +0 -0
  36. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_telemetry.py +0 -0
  37. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_transport.py +0 -0
  38. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_version.py +0 -0
  39. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/_wrap.py +0 -0
  40. {tensorcost-1.3.0 → tensorcost-1.3.2}/src/tensorcost/py.typed +0 -0
  41. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/__init__.py +0 -0
  42. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/conftest.py +0 -0
  43. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_applied_mode.py +0 -0
  44. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_circuit.py +0 -0
  45. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_config.py +0 -0
  46. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_customer_feature.py +0 -0
  47. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_dlp.py +0 -0
  48. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_errors.py +0 -0
  49. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_hardening.py +0 -0
  50. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_prewarm.py +0 -0
  51. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/__init__.py +0 -0
  52. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/test_anthropic.py +0 -0
  53. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/test_bedrock.py +0 -0
  54. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/test_detect.py +0 -0
  55. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/test_openai.py +0 -0
  56. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_providers/test_vertex.py +0 -0
  57. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_proxy_client.py +0 -0
  58. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_retry.py +0 -0
  59. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_sdk_layer.py +0 -0
  60. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_should_fall_back.py +0 -0
  61. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_telemetry.py +0 -0
  62. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_transport.py +0 -0
  63. {tensorcost-1.3.0 → tensorcost-1.3.2}/tests/test_wrap.py +0 -0
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tensorcost
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: One-line wrapper SDK for TensorCost — LLM observability and control-layer inference routing for OpenAI, Anthropic, Bedrock, and Vertex clients.
5
5
  Project-URL: Homepage, https://tensorcost.com
6
6
  Project-URL: Documentation, https://docs.tensorcost.com
7
- Project-URL: Source, https://github.com/tensorcost/agent/tree/main/sdks/python
8
- Project-URL: Changelog, https://github.com/tensorcost/agent/blob/main/sdks/python/CHANGELOG.md
9
- Project-URL: Bug Tracker, https://github.com/tensorcost/agent/issues
7
+ Project-URL: Source, https://github.com/vaadhlabs/tensorcost-agent/tree/main/sdks/python
8
+ Project-URL: Changelog, https://github.com/vaadhlabs/tensorcost-agent/blob/main/sdks/python/CHANGELOG.md
9
+ Project-URL: Bug Tracker, https://github.com/vaadhlabs/tensorcost-agent/issues
10
10
  Author-email: Vaadh Labs / TensorCost <engineering@tensorcost.com>
11
11
  License: Apache-2.0
12
12
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tensorcost"
7
- version = "1.3.0"
7
+ version = "1.3.2"
8
8
  description = "One-line wrapper SDK for TensorCost — LLM observability and control-layer inference routing for OpenAI, Anthropic, Bedrock, and Vertex clients."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -39,9 +39,9 @@ dev = [
39
39
  [project.urls]
40
40
  Homepage = "https://tensorcost.com"
41
41
  Documentation = "https://docs.tensorcost.com"
42
- Source = "https://github.com/tensorcost/agent/tree/main/sdks/python"
43
- Changelog = "https://github.com/tensorcost/agent/blob/main/sdks/python/CHANGELOG.md"
44
- "Bug Tracker" = "https://github.com/tensorcost/agent/issues"
42
+ Source = "https://github.com/vaadhlabs/tensorcost-agent/tree/main/sdks/python"
43
+ Changelog = "https://github.com/vaadhlabs/tensorcost-agent/blob/main/sdks/python/CHANGELOG.md"
44
+ "Bug Tracker" = "https://github.com/vaadhlabs/tensorcost-agent/issues"
45
45
 
46
46
  [tool.hatch.build.targets.wheel]
47
47
  packages = ["src/tensorcost"]
@@ -19,6 +19,7 @@ loudly so the problem surfaces in development, not in production.
19
19
  from __future__ import annotations
20
20
 
21
21
  import os
22
+ import uuid
22
23
  from dataclasses import dataclass, field
23
24
  from typing import Callable, Optional
24
25
 
@@ -119,6 +120,7 @@ def resolve_config(
119
120
  feature: Optional[str] = None,
120
121
  agent_id: Optional[str] = None,
121
122
  workflow_id: Optional[str] = None,
123
+ auto_workflow_id: Optional[bool] = None,
122
124
  team_id: Optional[str] = None,
123
125
  ) -> ResolvedConfig:
124
126
  """Resolve final config values, env vars filling in any blanks."""
@@ -217,6 +219,11 @@ def resolve_config(
217
219
  workflow_id or os.environ.get("TENSORCOST_WORKFLOW_ID"),
218
220
  "workflow_id",
219
221
  )
222
+ auto_workflow_enabled = auto_workflow_id is True or (
223
+ os.environ.get("TENSORCOST_AUTO_WORKFLOW_ID", "").strip() == "1"
224
+ )
225
+ if final_workflow_id is None and final_agent_id and auto_workflow_enabled:
226
+ final_workflow_id = str(uuid.uuid4())
220
227
  raw_team = team_id or os.environ.get("TENSORCOST_TEAM_ID")
221
228
  final_team_id: Optional[str] = None
222
229
  if raw_team is not None:
@@ -26,6 +26,25 @@ class TestAgentRunConfig:
26
26
  assert cfg.agent_id == "env-agent"
27
27
  assert cfg.workflow_id == "env-workflow"
28
28
 
29
+ def test_auto_workflow_id_off_by_default(self, monkeypatch):
30
+ monkeypatch.setenv("TENSORCOST_API_KEY", "k")
31
+ monkeypatch.delenv("TENSORCOST_WORKFLOW_ID", raising=False)
32
+ monkeypatch.delenv("TENSORCOST_AUTO_WORKFLOW_ID", raising=False)
33
+ cfg = resolve_config(agent_id="support-bot")
34
+ assert cfg.workflow_id is None
35
+
36
+ def test_auto_workflow_id_when_enabled(self, monkeypatch):
37
+ monkeypatch.setenv("TENSORCOST_API_KEY", "k")
38
+ cfg = resolve_config(agent_id="support-bot", auto_workflow_id=True)
39
+ assert cfg.workflow_id is not None
40
+ assert len(cfg.workflow_id) >= 32
41
+
42
+ def test_auto_workflow_id_env_flag(self, monkeypatch):
43
+ monkeypatch.setenv("TENSORCOST_API_KEY", "k")
44
+ monkeypatch.setenv("TENSORCOST_AUTO_WORKFLOW_ID", "1")
45
+ cfg = resolve_config(agent_id="support-bot")
46
+ assert cfg.workflow_id is not None
47
+
29
48
  def test_max_length_128(self, monkeypatch):
30
49
  monkeypatch.setenv("TENSORCOST_API_KEY", "k")
31
50
  with pytest.raises(MissingConfigError, match="agent_id"):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes