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.1.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.1.tar.gz.
File metadata
- Download URL: agentlogs_sdk-0.1.1.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 |
f9b6f9a44e54b0d5dcd4f386425be616f8ac670b874e2366b475d61d865f2e7f
|
|
| MD5 |
9a3d45713ec0f55a8c307a5cf92eb71c
|
|
| BLAKE2b-256 |
eafe752406c838c2e0fe36e06310c4864dd40f175b0fb0de2e280d1be2e54cec
|
File details
Details for the file agentlogs_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentlogs_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.1 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 |
1298c956a14140419f6cfd8f7b728a84fa5e90679f3124c6c2c1b4dd5bb92f07
|
|
| MD5 |
8612d3a239564aa6c4714b4149b68927
|
|
| BLAKE2b-256 |
30aefc486496874a3e8be46748b8e25d189d86a2cf1f2d80e436edb61778feb6
|