Skip to main content

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 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, .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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

teenyfactories-0.1.0.dev20260708.tar.gz (88.8 kB view details)

Uploaded Source

Built Distribution

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

teenyfactories-0.1.0.dev20260708-py3-none-any.whl (98.8 kB view details)

Uploaded Python 3

File details

Details for the file teenyfactories-0.1.0.dev20260708.tar.gz.

File metadata

File hashes

Hashes for teenyfactories-0.1.0.dev20260708.tar.gz
Algorithm Hash digest
SHA256 9220ecbf0e7707c847ca416e27fc06d84e35ba69671d27818809397c59c441f3
MD5 53351e972d75a8c4d4fbd9477596bb43
BLAKE2b-256 28dc08c74317a31ae383cab0873fc67bb4d7322d7eacdc78a31fb0eef7b7f3a1

See more details on using hashes here.

File details

Details for the file teenyfactories-0.1.0.dev20260708-py3-none-any.whl.

File metadata

File hashes

Hashes for teenyfactories-0.1.0.dev20260708-py3-none-any.whl
Algorithm Hash digest
SHA256 de6292b9a726e699279c1a12460ab26b32ab3a02b20a0c3cd5c17c2a0c86e3c5
MD5 66fb7de0429c24eab4cf750f487ae7d2
BLAKE2b-256 d81b305918a00a646e51b1b3743ef5ceb664eac5e27a14bcd0672250927a8394

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