Python SDK for AgentLogs — open-source observability for AI agents
Project description
AgentLogs SDK (Python)
Open-source observability for AI agents. Trace every LLM call, tool use, error, and cost.
pip install agentlogs-sdk
Quickstart
import asyncio
from agentlogs import AgentLogs, StepType
async def main():
# Reads AGENTLOGS_API_KEY from env, defaults to https://agentlogs.app
client = AgentLogs()
async with await client.create_trace(name="research-agent") as trace:
async with trace.step("search", step_type=StepType.TOOL) as s:
# ... your tool call
pass
await trace.add_step(
name="gpt-4o",
step_type=StepType.LLM,
metadata={"model": "gpt-4o", "provider": "openai"},
tokens=1234,
cost=0.012,
)
asyncio.run(main())
Configuration
from agentlogs import configure
configure(
api_key="al_...", # or set AGENTLOGS_API_KEY
api_url="https://agentlogs.app", # default
project="my-agent",
)
Env vars:
AGENTLOGS_API_KEY— get one from https://agentlogs.app/settingsAGENTLOGS_API_URL— override for self-hosted instancesAGENTLOGS_PROJECT— default project name
Decorator API
from agentlogs import trace_agent
@trace_agent()
async def my_agent(query: str):
return await llm.generate(query)
Self-hosting
Point the SDK at your own deployment:
configure(api_url="https://logs.your-company.com")
Links
- Website: https://agentlogs.app
- Docs: https://agentlogs.app/docs
- Source: https://github.com/infosiva/agenttrace
MIT licensed.
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
agentlogs_sdk-0.1.0.tar.gz
(6.1 kB
view details)
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 agentlogs_sdk-0.1.0.tar.gz.
File metadata
- Download URL: agentlogs_sdk-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f4bc37f559f1cdb6adc7aba6a63cec07e16a11d7305b850e77421b0bd7fc70
|
|
| MD5 |
594256dad6a380c3663a0ac2fc7ca4ce
|
|
| BLAKE2b-256 |
3bf23af53490d09e875042f5514623ad4254343f36ae5dd79bd3fcb311f16874
|
File details
Details for the file agentlogs_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentlogs_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b2c4bfd8cb6e6fa85adc1156c926b13f88707f8981a804b232b75fd2ef4ad10
|
|
| MD5 |
024fb46a528c615f22edf8276a8fff4e
|
|
| BLAKE2b-256 |
b4d3a0bc69361809332f942225ffcb2efa904d7cafef0bb4f3b380a1f72f3873
|