synapse 0.1.0

A chat protocol and communication framework for AI-to-AI interaction
Documentation

Synapse

Crates.io Documentation License: MIT OR Apache-2.0

A chat protocol and communication framework for AI-to-AI interaction.

Overview

Synapse is designed to enable seamless communication between AI agents in distributed systems. It provides a foundation for building AI communication networks with support for real-time messaging, agent discovery, and protocol negotiation.

Features

  • Agent Management: Create and manage AI agents with unique identities and metadata
  • Message Protocol: Structured messaging system with support for text, binary, and JSON content
  • System Messages: Built-in support for ping/pong, agent joining/leaving, and protocol negotiation
  • Serialization: JSON-based message serialization for network transport
  • Type Safety: Full Rust type safety for all protocol operations
  • Extensible: Designed for easy extension with custom message types and capabilities

Quick Start

Add Synapse to your Cargo.toml:

[dependencies]
synapse = "0.1.0"

Basic usage:

use synapse::{Agent, Message, MessageType};

// Create an AI agent
let agent = Agent::new("ai-assistant-1", "Assistant Agent");

// Create a message
let message = Message::new(
    agent.id().to_string(),
    "target-agent".to_string(),
    MessageType::Text("Hello, fellow AI!".to_string())
);

// Serialize for network transport
let json = synapse::utils::serialize_message(&message)?;
println!("Serialized message: {}", json);

// Deserialize received message
let received = synapse::utils::deserialize_message(&json)?;
println!("Received from {}: {:?}", received.from(), received.content());

Message Types

Synapse supports several message types:

  • Text: Plain text messages
  • Binary: Raw binary data
  • JSON: Structured JSON data
  • System: Protocol control messages (ping, pong, join, leave, version negotiation)

System Messages

Built-in system messages for protocol management:

use synapse::{MessageType, SystemMessage, utils};

// Create ping/pong for connectivity testing
let ping = utils::create_ping("agent1", "agent2");
let pong = utils::create_pong("agent2", "agent1");

// Agent lifecycle messages
let join_msg = Message::new(
    agent.id().to_string(),
    "broadcast".to_string(),
    MessageType::System(SystemMessage::Join(agent.clone()))
);

Roadmap

This is an early placeholder release to reserve the crate name. Future versions will include:

  • Network Transport: TCP, WebSocket, and UDP transport implementations
  • Discovery Service: Automatic agent discovery and network topology
  • Security: Authentication, authorization, and end-to-end encryption
  • Federation: Cross-network communication between different Synapse instances
  • Streaming: Real-time data streaming capabilities
  • Client Libraries: High-level client APIs for different use cases
  • Server Implementation: Ready-to-use server components

Development Status

🚧 Early Development - This crate is currently a placeholder to reserve the name "synapse" on Crates.io. The API is subject to change as development progresses.

Contributing

This project is in early development. Contributions will be welcome once the core architecture is established.

License

This project is licensed under either of

at your option.

Acknowledgments

Synapse draws inspiration from modern chat protocols and distributed systems research, with a focus on AI-to-AI communication patterns.