Skip to main content

aa_agent_tools - a friendly, Pyodide-ready toolbox of cool functions for kid-built agents (web search, fetch pages, email, AI, weather, and tons of fun stuff).

Project description

๐Ÿ› ๏ธ aa_agent_tools

A friendly toolbox of cool functions for kid-built agents.

aa_agent_tools gives your Python agents super-powers: search the web, read pages, send emails, check the weather, grab space pictures from NASA, roll dice, fetch cat facts, and a whole lot more โ€” 38 functions, all listed below with copy-paste examples.

๐Ÿ”‘ You bring the API keys. We never store them. Just pass them as arguments when you call a function. Look for the ๐Ÿ”‘ badge below (those need a key) and the ๐Ÿ†“ badge (those are totally free, no key at all!).


๐ŸŽ‰ Quick start

import aa_agent_tools as aa

# No key needed โ€” just fun!
print(aa.get_joke())
print(aa.get_cat_fact())
print(aa.get_pokemon("pikachu")["types"])
print(aa.flip_coin())
print(aa.number_fact(7))

# With a key you supply
results = aa.search_web("cute penguins", api_key="YOUR_BRAVE_KEY")
print(results)

Want the pretty, searchable version? Open the ๐Ÿ“– HTML Reference Page in your browser.


๐Ÿ“– The full function reference

Every function is listed below, grouped by what it does. Each one shows a short, friendly description and a copy-paste example you can try right away.

  • ๐Ÿ”‘ = needs an API key (you pass it as an argument)
  • ๐Ÿ†“ = totally free, no key needed

๐ŸŒ Web & Search

search_web(query, api_key) ๐Ÿ”‘

Search the internet with Brave and get back a tidy list of results (title, link, snippet).

results = aa.search_web("best robots for kids", api_key="YOUR_BRAVE_KEY")
print(results)

search_images(query, api_key, count=5) ๐Ÿ”‘

Search for pictures on the web using Brave Search.

pics = aa.search_images("puppies", api_key="YOUR_BRAVE_KEY")
print(pics[0]["url"])

fetch_page(url) ๐Ÿ†“

Download any web page and turn it into clean text (Markdown). Great for reading articles.

text = aa.fetch_page("https://en.wikipedia.org/wiki/Penguin")
print(text[:300])

โœ‰๏ธ Email

send_email(to, subject, body, *, smtp_host, username, password) ๐Ÿ”‘

Send a plain-text email through almost any email provider's SMTP server.

aa.send_email(
    to="friend@example.com",
    subject="Hello from my agent!",
    body="My robot wrote this.",
    smtp_host="smtp.gmail.com",
    username="you@gmail.com",
    password="app-password",
)

send_email_gmail(to, subject, body, *, gmail, app_password) ๐Ÿ”‘

Send an email using a Gmail account (use a 16-character app password).

aa.send_email_gmail(
    to="friend@example.com",
    subject="hi!",
    body="sent from aa_agent_tools",
    gmail="you@gmail.com",
    app_password="abcd efgh ijkl mnop",
)

๐Ÿค– Any API

call_api(url, api_key=None, *, method="GET", ...) ๐Ÿ†“

Call almost any REST API in one line. You give it a URL and (if the API needs one) a key. No key needed for public APIs.

city = input("Enter your city: ")
data = aa.call_api(
	"https://api.weatherapi.com/v1/current.json?key=key&q={city}&aqi=no"	
)

current = data["current"]
	
print(current["temp_c"])

๐ŸŒค๏ธ Weather

get_weather(city, api_key) ๐Ÿ”‘

Get the current weather for any city in the world (OpenWeatherMap).

w = aa.get_weather("London", api_key="YOUR_OWM_KEY")
print(f"{w['temp']}ยฐC and {w['description']}")

get_forecast(city, api_key, days=3) ๐Ÿ”‘

Get a short multi-day forecast for a city (OpenWeatherMap).

fc = aa.get_forecast("Tokyo", api_key="YOUR_OWM_KEY", days=3)
print(fc)

๐Ÿš€ Space

space_image(date=None, api_key="DEMO_KEY") ๐Ÿ†“

Get NASA's Astronomy Picture of the Day ("DEMO_KEY" works for light use).

pic = aa.space_image()
print(pic["title"], pic["url"])

near_earth_objects(api_key="DEMO_KEY", *, start_date=None, end_date=None) ๐Ÿ†“

List asteroids flying near Earth in a date range (NASA NeoWs).

aa.near_earth_objects(api_key="DEMO_KEY", start_date="2024-01-01", end_date="2024-01-07")

mars_photo(*, sol=1000, api_key="DEMO_KEY") ๐Ÿ†“

Fetch a real photo taken by a rover on Mars (NASA).

print(aa.mars_photo(sol=1000, api_key="DEMO_KEY"))

๐ŸŽ‰ Fun & Games

get_joke() ๐Ÿ†“

Get a random, clean joke with a setup and punchline.

j = aa.get_joke()
print(j["setup"]); print(j["punchline"])

get_advice() ๐Ÿ†“

Get a random piece of (silly but wise) advice.

print(aa.get_advice())

get_cat_fact() ๐Ÿ†“

Get a random fact about cats.

print(aa.get_cat_fact())

get_cat_image() ๐Ÿ†“

Get a link to a random photo of a cat.

print(aa.get_cat_image())

get_dog_image() ๐Ÿ†“

Get a random photo of a good dog.

print(aa.get_dog_image())

get_quote() ๐Ÿ†“

Get an inspirational quote and who said it.

q = aa.get_quote()
print(f'"{q["text"]}" - {q["author"]}')

roll_dice(sides=6) ๐Ÿ†“

Roll a die with any number of sides (default 6).

print(aa.roll_dice(20))

flip_coin() ๐Ÿ†“

Flip a coin: returns "heads" or "tails".

print(aa.flip_coin())

random_number(min_value=1, max_value=100) ๐Ÿ†“

Pick a random whole number between two values.

print(aa.random_number(1, 100))

pick_one(*items) ๐Ÿ†“

Randomly pick one item from the ones you list.

print(aa.pick_one("red", "green", "blue"))

get_pokemon(name="pikachu") ๐Ÿ†“

Look up a Pokรฉmon by name: its type, height, and a picture.

p = aa.get_pokemon("charizard")
print(p["name"], p["types"])

๐Ÿ“š Knowledge

wikipedia_summary(title) ๐Ÿ†“

Get a short, friendly summary of almost any Wikipedia topic.

info = aa.wikipedia_summary("Aurora")
print(info["summary"])

define_word(word) ๐Ÿ†“

Get the dictionary definition and an example sentence for a word.

d = aa.define_word("serendipity")
print(d["definitions"][0])

number_fact(number) ๐Ÿ†“

Get a fun, fact-packed description of any number (works offline!).

print(aa.number_fact(7))

country_info(name) ๐Ÿ†“

Get a friendly snapshot of a country using Wikipedia.

c = aa.country_info("Japan")
print(c["summary"][:80])

convert_money(amount, from_currency, to_currency) ๐Ÿ†“

Convert money between currencies using live rates (no key needed).

print(aa.convert_money(10, "USD", "EUR"))

shorten_url(url) ๐Ÿ†“

Make a long URL short using the free is.gd service.

print(aa.shorten_url("https://example.com/very/long/path"))

๐Ÿ–ผ๏ธ Images

get_photo(query, api_key) ๐Ÿ”‘

Search free stock photos on Pexels and get image links.

for url in aa.get_photo("mountains", api_key="YOUR_PEXELS_KEY"):
    print(url)

random_image(*, width=400, height=300, seed=None) ๐Ÿ†“

Get a random photo of any size (no key needed).

print(aa.random_image(width=600, height=400, seed="sunset"))

๐Ÿงฐ Text Tools

hash_text(text, *, algorithm="sha256") ๐Ÿ†“

Turn text into a fixed "fingerprint" hash (sha256 by default).

print(aa.hash_text("hello"))

base64_encode(text) ๐Ÿ†“

Encode text into Base64 (a common way to pack data).

print(aa.base64_encode("hi"))

base64_decode(text) ๐Ÿ†“

Decode Base64 text back to normal text.

print(aa.base64_decode("aGk="))

make_qr(text, *, size=200) ๐Ÿ†“

Make a QR code image for text or a link (returns a URL).

print(aa.make_qr("https://example.com"))

convert_units(value, from_unit, to_unit) ๐Ÿ†“

Convert between length or weight units.

print(aa.convert_units(1, "mi", "km"))  # ~1.609
print(aa.convert_units(1, "kg", "lb"))  # ~2.205

count_words(text) ๐Ÿ†“

Count how many words are in some text.

print(aa.count_words("one two three"))

reverse_text(text) ๐Ÿ†“

Reverse a string backwards.

print(aa.reverse_text("abc"))  # cba

is_palindrome(text) ๐Ÿ†“

Is the text the same forwards and backwards?

print(aa.is_palindrome("Racecar"))  # True

๐Ÿ”‘ Where to get API keys

Most "cool" functions need a free key from the service. You only need the ones you want to use:

Functions that need no key at all: get_joke, get_advice, get_cat_fact, get_cat_image, get_dog_image, get_quote, roll_dice, flip_coin, random_number, pick_one, get_pokemon, wikipedia_summary, define_word, number_fact, country_info, convert_money, shorten_url, random_image, fetch_page, call_api (key optional), and all the Text Tools.


๐Ÿ› ๏ธ Development

uv build                 # build wheel + sdist
PYTHONPATH=src python make_reference.py   # regenerate docs/reference.html

The build produces a pure-Python wheel tagged py3-none-any, which is exactly what micropip needs inside Pyodide.


Made with ๐Ÿ’› for young coders and the agents they build.

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

aa_agent_tools-0.1.2.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

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

aa_agent_tools-0.1.2-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file aa_agent_tools-0.1.2.tar.gz.

File metadata

  • Download URL: aa_agent_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aa_agent_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6bfaed6a024cbc7ebcf67ad1b4d747cb9807a49819f7ea116c0a4e385bfcadef
MD5 16e79488218dad2bfb64f6b72e1b1acb
BLAKE2b-256 54c4bb3989b9e2abbe36622c942bcfe3c4573600f5ba56c146e710819a8723d6

See more details on using hashes here.

File details

Details for the file aa_agent_tools-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aa_agent_tools-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aa_agent_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a521d0a4f2e723a5a3de12e7b83e50e22f924e597202a9c4dbf8e654d365a4b
MD5 9a36285f8375945aad6d65243645f5b1
BLAKE2b-256 5e8071f9d6eb2e8d9e786bf047e5d205dbd5d8553c2444868ef725b5f3b91e07

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