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

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.1.0.tar.gz (37.0 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.1.0-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentsdk_py-0.1.0.tar.gz
  • Upload date:
  • Size: 37.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 4cdb1a3436e53936daa3971bb5a9173866d1ff1928f643e3449cba2aac07fb96
MD5 05286e0fae53815a5ef5538f5baba067
BLAKE2b-256 af492bd70bcce560b8f2b784a5dc7b47006cfba45997b219fbb4eb0a6af5e33f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentsdk_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.2 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93c65f933274d46ce982c228ab4c3191831bbc2318c05b72b3bf096a23bd01e0
MD5 46f0a8313b3633f56ae586ded882f8a3
BLAKE2b-256 f42b29ce7fa18b76b9abcec8c46cdd176cc1943069db6c505f6e989a3fa3108a

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