Skip to main content

Pulsing - Distributed Actor Framework

Project description

Pulsing

CI License Python 3.10+ Rust

中文文档

Pulsing is a distributed actor framework that provides a communication backbone for building distributed systems, with specialized support for AI applications.

🚀 Zero Dependencies — Pure Rust + Tokio, no NATS/etcd/Redis

🌐 Auto Discovery — Built-in Gossip protocol for cluster management

🔀 Location Transparent — Same API for local and remote Actors

Streaming Ready — Native support for LLM streaming responses

🤖 Agent Friendly — Integrates with AutoGen, LangGraph out of the box

🚀 Get Started in 5 Minutes

Installation

pip install pulsing

Your First Multi-Agent Application

import asyncio
import pulsing as pul
from pulsing.agent import runtime

@pul.remote
class Greeter:
    def __init__(self, display_name: str):
        self.display_name = display_name

    def greet(self, message: str) -> str:
        return f"[{self.display_name}] Received: {message}"

    async def chat_with(self, peer_name: str, message: str) -> str:
        # Use Greeter.resolve() to get a typed proxy
        peer = await Greeter.resolve(peer_name)
        return await peer.greet(f"From {self.display_name}: {message}")

async def main():
    async with runtime():
        # Create two agents
        alice = await Greeter.spawn(display_name="Alice", name="alice")
        bob = await Greeter.spawn(display_name="Bob", name="bob")

        # Agent communication
        reply = await alice.chat_with("bob", "Hello!")
        print(reply)  # [Bob] Received: From Alice: Hello!

asyncio.run(main())

That's it! @pul.remote turns a regular class into a distributed Actor, and Greeter.resolve() enables agents to discover and communicate with each other.

💡 I want to...

Scenario Example Description
Quick start examples/quickstart/ Get started in 10 lines
Multi-Agent collaboration examples/agent/pulsing/ AI debate, brainstorming, role-playing
Distributed LLM inference pulsing actor router/vllm GPU cluster inference service
Integrate AutoGen examples/agent/autogen/ One line to go distributed
Integrate LangGraph examples/agent/langgraph/ Execute graphs across nodes

🎯 Core Capabilities

1. Multi-Agent Collaboration

Multiple AI Agents working in parallel and communicating:

from pulsing.agent import agent, runtime, llm

@agent(role="Researcher", goal="Deep analysis")
class Researcher:
    async def analyze(self, topic: str) -> str:
        client = await llm()
        return await client.ainvoke(f"Analyze: {topic}")

@agent(role="Reviewer", goal="Evaluate proposals")
class Reviewer:
    async def review(self, proposal: str) -> str:
        client = await llm()
        return await client.ainvoke(f"Review: {proposal}")

async with runtime():
    researcher = await Researcher.spawn(name="researcher")
    reviewer = await Reviewer.spawn(name="reviewer")

    # Parallel work and collaboration
    analysis = await researcher.analyze("AI trends")
    feedback = await reviewer.review(analysis)
# Run MBTI personality discussion example
python examples/agent/pulsing/mbti_discussion.py --mock --group-size 6

# Run parallel idea generation example
python examples/agent/pulsing/parallel_ideas_async.py --mock --n-ideas 5

2. One Line to Distributed

Develop locally, scale seamlessly to clusters:

# Standalone mode (development)
async with runtime():
    agent = await MyAgent.spawn(name="agent")

# Distributed mode (production) — just add address
async with runtime(addr="0.0.0.0:8001"):
    agent = await MyAgent.spawn(name="agent")

# Other nodes auto-discover
async with runtime(addr="0.0.0.0:8002", seeds=["node1:8001"]):
    agent = await resolve("agent")  # Cross-node transparent call

3. LLM Inference Service

Out-of-the-box GPU cluster inference:

# Start Router (OpenAI-compatible API)
pulsing actor pulsing.actors.Router --addr 0.0.0.0:8000 --http_port 8080 --model_name my-llm

# Start vLLM Worker (can have multiple)
pulsing actor pulsing.actors.VllmWorker --model Qwen/Qwen2.5-0.5B --addr 0.0.0.0:8002 --seeds 127.0.0.1:8000

# Test
curl http://localhost:8080/v1/chat/completions \
  -d '{"model": "my-llm", "messages": [{"role": "user", "content": "Hello"}]}'

4. Agent Framework Integration

Have existing AutoGen/LangGraph code? One-line migration:

# AutoGen: Replace runtime
from pulsing.autogen import PulsingRuntime
runtime = PulsingRuntime(addr="0.0.0.0:8000")

# LangGraph: Wrap the graph
from pulsing.langgraph import with_pulsing
distributed_app = with_pulsing(app, seeds=["gpu-server:8001"])

📚 Example Guide

examples/
├── quickstart/              # ⭐ 5-minute quickstart
│   └── hello_agent.py       #    First Agent
├── agent/
│   ├── pulsing/             # ⭐⭐ Multi-Agent apps
│   │   ├── mbti_discussion.py      # MBTI personality discussion
│   │   └── parallel_ideas_async.py # Parallel idea generation
│   ├── autogen/             # AutoGen integration
│   └── langgraph/           # LangGraph integration
├── python/                  # ⭐⭐ Basic examples
│   ├── ping_pong.py         #    Actor basics
│   ├── cluster.py           #    Cluster communication
│   └── ...
└── rust/                    # Rust examples

🔧 Technical Features

  • Zero external dependencies: Pure Rust + Tokio, no NATS/etcd/Redis needed
  • Gossip protocol: Built-in SWIM protocol for node discovery and failure detection
  • Location transparency: Same API for local and remote Actors
  • Streaming messages: Native support for streaming requests/responses (LLM-ready)
  • Type safety: Rust Behavior API provides compile-time message type checking

📦 Project Structure

Pulsing/
├── crates/                   # Rust core
│   ├── pulsing-actor/        #   Actor System
│   └── pulsing-py/           #   Python bindings
├── python/pulsing/           # Python package
│   ├── actor/                #   Actor API
│   ├── agent/                #   Agent toolkit
│   ├── autogen/              #   AutoGen integration
│   └── langgraph/            #   LangGraph integration
├── examples/                 # Example code
└── docs/                     # Documentation

🛠️ Development

# Development build
maturin develop

# Run tests
pytest tests/python/
cargo test --workspace

📄 License

Apache-2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pulsing-0.1.0-cp310-abi3-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

pulsing-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

pulsing-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (5.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

pulsing-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

pulsing-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file pulsing-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: pulsing-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pulsing-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 11687c4f1907a02089bcdc32822cb85c1db057c31a99c923bb25c0b32a60808b
MD5 afe82640ace54e1df4e96fd5a49a5d9f
BLAKE2b-256 05d1fcd870ed4ad89bbb759be51d7d3dd146a6ea75e5d8aff800771abaf16fd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsing-0.1.0-cp310-abi3-win_amd64.whl:

Publisher: pypi.yml on DeepLink-org/Pulsing

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

File details

Details for the file pulsing-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pulsing-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8f8f3e1f49ac1a854130c760f380f87d4079886728596776b62ceb1d97e948ca
MD5 0774b53c8f8c036b012b433f2ad3f975
BLAKE2b-256 0fb6dd120fbf622df459aa623b8325fb22bdd148285de98a31b077c375057dab

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsing-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi.yml on DeepLink-org/Pulsing

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

File details

Details for the file pulsing-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pulsing-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 21480db62bbd15690e3ec912d62a3ed418c85401c090f6564e85b86885125eed
MD5 15d532afb90e5edd38f8fe0a2772732f
BLAKE2b-256 cca8aa6a53d57744b916cd9849be9f01ff299b08e46f7dfd89f5f4cfed9f26ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsing-0.1.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: pypi.yml on DeepLink-org/Pulsing

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

File details

Details for the file pulsing-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pulsing-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47be8e329ed2c28d14f1bf32de22e6a556cc210fddfe6a78f456c56c93655ecc
MD5 b6f9c2d676406e1330c0e1c5761c1329
BLAKE2b-256 85b035c436a001b33bac4e4fff63959f63bad0195fcad4c8ac03a47ee4bdb898

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsing-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: pypi.yml on DeepLink-org/Pulsing

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

File details

Details for the file pulsing-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pulsing-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b9998a9f126789f40a688f9268d0e7258ed6a038f6c47f90143211947021a139
MD5 15d91837ae41fd0142ab7d08a58f3be1
BLAKE2b-256 065aa771ded3c3e0f4f19a0edf54ec579934b8383bf44a5ca5a7e39af7b0abe4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pulsing-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: pypi.yml on DeepLink-org/Pulsing

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