Skip to main content

Messages and Dynamic AI Systems in Python powered by pretrained models

Project description

msgFlux

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

Example Tutorials

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

msgflux-0.1.0a31.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

msgflux-0.1.0a31-py3-none-any.whl (257.7 kB view details)

Uploaded Python 3

File details

Details for the file msgflux-0.1.0a31.tar.gz.

File metadata

  • Download URL: msgflux-0.1.0a31.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

Hashes for msgflux-0.1.0a31.tar.gz
Algorithm Hash digest
SHA256 6a09579cd6873fb27cb9a2747fcd242b9d5603dcedb1d1250a6bf4b64132c4a1
MD5 88939e580f91d3009d2253cc46c7694b
BLAKE2b-256 8f16d7ed43f38b18e4ce7bc702f366ca668837c73b4201813124fb11d6fa457c

See more details on using hashes here.

Provenance

The following attestation bundles were made for msgflux-0.1.0a31.tar.gz:

Publisher: publish.yml on msgflux/msgflux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file msgflux-0.1.0a31-py3-none-any.whl.

File metadata

  • Download URL: msgflux-0.1.0a31-py3-none-any.whl
  • Upload date:
  • Size: 257.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for msgflux-0.1.0a31-py3-none-any.whl
Algorithm Hash digest
SHA256 877bba2ba754d3757b1b92fe366f6c87c78e2c97f812e65abbd110364d5a602c
MD5 91fc1e8e4eccc01311133adc7c4597a3
BLAKE2b-256 ba7527ef63e0f877c59f5e3561b5e23928f6d6b52eea8d867879a848c63b7a16

See more details on using hashes here.

Provenance

The following attestation bundles were made for msgflux-0.1.0a31-py3-none-any.whl:

Publisher: publish.yml on msgflux/msgflux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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