Audit logging for AI agents — official Python SDK
Project description
Logwick Python SDK
The official Python SDK for Logwick — audit logging for AI agents.
Installation
pip install logwick
Quick start
import logwick
logwick.init(api_key="sk-lw-your-key")
# Fire and forget — never blocks your code
logwick.fire({
"agent": "gpt-4o",
"action": "email_draft",
"status": "success",
"input": user_prompt,
"output": result,
"tokens": 312,
"user": user_email,
})
OpenAI wrapper
Automatically logs input, output, tokens, and latency:
from logwick import LogwickClient
lw = LogwickClient(api_key="sk-lw-your-key")
result = lw.openai(
lambda: client.chat.completions.create(model="gpt-4o", messages=messages),
{"action": "email_draft", "user": user_email}
)
# result is the normal OpenAI response — nothing changes in your code
Anthropic / Claude wrapper
result = lw.anthropic(
lambda: anthropic.messages.create(
model="claude-3-5-sonnet-20241022",
messages=messages,
max_tokens=1024
),
{"action": "document_review", "user": user_email}
)
Google Gemini wrapper
result = lw.gemini(
lambda: model.generate_content(prompt),
{"action": "data_analysis", "user": user_email}
)
LangChain integration
One handler logs every LLM call in your chain automatically:
handler = lw.langchain_handler(user="ops@acme.com")
chain = LLMChain(llm=llm, prompt=prompt, callbacks=[handler])
# Every call in the chain is now logged automatically
Client options
from logwick import LogwickClient
lw = LogwickClient(
api_key="sk-lw-your-key", # required
silent=False, # print warnings (default: True = silent)
tags=["production"], # default tags added to every log
)
Using the global client
import logwick
logwick.init(api_key="sk-lw-your-key", tags=["production"])
# Use anywhere in your codebase without passing the client around
logwick.fire({"agent": "gpt-4o", "action": "summarize", "status": "success", ...})
Get your API key
Sign up free at logwick.io — 5,000 logs/month free, no credit card required.
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 logwick-1.0.0.tar.gz.
File metadata
- Download URL: logwick-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
790ea674c4befbad8efb06793200a602e0ff1cd2f31d7e86a249abf9a47ada1d
|
|
| MD5 |
e3bcfe90490a45bc37cb13f3e603c03b
|
|
| BLAKE2b-256 |
27bbb14e4f7e195f10f4885dd9ec5cdd9c1d7aa4e235e61225a546377ed805fa
|
File details
Details for the file logwick-1.0.0-py3-none-any.whl.
File metadata
- Download URL: logwick-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40dca48f162351b9546bb7cabc9ed458e0969eb0a50a134ce3127f3899ff020a
|
|
| MD5 |
70e28523e29770d437d3ec20f5b45dfa
|
|
| BLAKE2b-256 |
145494f62e972b706ed1a9696e5ecd613e37ba104a7f6311db897cec48c4178c
|