Skip to main content

Agentic SDK for LLM agents with AgentBlit tools

Project description

AgentBlit Python SDK

Build LLM agents with:

  • AgentBlit remote tools
  • optional local Python tools
  • streaming output
  • approval-gated actions
  • short-term memory with automatic summarization

Install

cd agentblit-python
python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -e .

Quick Start

import asyncio
from agentblit import Agent, tool

@tool(description="Add two integers.")
def add(a: int, b: int) -> int:
    return a + b

async def main() -> None:
    agent = Agent(
        model="openai/gpt-4o-mini",
        api_key="YOUR_LLM_KEY",
        agentblit_api_key="YOUR_AGENTBLIT_KEY",
        system_prompt="You are a helpful assistant.",
        custom_tools=[add],
    )

    async for chunk in agent.run("What is 200 + 30? Use tools if needed."):
        print(chunk, end="")
    print()

asyncio.run(main())

1) Agent Initialization Configs

Agent(...) accepts:

Key Type Required Default Values / Format Use Case
model str Yes - vendor/model (for example: openai/gpt-4o-mini, anthropic/claude-sonnet-4-0, gemini/gemini-2.0-flash, openrouter/openai/gpt-4o-mini) Select provider + model
api_key str Yes - LLM provider API key Send model requests
agentblit_api_key str Yes - AgentBlit API key (X-API-Key) Remote tools + analytics events
agentblit_url str No https://console.agentblit.com Valid base URL Self-hosted or staging AgentBlit
agent_id str No Auto-generated UUID Any non-empty string Reuse a stable agent identity across sessions/events
system_prompt str No "" Any instruction text Set assistant behavior
max_history int No 5 Integer >= 1 Keep recent messages before summarization
max_tool_rounds int No 25 Integer >= 1 Limit LLM-tool loop iterations
debug bool No False True or False Enable verbose SDK logs
timeout float (seconds) No 30.0 Positive number Control HTTP timeout for LLM + AgentBlit
approval_callback async (tool_name, args_dict) -> bool No - Async function Approve/reject needs_approval tools
custom_tools list No [] Local @tool callables Register app-specific local tools

2) All SDK Features

  • Vendor routing for openai, anthropic, gemini, and openrouter
  • Remote AgentBlit tools (/api/tools/list, /api/tools/call)
  • Local tools via @tool, custom_tools, and agent.register_tool(...)
  • Approval-gated tools (needs_approval) with callback support
  • Streaming responses with async for chunk in agent.run(...)
  • Multi-round tool calling in one run()
  • Memory summarization using max_history
  • Default system guidance to use tools and available long-term memory tools (retrieveRelevantMemory, updateMemory) when needed
  • Automatic analytics batching (agent_init, user_prompt, llm_call, tool_call, tools_updated, agent_loop_error)
  • Custom analytics via agent.track(event_type, properties)

3) Examples

Example 1: Basic Streaming Agent

agent = Agent(
    model="openai/gpt-4o-mini",
    api_key="YOUR_LLM_KEY",
    agentblit_api_key="YOUR_AGENTBLIT_KEY",
    system_prompt="Be concise and accurate.",
)

Example 2: Approval-Gated Tool

async def approval_callback(tool_name: str, args_dict: dict) -> bool:
    print("Approve tool call?", tool_name, args_dict)
    return tool_name != "delete_production_data"

agent = Agent(
    model="openai/gpt-4o-mini",
    api_key="YOUR_LLM_KEY",
    agentblit_api_key="YOUR_AGENTBLIT_KEY",
    approval_callback=approval_callback,
)

Repo Examples

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

agentblit-0.1.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

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

agentblit-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file agentblit-0.1.2.tar.gz.

File metadata

  • Download URL: agentblit-0.1.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentblit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4e0aa20689c79ae909b3301f97f40f88da0eb729703d67539545d8e1f8b22919
MD5 57801676a40a5e3a56166e2aa43f7a16
BLAKE2b-256 3050715cc8e17453d203b6bcbd99342e1ca0a16d6e376bdc42ce9d606e87777a

See more details on using hashes here.

File details

Details for the file agentblit-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: agentblit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentblit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1e88eebe6ce5c9dcdb8aa1b1fa62801ecb034b00cff007b489b6037c5746952
MD5 0c2ce7a75fe5d3e84df988c24c8be81f
BLAKE2b-256 04b3bc5c84d0b1135c0c09e95a7f3a1aede8a7dd6bdf776d2a129f8b0ca35c3a

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