Skip to main content

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/settings
  • AGENTLOGS_API_URL — override for self-hosted instances
  • AGENTLOGS_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

MIT licensed.

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

agentlogs_sdk-0.1.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentlogs_sdk-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

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

Hashes for agentlogs_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c4f4bc37f559f1cdb6adc7aba6a63cec07e16a11d7305b850e77421b0bd7fc70
MD5 594256dad6a380c3663a0ac2fc7ca4ce
BLAKE2b-256 3bf23af53490d09e875042f5514623ad4254343f36ae5dd79bd3fcb311f16874

See more details on using hashes here.

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

Hashes for agentlogs_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b2c4bfd8cb6e6fa85adc1156c926b13f88707f8981a804b232b75fd2ef4ad10
MD5 024fb46a528c615f22edf8276a8fff4e
BLAKE2b-256 b4d3a0bc69361809332f942225ffcb2efa904d7cafef0bb4f3b380a1f72f3873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page