Skip to main content

🤖 nanoagents


A nano, minimalistic, and lightweight library for building ReACT-based AI agents that use tools to solve tasks.

📦 Installation

pip install nanoagents

🕹️ Usage

from nanoagents import Agent
from groq import Groq

# You can define a function to make any llm call, it should take a string as input.
def call_llm(prompt: str) -> str:
    api_key = "$YOUR_API_KEY"
    client = Groq(api_key=api_key)

    messages = [{"role": "user", "content": prompt}]
    response = client.chat.completions.create(
        model="llama-3.3-70b-versatile",
        messages=messages
    )
    return response.choices[0].message.content


agent = Agent(llm=call_llm)

@agent.tool("add") # Create a tool named "add"
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

result = agent.run("Calculate 2 + 3")
print(result)

⚠️ This is still a work in progress, feel free to contribute!

Metadata

Release files for nanoagents 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nanoagents 0.1.0
File Size Uploaded Provenance
nanoagents-0.1.0.tar.gz 7.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nanoagents 0.1.0
File Interpreter ABI Platform
nanoagents-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.4 kB

Release files / nanoagents-0.1.0.tar.gz

Download URL nanoagents-0.1.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a25c9f7931ba0372c1b74f0e9eeb8f192ed86efcb25db3f8d5b90cc711c5de4
BLAKE2b-256 checksum
How to use checksums
a367c29609b238ba8777a85ff56410f25138f2c457701ca810be10b81401f88d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.8.0-52-generic

Release files / nanoagents-0.1.0-py3-none-any.whl

Download URL nanoagents-0.1.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93a480e584a214081b3143ffd3bf504408743cee93d92edaa7935ba1faf6fded
BLAKE2b-256 checksum
How to use checksums
730591b8ecbbe3c718e26e5c6ac3e88dae8cbcb4579119ef1937ec078259d35e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.8.0-52-generic

Security for nanoagents 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page