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.1.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.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

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

Hashes for agentlogs_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f9b6f9a44e54b0d5dcd4f386425be616f8ac670b874e2366b475d61d865f2e7f
MD5 9a3d45713ec0f55a8c307a5cf92eb71c
BLAKE2b-256 eafe752406c838c2e0fe36e06310c4864dd40f175b0fb0de2e280d1be2e54cec

See more details on using hashes here.

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

Hashes for agentlogs_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1298c956a14140419f6cfd8f7b728a84fa5e90679f3124c6c2c1b4dd5bb92f07
MD5 8612d3a239564aa6c4714b4149b68927
BLAKE2b-256 30aefc486496874a3e8be46748b8e25d189d86a2cf1f2d80e436edb61778feb6

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