Skip to main content

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

Project description

🤖 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!

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

nanoagents-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

nanoagents-0.1.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanoagents-0.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.8.0-52-generic

File hashes

Hashes for nanoagents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a25c9f7931ba0372c1b74f0e9eeb8f192ed86efcb25db3f8d5b90cc711c5de4
MD5 e06aeabd9a6ea817d63e304ca21f98d9
BLAKE2b-256 a367c29609b238ba8777a85ff56410f25138f2c457701ca810be10b81401f88d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanoagents-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.8.0-52-generic

File hashes

Hashes for nanoagents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93a480e584a214081b3143ffd3bf504408743cee93d92edaa7935ba1faf6fded
MD5 4825f3693d61a876d599296ffb0cc3b8
BLAKE2b-256 730591b8ecbbe3c718e26e5c6ac3e88dae8cbcb4579119ef1937ec078259d35e

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