Messages and Dynamic AI Systems in Python powered by pretrained models
Project description
Dynamic AI systems in Python.
Documentation | Tutorials | Quickstart
msgFlux is an open-source Python framework for building AI systems with pretrained models as composable software components. It is built for applications where the model is one part of a larger program: agents, tools, signatures, multimodal modules, shared messages, and explicit orchestration.
Its core mental model comes from PyTorch: modules compose into programs, execution is explicit, and system behavior lives in code structure. msgFlux also adopts typed signatures as a useful abstraction for LM workflows, while keeping prompting, tools, and data flow grounded in a broader module-oriented architecture.
Why msgFlux
- Build AI systems, not isolated prompts.
- Treat signatures, prompts, tools, and message flow as first-class program structure.
- Compose
nn.Agent,nn.Module,nn.Transcriber,nn.Speaker,nn.Embedder, andnn.MediaMaker. - Choose imperative calls or declarative message binding per module.
- Run against OpenAI-compatible providers, hosted APIs, or self-hosted endpoints.
Install
Core
uv add msgflux
# or
pip install msgflux
OpenAI and OpenAI-compatible providers
uv add "msgflux[openai]"
# or
pip install "msgflux[openai]"
More setup details: https://msgflux.com/dependency-management/
Minimal Examples
Imperative
import msgflux as mf
import msgflux.nn as nn
mf.set_envs(OPENAI_API_KEY="...")
class SupportAgent(nn.Agent):
model = mf.Model.chat_completion("openai/gpt-4.1-mini")
system_message = "You are a helpful support agent."
instructions = "You are assisting {{ user_name }}."
agent = SupportAgent()
result = agent(
"My dashboard is not loading after the last update.",
vars={"user_name": "Alice"},
)
print(result)
Declarative
import msgflux as mf
import msgflux.nn as nn
mf.set_envs(OPENAI_API_KEY="...")
class SupportAgent(nn.Agent):
model = mf.Model.chat_completion("openai/gpt-4.1-mini")
system_message = "You are a helpful support agent."
instructions = "You are assisting {{ user_name }}."
message_fields = {"task": "issue", "vars": "variables"}
response_mode = "solution"
agent = SupportAgent()
msg = mf.Message()
msg.issue = "My dashboard is not loading after the last update."
msg.variables = {"user_name": "Alice"}
agent(msg)
print(msg.solution)
Core Ideas
AI systems, not ML systems
msgFlux targets software built with pretrained models as components inside larger applications. The focus is not training the model; it is designing the system around it.
Declarative and imperative
A module can behave like a regular Python callable or bind itself to a shared message object. That choice lives at the module level, which makes it easier to mix direct control flow with pipeline-style orchestration.
Programming and prompting
Prompting and programming are related, but not the same thing. msgFlux lets you write prompts directly when needed, while still treating signatures, schemas, and routing as explicit code-level structure.
Modules compose into programs
Agents, transcribers, speakers, embedders, retrievers, and custom modules can be combined into larger pipelines, routers, and multimodal workflows.
Learn More
- Documentation: https://msgflux.com/
- Agent quickstart: https://msgflux.com/learn/nn/agent/quickstart/
- Tutorials index: https://msgflux.com/tutorials/
- Dependency management: https://msgflux.com/dependency-management/
- Home page theory and architecture: https://msgflux.com/
Example Tutorials
- Support Ticket Router: https://msgflux.com/tutorials/support-ticket-router/
- Meeting Assistant: https://msgflux.com/tutorials/meeting-assistant/
- PIX Assistant: https://msgflux.com/tutorials/pix-assistant/
- Plan Tool with Root Context: https://msgflux.com/tutorials/plan-tool-with-root-context/
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 msgflux-0.3.0.tar.gz.
File metadata
- Download URL: msgflux-0.3.0.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e21f88114550d109747b2cb11eb04385db4567e372573aad8643a106441ed37
|
|
| MD5 |
6c68b02b1a7c69d17f9af3964c0bf087
|
|
| BLAKE2b-256 |
61b66632faec2c8192590e66dd9273c1d6ae8bb3ac8608fa9c3aa20097a8ee5e
|
Provenance
The following attestation bundles were made for msgflux-0.3.0.tar.gz:
Publisher:
publish.yml on msgflux/msgflux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
msgflux-0.3.0.tar.gz -
Subject digest:
7e21f88114550d109747b2cb11eb04385db4567e372573aad8643a106441ed37 - Sigstore transparency entry: 1343424930
- Sigstore integration time:
-
Permalink:
msgflux/msgflux@6a9dd1d89fd0f0bb7be080a88eb8433270e4feaa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/msgflux
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6a9dd1d89fd0f0bb7be080a88eb8433270e4feaa -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file msgflux-0.3.0-py3-none-any.whl.
File metadata
- Download URL: msgflux-0.3.0-py3-none-any.whl
- Upload date:
- Size: 275.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
086160f9c88ddb81a7e80bfcbaacc374ef2275ebca73ee1a1d77bab0ebe6afb0
|
|
| MD5 |
7b1998b98aa0a918c705be116671a161
|
|
| BLAKE2b-256 |
dbd83204b76084b443809b614f1521742929c1ed56c15f3485d9b0f3f8b5b213
|
Provenance
The following attestation bundles were made for msgflux-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on msgflux/msgflux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
msgflux-0.3.0-py3-none-any.whl -
Subject digest:
086160f9c88ddb81a7e80bfcbaacc374ef2275ebca73ee1a1d77bab0ebe6afb0 - Sigstore transparency entry: 1343424936
- Sigstore integration time:
-
Permalink:
msgflux/msgflux@6a9dd1d89fd0f0bb7be080a88eb8433270e4feaa -
Branch / Tag:
refs/heads/main - Owner: https://github.com/msgflux
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6a9dd1d89fd0f0bb7be080a88eb8433270e4feaa -
Trigger Event:
workflow_run
-
Statement type: