Client SDK for Chaukas agent audit and explainability platform
Project description
Chaukas Client SDK
Client-side Python SDK for the Chaukas agent audit and explainability platform.
Installation
pip install chaukas-spec-client
Quick Start
Basic Client Usage
import grpc
from chaukas.spec.client.v1.client_pb2_grpc import ChaukasClientServiceStub
from chaukas.spec.client.v1.client_pb2 import IngestEventRequest, HealthzRequest
from chaukas.spec.common.v1.events_pb2 import Event, EventType
# Create gRPC channel and client
channel = grpc.insecure_channel('localhost:50051')
client = ChaukasClientServiceStub(channel)
# Health check
health_request = HealthzRequest()
health_response = client.Healthz(health_request)
print("Service is healthy!")
# Create and send an event
event = Event(
event_id="evt_123",
type=EventType.EVENT_TYPE_AGENT_START,
session_id="session_abc",
tenant_id="tenant_123",
project_id="project_456"
)
request = IngestEventRequest(event=event)
response = client.IngestEvent(request)
print("Event ingested successfully!")
Available Event Types
from chaukas.spec.common.v1.events_pb2 import EventType
# Session lifecycle
EventType.EVENT_TYPE_SESSION_START
EventType.EVENT_TYPE_SESSION_END
# Agent spans
EventType.EVENT_TYPE_AGENT_START
EventType.EVENT_TYPE_AGENT_END
EventType.EVENT_TYPE_AGENT_HANDOFF
# LLM/Tool spans
EventType.EVENT_TYPE_MODEL_INVOCATION_START
EventType.EVENT_TYPE_MODEL_INVOCATION_END
EventType.EVENT_TYPE_TOOL_CALL_START
EventType.EVENT_TYPE_TOOL_CALL_END
# MCP (Model Context Protocol) spans
EventType.EVENT_TYPE_MCP_CALL_START
EventType.EVENT_TYPE_MCP_CALL_END
# I/O Events
EventType.EVENT_TYPE_INPUT_RECEIVED
EventType.EVENT_TYPE_OUTPUT_EMITTED
# Error handling
EventType.EVENT_TYPE_ERROR
EventType.EVENT_TYPE_RETRY
Batch Event Ingestion
from chaukas.spec.client.v1.client_pb2 import IngestEventBatchRequest
from chaukas.spec.common.v1.events_pb2 import EventBatch
# Create multiple events
events = [
Event(event_id="evt_1", type=EventType.EVENT_TYPE_SESSION_START),
Event(event_id="evt_2", type=EventType.EVENT_TYPE_AGENT_START),
]
batch = EventBatch(events=events)
request = IngestEventBatchRequest(event_batch=batch)
response = client.IngestEventBatch(request)
print("Event batch ingested!")
Querying Events
from chaukas.spec.client.v1.client_pb2 import QueryEventsRequest
from chaukas.spec.common.v1.query_pb2 import QueryRequest, QueryFilter, SortOrder
# Query events with enhanced filtering
filter = QueryFilter(
tenant_id="tenant_123",
project_id="project_456",
trace_id="trace_abc123", # New: Filter by distributed trace ID
session_id="session_abc"
)
query = QueryRequest(
filter=filter,
page_size=100,
order_by_time=SortOrder.SORT_ORDER_DESC
)
request = QueryEventsRequest(query=query)
response = client.QueryEvents(request)
print(f"Found {len(response.response.events)} events")
for event in response.response.events:
print(f"- {event.event_id}: {event.type} (trace: {event.trace_id})")
Advanced Event Creation with New Fields
# Create event with distributed tracing
event = Event(
event_id="evt_123",
type=EventType.EVENT_TYPE_AGENT_HANDOFF,
session_id="session_abc",
tenant_id="tenant_123",
project_id="project_456",
trace_id="trace_abc123" # New: Distributed trace correlation
)
# Enhanced tool call with function name
from chaukas.spec.common.v1.events_pb2 import ToolCall
from google.protobuf.struct_pb2 import Struct
tool_call = ToolCall(
id="call_123",
name="calculator",
function_name="multiply", # New: Specific function within tool
arguments=Struct() # Add your arguments here
)
tool_event = Event(
event_id="evt_tool_456",
type=EventType.EVENT_TYPE_TOOL_CALL_START,
trace_id="trace_abc123",
tool_call=tool_call
)
Error Handling
import grpc
try:
response = client.IngestEvent(request)
except grpc.RpcError as e:
if e.code() == grpc.StatusCode.UNAVAILABLE:
print("Service unavailable")
elif e.code() == grpc.StatusCode.INVALID_ARGUMENT:
print("Invalid request:", e.details())
else:
print(f"RPC failed: {e}")
Development
This package contains generated Protocol Buffer code. For development instructions and to contribute to the specification, see the main repository:
https://github.com/chaukasai/spec
License
Apache License 2.0 - see the main repository for details.
Project details
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 chaukas_spec_client-1.0.3.tar.gz.
File metadata
- Download URL: chaukas_spec_client-1.0.3.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c2565181ae457b0ce5736c9461e0ddbf79e7920bcf22e05d80104ed69be27f5
|
|
| MD5 |
f62bad03308011ae9bfe3f7d85b1dc9f
|
|
| BLAKE2b-256 |
daa8ca636021fa9a8a76fe1cc419ca55400ff2f32fbfa2d059aaacb96b2ab1cc
|
Provenance
The following attestation bundles were made for chaukas_spec_client-1.0.3.tar.gz:
Publisher:
release.yml on chaukasai/spec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chaukas_spec_client-1.0.3.tar.gz -
Subject digest:
0c2565181ae457b0ce5736c9461e0ddbf79e7920bcf22e05d80104ed69be27f5 - Sigstore transparency entry: 453523418
- Sigstore integration time:
-
Permalink:
chaukasai/spec@d20354122c824bae2bdb458b3b8b71fb0eb7e636 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/chaukasai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d20354122c824bae2bdb458b3b8b71fb0eb7e636 -
Trigger Event:
push
-
Statement type:
File details
Details for the file chaukas_spec_client-1.0.3-py3-none-any.whl.
File metadata
- Download URL: chaukas_spec_client-1.0.3-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1b1430fa799b0552dd278605dd9249d910e6884598bb7e8432216117d140ca4
|
|
| MD5 |
cb0d1583d548cbc74ae733cda1731b77
|
|
| BLAKE2b-256 |
6f7d93c8703314be1137b4f506b5dc49bc9295aa7a10f5bfd8a77942432e7018
|
Provenance
The following attestation bundles were made for chaukas_spec_client-1.0.3-py3-none-any.whl:
Publisher:
release.yml on chaukasai/spec
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chaukas_spec_client-1.0.3-py3-none-any.whl -
Subject digest:
e1b1430fa799b0552dd278605dd9249d910e6884598bb7e8432216117d140ca4 - Sigstore transparency entry: 453523420
- Sigstore integration time:
-
Permalink:
chaukasai/spec@d20354122c824bae2bdb458b3b8b71fb0eb7e636 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/chaukasai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d20354122c824bae2bdb458b3b8b71fb0eb7e636 -
Trigger Event:
push
-
Statement type: