Decentralized P2P Encrypted Chat Agent powered by Strands Agents & Bluetooth LE
Project description
๐ BitChat Strands Agent
Decentralized P2P Encrypted Chat Agent powered by Strands Agents & Bluetooth LE
A revolutionary AI agent that communicates through decentralized, peer-to-peer encrypted chat networks over Bluetooth Low Energy. Enables secure agent-to-agent and agent-to-human communication without internet dependency.
๐ Features
๐ฅ Core Capabilities
- ๐ค AI Agent Integration - Full Strands Agent with BitChat communication
- ๐ก P2P Mesh Network - Direct device-to-device communication over Bluetooth LE
- ๐ End-to-End Encryption - Noise Protocol with ChaCha20-Poly1305 and forward secrecy
- ๐ No Internet Required - Works completely offline in air-gapped environments
- โก Auto-Installation - Automatically installs all required dependencies
๐ฌ Communication Types
- ๐ข Public Broadcasts - Send messages to all connected peers
- ๐ Private Messages - End-to-end encrypted direct messages
- ๐บ Secure Channels - Password-protected group conversations
- ๐ Message Relay - Mesh network message forwarding for extended range
๐ก๏ธ Security & Privacy
- Noise Protocol XX - Modern cryptographic handshake protocol
- ChaCha20-Poly1305 - Authenticated encryption with additional data (AEAD)
- Forward Secrecy - Past communications remain secure even if keys are compromised
- Identity Keys - Persistent cryptographic identity across sessions
- Peer Blocking - Privacy controls and user management
- Traffic Analysis Resistance - PKCS#7 padding and cover traffic
๐ค Agent Collaboration
- Trigger Keywords - Agents respond to mentions (e.g., "max, analyze this")
- Context Awareness - Full conversation history in agent responses
- Cross-Platform - Works across different devices and operating systems
- Emergency Coordination - Agents coordinate during network outages
- Team Automation - Automatic task distribution across agent network
๐ Requirements
System Requirements
- Python 3.8+
- Bluetooth Low Energy support (most modern devices)
- macOS, Linux, or Windows
Dependencies (Auto-installed)
strands-agents- Core AI agent frameworkstrands-agents-tools- Extended tool ecosystembleak>=0.20.0- Bluetooth Low Energy librarypybloom-live>=4.0.0- Bloom filters for message deduplicationlz4>=4.3.0- Fast compressioncryptography>=41.0.0- Cryptographic primitives
๐ง Installation
1. Clone the Repository
git clone https://github.com/cagataycali/strands-bitchat.git
cd strands-bitchat
2. Install Dependencies
pip install -r requirements.txt
3. Run the Agent
python agent.py
That's it! The agent will automatically install any missing BitChat dependencies on first use.
๐ฎ Usage
Starting the Agent
python agent.py
Basic Commands
Start BitChat Network
> start bitchat
Send Public Message
> send public message "Hello BitChat network!"
Join Password-Protected Channel
> join channel #secure with password mysecret
Send Private Message
> send private message to alice "This is encrypted!"
Enable Agent Auto-Responses
> enable agent triggers with keyword "assistant"
Advanced Usage Examples
Agent-to-Agent Communication
# Enable automatic responses to "max" trigger in BitChat
bitchat(action="enable_agent", trigger_keyword="max", agent=agent)
# Other agents can now trigger responses:
# In BitChat: "max, what time is it?"
# Agent automatically responds via BitChat
Secure Team Coordination
# Join secure team channel
bitchat(action="join_channel", channel="#operations", password="team2024")
# Send encrypted team message
bitchat(action="send_channel", message="Task completed successfully", channel="#operations")
Emergency Network Operations
# Works without internet - pure P2P mesh
bitchat(action="start") # Connects to local Bluetooth LE mesh
bitchat(action="send_public", message="Emergency coordination active")
๐ ๏ธ BitChat Tool API
Available Actions
| Action | Description | Parameters |
|---|---|---|
start |
Start BitChat client | None |
stop |
Stop BitChat client | None |
status |
Get connection status | None |
send_public |
Send public broadcast | message |
send_private |
Send encrypted DM | message, recipient |
send_channel |
Send channel message | message, channel |
join_channel |
Join/create channel | channel, password (optional) |
leave_channel |
Leave current channel | None |
list_peers |
List connected peers | None |
list_channels |
List discovered channels | None |
block_user |
Block a user | nickname |
unblock_user |
Unblock a user | nickname |
set_nickname |
Change nickname | nickname |
get_messages |
Get message history | None |
enable_agent |
Enable auto-responses | trigger_keyword, agent |
disable_agent |
Disable auto-responses | None |
agent_status |
Check agent integration | None |
Python API Examples
Basic Usage
from strands import Agent
from src.tools import bitchat
agent = Agent(tools=[bitchat])
# Start BitChat
result = agent.tool.bitchat(action="start")
# Send message
result = agent.tool.bitchat(action="send_public", message="Hello world!")
# Enable agent integration
result = agent.tool.bitchat(action="enable_agent", trigger_keyword="max", agent=agent)
Advanced Integration
# Multi-channel coordination
agent.tool.bitchat(action="join_channel", channel="#team", password="secret")
agent.tool.bitchat(action="join_channel", channel="#public")
# Automated responses across channels
agent.tool.bitchat(action="enable_agent", trigger_keyword="assistant", agent=agent)
# Now other users can interact:
# - Public: "assistant, analyze this data"
# - Team channel: "assistant, status report"
# - Direct message: "assistant, help with task"
๐ Security Architecture
Encryption Details
- Handshake: Noise Protocol XX pattern
- Transport: ChaCha20-Poly1305 AEAD cipher
- Key Exchange: Curve25519 ECDH
- Hash Function: SHA-256
- Forward Secrecy: Automatic key rotation
Network Security
- Mesh Topology: No single point of failure
- Message Deduplication: Bloom filters prevent replay attacks
- TTL (Time To Live): Prevents infinite message loops
- Fragmentation: Large messages split and reassembled securely
Privacy Features
- Pseudonymous Identity: No real identity required
- Local Storage: All data stored locally
- No Cloud Dependencies: Pure P2P architecture
- Cover Traffic: Traffic analysis resistance
๐ Network Topology
Device A โโ Device B โโ Device C
โ โ โ
โโโโโโโโ Device D โโโโโโโ
โข Each device can relay messages
โข No central server required
โข Works in isolated environments
โข Automatic peer discovery
โข Mesh healing capabilities
๐ฏ Use Cases
๐ค Agent Networks
- Multi-agent collaboration on complex tasks
- Distributed AI processing across devices
- Agent-to-agent knowledge sharing
- Coordinated autonomous operations
๐ก๏ธ Security & Privacy
- Air-gapped secure communications
- Emergency response coordination
- Sensitive data discussions
- Privacy-focused team communication
๐ Offline Operations
- Remote area communications
- Internet outage scenarios
- Conference/event networking
- IoT device coordination
๐ผ Enterprise Applications
- Secure team coordination
- Agent-assisted workflows
- Distributed system monitoring
- Edge computing coordination
๐ Getting Started Examples
Example 1: Basic Agent Chat
python agent.py
> start bitchat
โ
BitChat started! Status: connecting
> set nickname to "MyAgent"
๐ Nickname changed to: MyAgent
> send public message "Hello from Strands Agent!"
๐ข Public message sent: Hello from Strands Agent!
Example 2: Agent Auto-Response Setup
> enable agent triggers with keyword "assistant"
๐ค Agent trigger enabled! Will respond to 'assistant' in BitChat messages
# Now other users can trigger agent responses:
# Other user: "assistant, what's 2+2?"
# Agent automatically responds: "The answer is 4"
Example 3: Secure Channel Operations
> join channel #team with password secretkey
๐ Joined channel #team (with password)
> send to channel "Secure team message"
๐บ Channel message sent to #team: Secure team message
> list channels
๐บ Discovered Channels:
โข #team ๐ โ
โข #public
๐ = Password protected, โ
= Joined
๐ง Troubleshooting
Connection Issues
# Check Bluetooth status
> status bitchat
๐ BitChat Status: Connected โ
# Restart if needed
> stop bitchat
> start bitchat
Permission Issues
- macOS: Grant Bluetooth permission in System Preferences
- Linux: Ensure user is in
bluetoothgroup - Windows: Enable Bluetooth in Device Manager
Common Problems
- No peers found: Check Bluetooth is enabled on all devices
- Failed to connect: Restart BitChat and try again
- Messages not decrypting: Verify channel password is correct
- Agent not responding: Check trigger keyword and agent status
๐ Documentation
Protocol Specification
- Based on Noise Protocol Framework XX pattern
- Bluetooth LE GATT service implementation
- Message fragmentation for large payloads
- Delivery acknowledgments for reliability
Architecture Overview
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Strands โ โ BitChat โ โ Bluetooth โ
โ Agent โโโโโบโ Protocol โโโโโบโ LE Mesh โ
โ โ โ โ โ โ
โ โข AI Processing โ โ โข Encryption โ โ โข P2P Network โ
โ โข Tool Calling โ โ โข Message Relay โ โ โข Device Discoveryโ
โ โข Context Mgmt โ โ โข Channel Mgmt โ โ โข Data Transportโ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐ค Contributing
Contributions welcome! Areas for improvement:
- Performance optimization for large networks
- Additional encryption algorithms
- Protocol extensions for new message types
- Integration with other Strands tools
- Documentation and examples
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- Strands Agents - Core AI agent framework
- Noise Protocol - Cryptographic protocol design
- Bleak - Cross-platform Bluetooth LE library
- BitChat Protocol - Original BitChat implementation
๐ Ready to build the future of decentralized AI communication!
Create autonomous agent networks that work anywhere, anytime, without internet dependency.
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
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 strands_bitchat-1.0.0.tar.gz.
File metadata
- Download URL: strands_bitchat-1.0.0.tar.gz
- Upload date:
- Size: 38.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04d964747725d8dded21831e1362b2e39176d3d6d75d822b04f0f80a87569f3d
|
|
| MD5 |
41aa7257fcc643f922dd3eb409525285
|
|
| BLAKE2b-256 |
82d605f9a338fba278070bd63bea49f4d66c4020cad80703a33040ac0dd07a6d
|
File details
Details for the file strands_bitchat-1.0.0-py3-none-any.whl.
File metadata
- Download URL: strands_bitchat-1.0.0-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eded6ff5456ae3ad0f99a7bf163ec1fa3fea55e32f06fae8cc23e642160e5c4c
|
|
| MD5 |
74932fc0d76ab030ed3235de985e5496
|
|
| BLAKE2b-256 |
4f9fd49627fde5bc9f06a8ee677c50a5cd827bfd5c34a6a20af995c0829ec5b7
|