Metadata-Version: 2.4
Name: teenyfactories
Version: 0.1.0.dev20260720
Summary: Multi-provider LLM and message queue abstraction for distributed agent systems
Author: TeenyFactories Team
License: MIT
Project-URL: Homepage, https://github.com/teenyfactories/core
Project-URL: Documentation, https://github.com/teenyfactories/core/blob/main/README.md
Project-URL: Repository, https://github.com/teenyfactories/core
Project-URL: Issues, https://github.com/teenyfactories/core/issues
Keywords: llm,agent,distributed,message-queue,openai,anthropic,redis,postgres
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: python-dotenv>=0.19.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: langchain>=0.1.0
Requires-Dist: langchain-core>=0.1.0
Requires-Dist: schedule>=1.2.0
Requires-Dist: pypdf>=4.0.0
Provides-Extra: openai
Requires-Dist: langchain-openai>=0.0.5; extra == "openai"
Provides-Extra: anthropic
Requires-Dist: langchain-anthropic>=0.1.0; extra == "anthropic"
Provides-Extra: google
Requires-Dist: langchain-google-genai>=0.0.5; extra == "google"
Provides-Extra: ollama
Requires-Dist: langchain-community>=0.0.20; extra == "ollama"
Provides-Extra: azure
Requires-Dist: langchain-openai>=0.0.5; extra == "azure"
Requires-Dist: openai>=1.0.0; extra == "azure"
Provides-Extra: redis
Requires-Dist: redis>=4.0.0; extra == "redis"
Provides-Extra: postgres
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
Provides-Extra: all-llm
Requires-Dist: langchain-openai>=0.0.5; extra == "all-llm"
Requires-Dist: langchain-anthropic>=0.1.0; extra == "all-llm"
Requires-Dist: langchain-google-genai>=0.0.5; extra == "all-llm"
Requires-Dist: langchain-community>=0.0.20; extra == "all-llm"
Requires-Dist: openai>=1.0.0; extra == "all-llm"
Provides-Extra: all-mq
Requires-Dist: redis>=4.0.0; extra == "all-mq"
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all-mq"
Provides-Extra: data
Requires-Dist: duckdb>=1.0.0; extra == "data"
Requires-Dist: pyyaml>=6.0.0; extra == "data"
Provides-Extra: google-drive
Requires-Dist: google-api-python-client>=2.0.0; extra == "google-drive"
Requires-Dist: google-auth>=2.0.0; extra == "google-drive"
Provides-Extra: media
Requires-Dist: imageio-ffmpeg>=0.5.0; extra == "media"
Provides-Extra: all
Requires-Dist: langchain-openai>=0.0.5; extra == "all"
Requires-Dist: langchain-anthropic>=0.1.0; extra == "all"
Requires-Dist: langchain-google-genai>=0.0.5; extra == "all"
Requires-Dist: langchain-community>=0.0.20; extra == "all"
Requires-Dist: openai>=1.0.0; extra == "all"
Requires-Dist: redis>=4.0.0; extra == "all"
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
Requires-Dist: duckdb>=1.0.0; extra == "all"
Requires-Dist: pyyaml>=6.0.0; extra == "all"
Requires-Dist: google-api-python-client>=2.0.0; extra == "all"
Requires-Dist: google-auth>=2.0.0; extra == "all"
Requires-Dist: imageio-ffmpeg>=0.5.0; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: flake8>=5.0.0; extra == "dev"
Requires-Dist: mypy>=0.990; extra == "dev"
Dynamic: requires-python

# teenyfactories

Agent runtime for [TeenyFactories](https://github.com/teenyfactories/core). Postgres-backed pub/sub, multi-provider LLM calls, vector search.

```bash
pip install --pre teenyfactories
```

```python
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](https://github.com/teenyfactories/core).

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