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 |
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, andopenrouter - Remote AgentBlit tools (
/api/tools/list,/api/tools/call) - Local tools via
@tool,custom_tools, andagent.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 - 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
examples/basic_agent.py- interactive terminal chat with remote tools.examples/custom_tools.py- local@toolfunctions + AgentBlit tools.
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
agentblit-0.1.1.tar.gz
(14.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
agentblit-0.1.1-py3-none-any.whl
(14.1 kB
view details)
File details
Details for the file agentblit-0.1.1.tar.gz.
File metadata
- Download URL: agentblit-0.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173b7b218445491f21cdd999788d67919be9ba02fa03a3b90e231fb3406a95fb
|
|
| MD5 |
4d459da163ad17607cb2cf3a6e808e0e
|
|
| BLAKE2b-256 |
f52b42b106958e4b3397247e855f440b778dfdcfdf22d00f188107ef35a3d0f6
|
File details
Details for the file agentblit-0.1.1-py3-none-any.whl.
File metadata
- Download URL: agentblit-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22d7f433b3d82a95a91ff4c52930fd85ce6a1c4e67779a1ac3c23f2518be9ae2
|
|
| MD5 |
f02c9e650198be54994002c470a57385
|
|
| BLAKE2b-256 |
975ede8eb671bf18c49943507f18ab73d955c26fcef2ba01a4f42b59f892f977
|