teenyfactories
Agent runtime for TeenyFactories. Postgres-backed pub/sub, multi-provider LLM calls, vector search.
📖 Documentation: teenyfactories.github.io/core
pip install 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 into a (collection, state) makes every subscriber to that pair pick it up: (collection, state) is a FIFO queue, and the handler consumes a row by transitioning its state (or deleting it). That's the framework.
Public API
| Group | Names |
|---|---|
| Pub/sub | on_state, run_pending (the only pub/sub primitive — no message bus) |
| Data | collection (.set, .add, .get, .get_all, .remove, .count, .exists, .first, .state, .where, .limit, .vector_search), embed |
| LLM | llm (fluent builder — .ask / .run_agent_loop), call_llm (LEGACY) |
| MCP | add_mcp_server, add_mcp_tool |
| Schedule | on_schedule.every(N).<unit>.do(handler) |
| Secrets / files | secrets, bucket_store (+ BucketStoreError family) |
| Logging | log_debug, log_info, log_warn, log_error, log_persona |
| Time / IDs | get_timestamp, get_timestamp_utc, generate_unique_id |
| Debug | breakpoint |
| Lifecycle / config | sleep, shutting_down, FACTORY_NAME, AGENT_NAME, AGENT_SLUG, AGENT_ID, __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
Semantic versioning; current release 1.0.0 (pip install teenyfactories). The version is declared in pyproject.toml and teenyfactories/__version__.py (kept in lockstep) and published to PyPI by CI on push to main, idempotent per version.
License
MIT.
Metadata
Release files for teenyfactories 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| teenyfactories-1.0.0.tar.gz | 96.5 kB | Without provenance | Details for teenyfactories-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| teenyfactories-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for teenyfactories-1.0.0-py3-none-any.whl |
Total release size: 199.8 kB
Release files / teenyfactories-1.0.0.tar.gz
| Download URL | teenyfactories-1.0.0.tar.gz |
|---|---|
| Size | 96.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c350a68a8048dffceb8b88c3e096f5057f8762de59241a3f91c124579225b4a0
|
|
BLAKE2b-256 checksum How to use checksums |
a181e96cb42d82d8747d70f8f89b95d448a1d8b41582dc20b2c9cb09e80e5eed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / teenyfactories-1.0.0-py3-none-any.whl
| Download URL | teenyfactories-1.0.0-py3-none-any.whl |
|---|---|
| Size | 103.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a3df1186305f0e500db03d63745719e293c34fc035fda23c21bb017ece03be7
|
|
BLAKE2b-256 checksum How to use checksums |
357087b052f45c4cbe2ed7d23e3274df2c3ace6188b64d60919424f52b7a510b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Security for teenyfactories 1.0.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.