Agentic development kit — LLM tracing, tool management, and agent primitives
Project description
lightrace-python
Lightweight LLM tracing SDK for Python with remote tool invocation.
Install
pip install lightrace
Quick Start
from lightrace import Lightrace, trace
lt = Lightrace(
public_key="pk-lt-demo",
secret_key="sk-lt-demo",
host="http://localhost:3002",
)
# Root trace
@trace()
def run_agent(query: str):
return search(query)
# Span
@trace(type="span")
def search(query: str) -> list:
return ["result1", "result2"]
# Generation (LLM call)
@trace(type="generation", model="gpt-4o")
def generate(prompt: str) -> str:
return "LLM response"
# Tool — remotely invocable from the Lightrace UI
@trace(type="tool")
def weather_lookup(city: str) -> dict:
return {"temp": 72, "unit": "F"}
# Tool — traced but NOT remotely invocable
@trace(type="tool", invoke=False)
def read_file(path: str) -> str:
return open(path).read()
run_agent("hello")
lt.flush()
lt.shutdown()
@trace API
@trace() # Root trace
@trace(type="span") # Span observation
@trace(type="generation", model="gpt-4o") # LLM generation
@trace(type="tool") # Tool (remotely invocable)
@trace(type="tool", invoke=False) # Tool (trace only)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
type |
str |
None |
"span", "generation", "tool", "chain", "event" |
name |
str |
None |
Override name (defaults to function name) |
invoke |
bool |
True |
For type="tool": register for remote invocation |
model |
str |
None |
For type="generation": LLM model name |
metadata |
dict |
None |
Static metadata attached to every call |
Compatibility
Lightrace server also accepts traces from Langfuse Python/JS SDKs.
Development
uv sync --extra dev
uv run pre-commit install
uv run pytest -s -v tests/
uv run ruff check .
uv run mypy src/lightrace
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lightrace-1.0.4.tar.gz.
File metadata
- Download URL: lightrace-1.0.4.tar.gz
- Upload date:
- Size: 381.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b04b6c6f4f57561a56a2da4f93f5f7f980f73a3ebad5d72cf03a13dd065047a
|
|
| MD5 |
41563955b5b3f67665106daa324339b4
|
|
| BLAKE2b-256 |
a7815c445596c19ddf9d080c3bafa45616c03e58fd57ff137773414eb698a5b8
|
Provenance
The following attestation bundles were made for lightrace-1.0.4.tar.gz:
Publisher:
release.yml on SKE-Labs/lightrace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightrace-1.0.4.tar.gz -
Subject digest:
9b04b6c6f4f57561a56a2da4f93f5f7f980f73a3ebad5d72cf03a13dd065047a - Sigstore transparency entry: 1205795232
- Sigstore integration time:
-
Permalink:
SKE-Labs/lightrace-python@ab8e57696358168d0e76d5d923e03fda9d60e1af -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SKE-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab8e57696358168d0e76d5d923e03fda9d60e1af -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file lightrace-1.0.4-py3-none-any.whl.
File metadata
- Download URL: lightrace-1.0.4-py3-none-any.whl
- Upload date:
- Size: 37.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bb5ccd3f621262b3895232590ff66cb19c52b6430f1d1913ea50cf95778bfd3
|
|
| MD5 |
3bd3f8287667c7e50caead8829228869
|
|
| BLAKE2b-256 |
9321539159f37bcbc61d1b5f9c98a39831ac579702b8fd36b7d0f2f1eb1f3526
|
Provenance
The following attestation bundles were made for lightrace-1.0.4-py3-none-any.whl:
Publisher:
release.yml on SKE-Labs/lightrace-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lightrace-1.0.4-py3-none-any.whl -
Subject digest:
8bb5ccd3f621262b3895232590ff66cb19c52b6430f1d1913ea50cf95778bfd3 - Sigstore transparency entry: 1205795241
- Sigstore integration time:
-
Permalink:
SKE-Labs/lightrace-python@ab8e57696358168d0e76d5d923e03fda9d60e1af -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SKE-Labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ab8e57696358168d0e76d5d923e03fda9d60e1af -
Trigger Event:
workflow_dispatch
-
Statement type: