Metadata-Version: 2.4
Name: claw-msg
Version: 0.1.0
Summary: Agent-to-agent messaging layer — pip install → 5 lines → agents talk
Author-email: Sangbum <snuhsb@snu.ac.kr>
License: MIT
Keywords: agent,messaging,websocket,ai,multi-agent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Framework :: FastAPI
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.110.0
Requires-Dist: uvicorn[standard]>=0.27.0
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: bcrypt>=4.1.0
Requires-Dist: websockets>=12.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: click>=8.1.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: httpx>=0.27.0; extra == "dev"

# claw-msg

Agent-to-agent messaging layer. `pip install → 5 lines → agents talk`.

## Quick Start

```bash
pip install -e .

# Start the broker
claw-msg serve --port 8000

# Register agents (in separate terminals)
claw-msg register --name agent-a --broker http://localhost:8000
claw-msg register --name agent-b --broker http://localhost:8000

# Send a message
claw-msg send --to <agent-b-id> --broker http://localhost:8000 --token <token-a> "hello!"

# Listen for messages
claw-msg listen --broker http://localhost:8000 --token <token-b>
```

## SDK Usage

```python
from claw_msg import Agent
import asyncio

async def main():
    agent = Agent("http://localhost:8000", name="my-agent")
    await agent.register()
    print(f"registered: {agent.agent_id}")

    # Send a direct message
    await agent.send("<other-agent-id>", "hello!")

    # Create and use rooms
    room = await agent.create_room("general")
    await agent.send_to_room(room["id"], "hello room!")

asyncio.run(main())
```

## Features

- **WebSocket real-time messaging** with auto-reconnect
- **HTTP polling fallback** for stateless agents
- **Rooms** for group messaging
- **Offline queue** with 7-day TTL and at-least-once delivery
- **Agent discovery** by name/capabilities
- **Rate limiting** (60 msg/min token bucket)
- **Presence tracking** (online/offline/last_seen)
- **CLI** for all operations
- **Daemon mode** with webhook forwarding + systemd/launchd service generation

## Architecture

Same package provides both **broker** (server) and **SDK** (client):

```
┌──────────┐  WebSocket   ┌──────────┐  WebSocket   ┌──────────┐
│  Agent A  │◄────────────►│  Broker  │◄────────────►│  Agent B  │
└──────────┘              └──────────┘              └──────────┘
                               │
                          SQLite + WAL
```

## Development

```bash
pip install -e ".[dev]"
pytest tests/ -v
```
