- SDK: client with BatchTransport, trace decorator/context manager, log_decision, thread-local context stack, nested trace→span support - API: POST /api/traces (batch ingest), GET /api/traces (paginated list), GET /api/traces/[id] (full trace with relations), GET /api/health - Tests: 8 unit tests for SDK (all passing) - Transport: thread-safe buffer with background flush thread
48 lines
1.0 KiB
Python
48 lines
1.0 KiB
Python
"""AgentLens - Agent observability that traces decisions, not just API calls."""
|
|
|
|
from agentlens.client import init, shutdown, get_client
|
|
from agentlens.decision import log_decision
|
|
from agentlens.models import (
|
|
TraceData,
|
|
DecisionPoint,
|
|
Span,
|
|
Event,
|
|
TraceStatus,
|
|
DecisionType,
|
|
SpanType,
|
|
SpanStatus,
|
|
EventType,
|
|
)
|
|
|
|
import sys
|
|
|
|
if sys.version_info >= (3, 7):
|
|
import importlib
|
|
|
|
__trace_module = importlib.import_module("agentlens.trace")
|
|
trace = getattr(__trace_module, "trace")
|
|
TraceContext = getattr(__trace_module, "TraceContext")
|
|
get_current_trace = getattr(__trace_module, "get_current_trace")
|
|
else:
|
|
from agentlens.trace import trace, TraceContext, get_current_trace
|
|
|
|
__version__ = "0.1.0"
|
|
__all__ = [
|
|
"init",
|
|
"shutdown",
|
|
"get_client",
|
|
"trace",
|
|
"TraceContext",
|
|
"get_current_trace",
|
|
"log_decision",
|
|
"TraceData",
|
|
"DecisionPoint",
|
|
"Span",
|
|
"Event",
|
|
"TraceStatus",
|
|
"DecisionType",
|
|
"SpanType",
|
|
"SpanStatus",
|
|
"EventType",
|
|
]
|