Skip to main content

Python SDK for building single-agent and multi-agent AI systems

Project description

Nanitics

Python SDK for building single-agent and multi-agent AI systems.

CI PyPI Python License

Why Nanitics?

Nanitics differs from other agent frameworks in three ways:

  • Composable primitives, not a framework. Pick the pieces you need — agent strategies, coordination patterns, memory, evaluation, HITL, tools — and compose them. No runtime or opinionated workflow shape is imposed.
  • Trace-first observability. Every agent loop, tool call, and coordination event emits a structured event. The built-in Observatory trace viewer turns that into a live debugging surface from day one.
  • Real-services validation. Every public component is validated against real LLM providers before release, not just mocks. Mocks drive fast tests; real services prove correctness.

Features

Agent Strategies — Built-in strategies for different problem types: ReAct, Reasoning, Reflexion, ReWOO, CodeAct, LATS, and Tree of Thought.

MemoryWorking, episodic, long-term, and semantic memory for persistent agent state.

Orchestration — Compose agents into pipelines, DAGs, loops, conditionals, and map-reduce workflows.

Multi-Agent CoordinationHandoff, supervisor, blackboard, debate, consensus, bidding, broadcast, message bus, peer network, orchestrator, and agent-as-tool patterns.

EvaluationProgrammatic and LLM-based evaluators for assessing agent output quality.

Human-in-the-LoopApproval gates, revision gates, and durable HITL with checkpoint suspension for long-running workflows.

ToolsFunction tools, conditional tools, and tool composition with automatic schema generation.

ObservabilityEvent-based tracing with the Observatory trace viewer for inspecting agent execution.

PlanningUpfront and adaptive planning with goal tracking and plan adherence evaluation.

SafetyIteration limits, cancellation tokens, and sandboxed code execution.

Quick Start

For a full end-to-end run against a real LLM, see the deployment guide.

Install Nanitics:

pip install nanitics

Create a ReAct agent with a tool, driven by a scripted MockLLMClient so the snippet runs without an API key:

import asyncio
from nanitics import (
    InMemoryEmitter,
    LLMResponse,
    MockLLMClient,
    ReActAgent,
    ToolCall,
    Usage,
    tool,
)

@tool("greet", "Greet someone by name")
async def greet(name: str) -> str:
    return f"Hello, {name}!"

async def main():
    llm = MockLLMClient(responses=[
        LLMResponse(
            content="I'll greet them.",
            tool_calls=[ToolCall(id="1", name="greet", arguments={"name": "world"})],
            usage=Usage(input_tokens=50, output_tokens=20),
            model="mock",
            stop_reason="tool_use",
        ),
        LLMResponse(
            content="Hello, world!",
            tool_calls=[],
            usage=Usage(input_tokens=80, output_tokens=15),
            model="mock",
            stop_reason="end_turn",
        ),
    ])
    agent = ReActAgent(
        name="my-agent",
        llm_client=llm,
        emitter=InMemoryEmitter("trace-001"),
        system_prompt="You are a helpful assistant.",
        tools=[greet],
    )
    result = await agent.run("Say hello to the world")
    print(result.output)

asyncio.run(main())

To run the same agent against a real provider, set ANTHROPIC_API_KEY and swap MockLLMClient(...) for AnthropicLLMClient(model="claude-haiku-4-5"). Everything else above is unchanged.

See the Getting Started guide for a full walkthrough. For the full API, read the docstrings in the source tree under nanitics/.

LLM Providers

Nanitics supports multiple LLM providers:

Provider Install Client
Anthropic pip install nanitics AnthropicLLMClient
OpenAI pip install nanitics OpenAILLMClient
Mistral pip install nanitics[mistral] MistralLLMClient
LiteLLM pip install nanitics[litellm] LiteLLMClient

For testing and development, use MockLLMClient — no API keys required.

Examples

The examples directory contains runnable examples covering every SDK component. All examples use MockLLMClient for deterministic, API-key-free execution.

See the examples README for a complete index.

Documentation

Primary entry points:

Guide Description
Getting Started Build your first agent
Core Concepts The agent loop, tools, prompts, LLM clients
Agent Types Agent strategies and when to use each
Multi-Agent Coordination Coordination patterns for multi-agent systems
Deployment Full-stack compose, take-to-own-infra, resource and shutdown patterns
API Reference Generated from source docstrings — signatures, fields, constraints

For the complete catalogue — Memory, Orchestration, Evaluation, HITL, Tools, Planning, Context Management, Error Handling, Safety, Security, Observability, Building Applications, Architecture, SDK Internals, Diagnosing Agent Issues, Testing, Streaming, Production, Built-in Tools, Local LLMs — see the full guides index.

Project

License

Apache License 2.0. See LICENSE for the full text.

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

nanitics-0.2.0.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

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

nanitics-0.2.0-py3-none-any.whl (361.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanitics-0.2.0.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanitics-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a8c85e67bafb03e0f75d1ae4d785fa13351208e60d9b9730f5a0ad7776470ab2
MD5 313a66b4f41a4e2ae2085bd017a0b57d
BLAKE2b-256 1000d1ea8d04728191455cfade7062fe93c34de697448fda1afc80f4dffc238c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanitics-0.2.0.tar.gz:

Publisher: release.yml on nanitics/nanitics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: nanitics-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 361.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nanitics-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9d12fa0aa8ad32e1b2bcd08d91c38a714c8ae816d71aa55bf5e5d54caeaf4d1
MD5 f77ff8542ad4eb00d3fe0ab1bf83d253
BLAKE2b-256 01d66690f3daf51b79afb3e6489be1b598809f6d4b005efedff8208474b6cac9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nanitics-0.2.0-py3-none-any.whl:

Publisher: release.yml on nanitics/nanitics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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