Multi-provider LLM and message queue abstraction for distributed agent systems
Project description
teenyfactories
Agent runtime for TeenyFactories. Postgres-backed pub/sub, multi-provider LLM calls, vector search.
pip install --pre teenyfactories
import teenyfactories as tf
@tf.on_state('documents', 'loaded').do
def analyse(item):
tf.collection('documents').set(item['key'], state='analysed')
while True:
tf.run_pending()
tf.sleep(1)
Writing a row with a given state fires NOTIFY {factory}.{collection}.{state}. Every subscriber to that pair gets the row. That's the framework.
Public API
| Group | Names |
|---|---|
| Pub/sub | on_state, on_message, send_message, run_pending |
| Data | collection (.set, .add, .get, .get_all, .remove, .count, .exists, .vector_search) |
| LLM | call_llm, embed |
| MCP | add_mcp_server, add_mcp_tool |
| Schedule | on_schedule.every(N).<unit>.do(handler) |
| Logging | log_debug, log_info, log_warn, log_error, log_persona |
| Time / IDs | get_timestamp, get_timestamp_utc, generate_unique_id |
| Util | sleep, PROJECT_NAME, FACTORY_PREFIX, __version__ |
Anything not in this list is not part of the supported surface — don't reach into submodules.
How it plugs in
A factory is a directory:
my_factory/
├── factory.yml
└── agents/
├── poller.py
└── enricher.py
Each agents/*.py runs in its own container based on ghcr.io/teenyfactories/agent:dev — which has this library pre-installed. Single-factory mode runs each file as a docker compose service; multi-factory mode runs them under the orchestrator. Either way, agent code is just import teenyfactories as tf + handlers + main loop.
Full setup, compose templates, environment variable reference: see the core repo.
Versioning
PEP 440 dev pre-releases: 0.1.0.devYYYYMMDD. pip install teenyfactories will NOT pick these up — you need --pre (latest dated build) or an explicit pin (teenyfactories==0.1.0.dev20260512).
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file teenyfactories-0.1.0.dev20260621.tar.gz.
File metadata
- Download URL: teenyfactories-0.1.0.dev20260621.tar.gz
- Upload date:
- Size: 77.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eb45cc7a4b331b95177075f2f56c4c9130a2ad348f976f4844fdd472c5aa13f
|
|
| MD5 |
499757e3edc419bc221ac0baac1cab7b
|
|
| BLAKE2b-256 |
5e8ab76aa559229747e866a2e2678f1b6f245bfe77fb9b86359a3ccecf54fcd6
|
File details
Details for the file teenyfactories-0.1.0.dev20260621-py3-none-any.whl.
File metadata
- Download URL: teenyfactories-0.1.0.dev20260621-py3-none-any.whl
- Upload date:
- Size: 85.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7279a510b168d7e2a64d7b62f321335f1d8da960bea6d7bcbc498d8f5c6fe98
|
|
| MD5 |
19c5e783d38a419c1e04e99974551c0c
|
|
| BLAKE2b-256 |
40dd856b39fa3b516ff546743d3a58ce788c9225bf6f1959fc5588bebf2afb86
|