gabby 52346baf52 gutendex: send a User-Agent (Cloudflare 403s the default urllib agent)
Gutendex.com sits behind Cloudflare, which rejects urllib's default
`Python-urllib/<ver>` User-Agent with HTTP 403. Both skills therefore failed
on their first real call ("could not reach the Gutendex catalog ... HTTP Error
403"); the hermetic loopback tests cannot catch this by design.

Send an identifying `USER_AGENT` on every request (the /books catalog lookup
and the plain-text download) and assert it in each skill's test so the
regression is caught locally.

Verified with a real run: find_books returned 41 live results for
"jane austen"; read_book downloaded and saved Pride and Prejudice (1342).
2026-10-17 08:18:13 +00:00

gutendex — a semif-agent skill pack

A self-contained semif-agent pack for the Gutendex catalog of Project Gutenberg ebooks. It lets the agent:

  • gutendex.find_books — find public-domain books by author, title, or genre (author/title use Gutendex search; genre uses topic).
  • gutendex.read_book — resolve a book by name or Project Gutenberg id and download its full plain text, saving it to a .txt file.

Gutendex is a free public JSON API. This pack needs no account, no credentials, and no bridge — the skill bodies make the HTTP requests directly with the standard library.

Layout

gutendex/
  pack.json                                  # the pack manifest
  skills/gutendex/find_books/
    skill.py  manifest.json  contract.json  skill.test.py
  skills/gutendex/read_book/
    skill.py  manifest.json  contract.json  skill.test.py

Install

Packs are loaded from the skill_packs root(s) in the agent's config. Either:

  • drop this gutendex/ folder into the agent's packs/ directory, or

  • keep it as its own checkout and point the config at the parent directory:

    { "skill_packs": ["packs", "/path/to/agent-packs"] }
    

    (a root directory is scanned for */pack.json, so a folder of pack checkouts works directly).

The pack is enabled by default (enabled_by_default: true); toggle it with pack.gutendex.enabled in the config.

Configuration

Both skills declare contract variables the runner resolves from the tiered config (global → category → skill) or asks for once on first fire. To avoid the one-time prompt, set them in the config:

Variable Used by Example
gutendex_base_url both skills https://gutendex.com
output_dir gutendex.read_book /home/me/books

read_book writes the downloaded text to <output_dir>/gutenberg-<id>-<slug>.txt and returns the path. A book's full text is far longer than the agent's speakable result budget, so it is saved to a file and summarised rather than dumped into the reply.

Tests

Each leaf ships a hermetic mechanics test (stdlib http.server on loopback, no external network):

cd skills/gutendex/find_books && python skill.test.py
cd skills/gutendex/read_book  && python skill.test.py

PYTHONPATH must include the agent checkout so semif_agent is importable. Passing these proves the mechanics only; a real run against Gutendex is the only proof of the live integration.

S
Description
semif-agent skill pack: find Project Gutenberg books by author, title, or genre and read their full text (Gutendex).
Readme
65 KiB
0 Stars 1 Watchers 0 Forks
Languages
Python 100%