Skip to main content

A lightweight Python SDK for building AI agents with tools, memory, and multi-agent pipelines — powered by Groq

Project description

agentsdk

PyPI version Python License: MIT Docs

A lightweight Python SDK for building AI agents with tool use, multi-agent graphs, persistence, and tracing.

Install

pip install agentsdk          # core
pip install agentsdk[otel]    # + OpenTelemetry tracing
pip install agentsdk[dev]     # + pytest / dotenv

Quickstart

import asyncio, os
from agentsdk import Agent, AgentConfig, GroqProvider

agent = Agent(
    config=AgentConfig(
        name="MyAgent",
        system_prompt="You are a helpful assistant.",
    ),
    llm=GroqProvider(api_key=os.environ["GROQ_API_KEY"]),
)

async def main():
    result = await agent.run("What is the capital of France?")
    print(result.output)

asyncio.run(main())

Tools

from agentsdk import tool, ToolRegistry, Agent, AgentConfig, GroqProvider

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

registry = ToolRegistry()
registry.register(add)

agent = Agent(config=AgentConfig(name="Calc", system_prompt="Use tools."),
              llm=GroqProvider(...), registry=registry)

Multi-agent Graph

from agentsdk import AgentNode, Edge, AgentGraph, GraphRunner

graph = AgentGraph()
graph.add_node(AgentNode("researcher", researcher_agent))
graph.add_node(AgentNode("writer", writer_agent))
graph.add_edge(Edge("researcher", "writer", data_map={"output": "input"}))
graph.set_entry("researcher"); graph.set_exit("writer")
result = await GraphRunner(graph).run({"input": "Explain black holes"})

Persistence

from agentsdk import FileCheckpointStore, SessionManager, Agent

store = FileCheckpointStore(base_dir=".agentsdk/checkpoints")
session_mgr = SessionManager(store=store, agent_name="MyAgent")
agent = Agent(config=..., llm=..., session_manager=session_mgr)

# History is saved and reloaded automatically across runs:
await agent.run("My favourite language is Python.", session_id="user-001")
await agent.run("What language did I mention?",     session_id="user-001")

# Fork a session to branch an agent run:
forked = await session_mgr.fork("user-001", "user-001-branch")

Tracing (requires agentsdk[otel])

from agentsdk.observability import SDKTracer, TracedLLMProvider, TracedAgent, print_trace

tracer     = SDKTracer(service_name="myapp")
traced_llm = TracedLLMProvider(provider=GroqProvider(...), tracer=tracer)
agent      = TracedAgent(config=..., llm=traced_llm, tracer=tracer)

result, ctx = await agent.run("Summarise the last quarter earnings.")
print_trace(ctx)
# ╔══ Trace: MyAgent ══════════════════════
# ║  Session     : (none)
# ║  Trace ID    : 6744d6eca33853c5bba0...
# ║  Duration    : 3680ms
# ║  LLM calls   : 2
# ║  Tool calls  : 1
# ║  Tokens      : 1292 in / 36 out
# ╚═════════════════════════════════════════

CLI

# Scaffold a new agent project
scaffold-agent new myproject

# Interactive REPL against any agent file
scaffold-agent run myproject/agents/main.py

# Inspect a saved checkpoint
scaffold-agent trace .agentsdk/checkpoints/MyAgent/user-001.json

# List all sessions for an agent
scaffold-agent list-sessions MyAgent

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

agentsdk_py-0.2.0.tar.gz (52.3 kB view details)

Uploaded Source

Built Distribution

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

agentsdk_py-0.2.0-py3-none-any.whl (57.0 kB view details)

Uploaded Python 3

File details

Details for the file agentsdk_py-0.2.0.tar.gz.

File metadata

  • Download URL: agentsdk_py-0.2.0.tar.gz
  • Upload date:
  • Size: 52.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentsdk_py-0.2.0.tar.gz
Algorithm Hash digest
SHA256 49c4711e2eaee487b1bd7f66aa4a1203b1c2136b10f7bd2de18104b32cf5168e
MD5 e0d597696e5edd1f1455b61495cd2b22
BLAKE2b-256 de5ba57bb4e46ac5a6126f5b5eb882d890b78175965a56d6fbb8216459c51ffa

See more details on using hashes here.

File details

Details for the file agentsdk_py-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: agentsdk_py-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 57.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for agentsdk_py-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a9e4c4bf7b3bb1253cd1ef7a233998d8f0f64af3ab5a9cfe3aa1ba6a651757
MD5 babfc40ff4cdcad97eaaf80670642bf8
BLAKE2b-256 844611ebfd5d3fbb5309af1c290c4f2fed13855a88367adde2f877d8a7d06caa

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