Skip to content

Commit 22af19f

Browse files
feat(tracing): add TypeScript SDK and publish pipeline (#126)
* feat(tracing): add Kayba tracing SDK wrapper Adds ace.tracing module that wraps MLflow behind a Kayba-branded API. Users install ace-framework[tracing] and call configure(api_key=...) to send traces to the Kayba dashboard — MLflow is never exposed. API: configure(), @trace, start_span(), set_folder(), enable/disable. * feat(tracing): map experiment to folder, sanitize inputs, add GLM example - experiment= is now an alias for folder= (no mlflow.set_experiment call) - Folder names are sanitized: HTML stripped, allowlist enforced, capped at 256 chars - Add GLM 5.1 two-agent example (examples/tracing_glm_example.py) - Add agent guide for tracing SDK (agent-guides/tracing-sdk.md) * merge main into add_trace_sdk * feat(tracing): add TypeScript SDK and restructure into sdk/ directory - Move Python tracing code to sdk/python/ as standalone kayba-tracing package - ace/tracing/ re-exports from kayba_tracing so both import paths work - Add TypeScript SDK (sdk/typescript/) wrapping mlflow-tracing for Node.js - Update publish workflow for all three packages (ace-framework, kayba-tracing, @kayba_ai/tracing) with trusted publishing (OIDC) - Update test imports from ace.tracing._wrapper to kayba_tracing._wrapper * chore(release): bump version to 0.9.5
1 parent b10bac2 commit 22af19f

15 files changed

Lines changed: 3714 additions & 73 deletions

File tree

.github/workflows/publish.yml

Lines changed: 150 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish to PyPI
1+
name: Publish Packages
22

33
on:
44
release:
@@ -15,7 +15,10 @@ on:
1515
- 'false'
1616

1717
jobs:
18-
build:
18+
# ── ace-framework (Python) ──────────────────────────────────────────
19+
20+
build-ace:
21+
name: Build ace-framework
1922
runs-on: ubuntu-latest
2023
steps:
2124
- uses: actions/checkout@v4
@@ -36,14 +39,72 @@ jobs:
3639
- name: Store the distribution packages
3740
uses: actions/upload-artifact@v4
3841
with:
39-
name: python-package-distributions
42+
name: ace-framework-dist
4043
path: dist/
4144

45+
# ── kayba-tracing (Python) ─────────────────────────────────────────
46+
47+
build-kayba-tracing:
48+
name: Build kayba-tracing
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- name: Set up Python
54+
uses: actions/setup-python@v4
55+
with:
56+
python-version: '3.12'
57+
58+
- name: Install build dependencies
59+
run: |
60+
python -m pip install --upgrade pip
61+
pip install build
62+
63+
- name: Build package
64+
run: python -m build sdk/python
65+
66+
- name: Store the distribution packages
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: kayba-tracing-dist
70+
path: sdk/python/dist/
71+
72+
# ── @kayba_ai/tracing (TypeScript) ────────────────────────────────────
73+
74+
build-kayba-tracing-ts:
75+
name: Build @kayba_ai/tracing
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
80+
- name: Set up Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: '20'
84+
registry-url: 'https://registry.npmjs.org'
85+
86+
- name: Install dependencies
87+
run: npm ci
88+
working-directory: sdk/typescript
89+
90+
- name: Build
91+
run: npm run build
92+
working-directory: sdk/typescript
93+
94+
- name: Store the distribution packages
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: kayba-tracing-ts-dist
98+
path: |
99+
sdk/typescript/dist/
100+
sdk/typescript/package.json
101+
102+
# ── Publish to TestPyPI ────────────────────────────────────────────
103+
42104
publish-to-testpypi:
43-
name: Publish to TestPyPI
105+
name: Publish ace-framework to TestPyPI
44106
if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch'
45-
needs:
46-
- build
107+
needs: [build-ace]
47108
runs-on: ubuntu-latest
48109
environment:
49110
name: testpypi
@@ -54,7 +115,7 @@ jobs:
54115
- name: Download all the dists
55116
uses: actions/download-artifact@v4
56117
with:
57-
name: python-package-distributions
118+
name: ace-framework-dist
58119
path: dist/
59120

60121
- name: Publish to TestPyPI
@@ -63,11 +124,35 @@ jobs:
63124
repository-url: https://test.pypi.org/legacy/
64125
skip-existing: true
65126

127+
publish-kayba-tracing-to-testpypi:
128+
name: Publish kayba-tracing to TestPyPI
129+
if: github.event.inputs.test_pypi == 'true' || github.event_name == 'workflow_dispatch'
130+
needs: [build-kayba-tracing]
131+
runs-on: ubuntu-latest
132+
environment:
133+
name: testpypi
134+
url: https://test.pypi.org/project/kayba-tracing/
135+
permissions:
136+
id-token: write
137+
steps:
138+
- name: Download all the dists
139+
uses: actions/download-artifact@v4
140+
with:
141+
name: kayba-tracing-dist
142+
path: dist/
143+
144+
- name: Publish to TestPyPI
145+
uses: pypa/gh-action-pypi-publish@release/v1
146+
with:
147+
repository-url: https://test.pypi.org/legacy/
148+
skip-existing: true
149+
150+
# ── Publish to PyPI ────────────────────────────────────────────────
151+
66152
publish-to-pypi:
67-
name: Publish to PyPI
153+
name: Publish ace-framework to PyPI
68154
if: github.event_name == 'release'
69-
needs:
70-
- build
155+
needs: [build-ace]
71156
runs-on: ubuntu-latest
72157
environment:
73158
name: pypi
@@ -78,8 +163,61 @@ jobs:
78163
- name: Download all the dists
79164
uses: actions/download-artifact@v4
80165
with:
81-
name: python-package-distributions
166+
name: ace-framework-dist
167+
path: dist/
168+
169+
- name: Publish to PyPI
170+
uses: pypa/gh-action-pypi-publish@release/v1
171+
172+
publish-kayba-tracing-to-pypi:
173+
name: Publish kayba-tracing to PyPI
174+
if: github.event_name == 'release'
175+
needs: [build-kayba-tracing]
176+
runs-on: ubuntu-latest
177+
environment:
178+
name: pypi
179+
url: https://pypi.org/project/kayba-tracing/
180+
permissions:
181+
id-token: write
182+
steps:
183+
- name: Download all the dists
184+
uses: actions/download-artifact@v4
185+
with:
186+
name: kayba-tracing-dist
82187
path: dist/
83188

84189
- name: Publish to PyPI
85-
uses: pypa/gh-action-pypi-publish@release/v1
190+
uses: pypa/gh-action-pypi-publish@release/v1
191+
192+
# ── Publish to npm ─────────────────────────────────────────────────
193+
194+
publish-to-npm:
195+
name: Publish @kayba_ai/tracing to npm
196+
if: github.event_name == 'release'
197+
needs: [build-kayba-tracing-ts]
198+
runs-on: ubuntu-latest
199+
environment:
200+
name: npm
201+
url: https://www.npmjs.com/package/@kayba_ai/tracing
202+
permissions:
203+
id-token: write
204+
steps:
205+
- uses: actions/checkout@v4
206+
207+
- name: Set up Node.js
208+
uses: actions/setup-node@v4
209+
with:
210+
node-version: '22'
211+
registry-url: 'https://registry.npmjs.org'
212+
213+
- name: Install dependencies
214+
run: npm ci
215+
working-directory: sdk/typescript
216+
217+
- name: Build
218+
run: npm run build
219+
working-directory: sdk/typescript
220+
221+
- name: Publish to npm
222+
run: npm publish --provenance --access public
223+
working-directory: sdk/typescript

ace/tracing/__init__.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
"""Kayba tracing — instrument your agents and send traces to Kayba.
22
3-
Usage::
3+
This module re-exports from the standalone ``kayba-tracing`` package.
4+
Both import paths are supported::
45
5-
from ace.tracing import configure, trace, start_span
6-
7-
configure(api_key="kb-...")
6+
# Standalone package
7+
from kayba_tracing import configure, trace, start_span
88
9-
@trace
10-
def my_agent(query: str) -> str:
11-
with start_span("retrieval") as span:
12-
span.set_inputs({"query": query})
13-
results = search(query)
14-
span.set_outputs(results)
15-
return synthesize(results)
9+
# Via ace-framework
10+
from ace.tracing import configure, trace, start_span
1611
1712
Requires the ``tracing`` extra::
1813
1914
pip install ace-framework[tracing]
2015
"""
2116

22-
from ace.tracing._wrapper import (
17+
from kayba_tracing import (
2318
configure,
2419
disable,
2520
enable,

mlflow.db

648 KB
Binary file not shown.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ace-framework"
7-
version = "0.9.4"
7+
version = "0.9.5"
88
description = "Build self-improving AI agents that learn from experience"
99
readme = "README.md"
1010
requires-python = ">=3.12"
@@ -69,7 +69,7 @@ logfire = [
6969
"logfire[pydantic-ai]>=3.0.0",
7070
]
7171
tracing = [
72-
"mlflow>=3.1.0",
72+
"kayba-tracing>=0.9.4",
7373
]
7474
bedrock = [
7575
"boto3>=1.42.50",
@@ -100,7 +100,7 @@ all = [
100100
"transformers>=4.30.0",
101101
"torch>=2.0.0",
102102
"accelerate>=0.20.0",
103-
"mlflow>=3.1.0",
103+
"kayba-tracing>=0.9.4",
104104
"click>=8.1.0",
105105
"requests>=2.31.0",
106106
]
@@ -208,3 +208,4 @@ markers = [
208208

209209
[tool.uv.sources]
210210
tau2 = { git = "https://github.com/sierra-research/tau2-bench.git", branch = "dev/tau3" }
211+
kayba-tracing = { path = "sdk/python", editable = true }

sdk/python/pyproject.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "kayba-tracing"
7+
version = "0.9.5"
8+
description = "Kayba tracing SDK — instrument your AI agents and send traces to Kayba"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
license = {text = "MIT"}
12+
authors = [
13+
{name = "Kayba.ai", email = "hello@kayba.ai"},
14+
]
15+
keywords = ["kayba", "tracing", "mlflow", "observability", "ai", "agents"]
16+
classifiers = [
17+
"Development Status :: 4 - Beta",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.10",
22+
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
25+
"Topic :: Software Development :: Libraries :: Python Modules",
26+
]
27+
28+
dependencies = [
29+
"mlflow>=3.1.0",
30+
]
31+
32+
[project.urls]
33+
Homepage = "https://kayba.ai"
34+
Repository = "https://github.com/Kayba-ai/agentic-context-engine"
35+
36+
[tool.setuptools.packages.find]
37+
where = ["src"]
38+
include = ["kayba_tracing", "kayba_tracing.*"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"""Kayba tracing — instrument your agents and send traces to Kayba.
2+
3+
Usage::
4+
5+
from kayba_tracing import configure, trace, start_span
6+
7+
configure(api_key="kb-...")
8+
9+
@trace
10+
def my_agent(query: str) -> str:
11+
with start_span("retrieval") as span:
12+
span.set_inputs({"query": query})
13+
results = search(query)
14+
span.set_outputs(results)
15+
return synthesize(results)
16+
17+
Install::
18+
19+
pip install kayba-tracing
20+
"""
21+
22+
from kayba_tracing._wrapper import (
23+
configure,
24+
disable,
25+
enable,
26+
get_folder,
27+
get_trace,
28+
search_traces,
29+
set_folder,
30+
start_span,
31+
trace,
32+
)
33+
34+
__all__ = [
35+
"configure",
36+
"disable",
37+
"enable",
38+
"get_folder",
39+
"get_trace",
40+
"search_traces",
41+
"set_folder",
42+
"start_span",
43+
"trace",
44+
]

0 commit comments

Comments
 (0)