Skip to main content

agentbase-sdk

Deploy. Observe. Heal. The Python SDK for AgentBase - the operating system for AI agents.

Install

pip install agentbase-sdk

Quick Start (2 lines to instrument)

import agentbase_sdk as ab

ab.init(api_key="ab_live_...", agent_name="my-agent")
ab.instrument_openai()  # auto-trace every LLM call

# That's it. Every OpenAI call is now traced with:
# - Token counts & costs
# - Latency
# - Error detection
# - Auto-heal on failures

Manual Tracing

import agentbase_sdk as ab

ab.init(api_key="ab_live_...", agent_name="support-bot")

with ab.trace("handle-ticket") as t:
    t.set_input(user_question)

    with ab.span("classify", span_type="llm") as s:
        s.set_model("gpt-4o")
        intent = classify(user_question)
        s.set_output(intent)
        s.set_tokens(prompt_tokens=200, completion_tokens=20)

    with ab.span("search-kb", span_type="tool") as s:
        s.set_tool("knowledge_base")
        results = search(intent)
        s.set_output(str(results))

    with ab.span("respond", span_type="llm") as s:
        s.set_model("gpt-4o")
        answer = generate(intent, results)
        s.set_output(answer)
        s.set_tokens(prompt_tokens=800, completion_tokens=200)

    t.set_output(answer)

Decorators

from agentbase_sdk import observe, heal

@observe(as_trace=True)
def handle_support_ticket(question: str) -> str:
    return my_agent.run(question)

@heal(retry=3, fallback=lambda: "Sorry, please try again.")
def risky_api_call(query: str) -> str:
    return external_api.search(query)

Auto-Instrumentation

ab.instrument_openai()      # OpenAI SDK
ab.instrument_anthropic()   # Anthropic SDK
ab.instrument_langchain()   # LangChain
ab.instrument_crewai()      # CrewAI

Auto-Heal

When your agent encounters errors, AgentBase automatically:

Error Fix
Hallucination (404, missing endpoint) Corrects endpoint, retries
Context overflow Chunks input with sliding window
Infinite loop Circuit breaker
Tool timeout Retry with exponential backoff
Wrong tool selected Re-routes with task context
JSON parse error Retries with format hint

Dashboard

View all traces, costs, and heal events at your AgentBase dashboard.

Links

Release files for agentbase-autoheal 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentbase-autoheal 0.1.0
File Size Uploaded
agentbase_autoheal-0.1.0.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentbase-autoheal 0.1.0
File Interpreter ABI Platform
agentbase_autoheal-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.5 kB

Release files / agentbase_autoheal-0.1.0.tar.gz

Download URL agentbase_autoheal-0.1.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1a3178ab422b4a6973a5ec07b1d24a50bcdeed1006bd5488da0f6cf9c598378c
BLAKE2b-256 checksum
How to use checksums
427396bf539437c41091a57636ee0aa5ec2575aba352005450cafbf66a6c021d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / agentbase_autoheal-0.1.0-py3-none-any.whl

Download URL agentbase_autoheal-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8a741aa07c7f6f8306f9f07b18e6a4d5916d17760a5d36bc39d0aa2756f3026
BLAKE2b-256 checksum
How to use checksums
315ab47c2e6c240da6c1742cef98ad53afd1f5af9bd07c8d1c6d519d7ae3c8de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page