Skip to content

A tool to build and run dockerized nodes connected with gRPC in a clear project structure.

License

Notifications You must be signed in to change notification settings

svenschultze/SymphonAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SymphonAI

SymphonAI is a container intercommunication framework based on gRPC and docker compose that makes it easy to orchestrate AI pipelines or complex structures of multi-agent systems.

Installation

  1. Make sure docker and docker compose plugin are installed:
sudo apt install docker-ce docker-compose-plugin
  1. install SymphonAI using pip
pip3 install git+https://github.com/svenschultze/symphonai
  1. (OPTIONAL) You may need to add ~/.local/bin to you path by adding this line to your ~/.bashrc and restarting your shell
export PATH="$HOME/.local/bin:$PATH"

Usage

  1. Set up a new Project
mkdir myproject
cd myproject
sym setup
  1. Create new nodes sender and receiver in environment python3
sym create sender python3
sym create receiver python3
  1. Define the open procedures using the gRPC protobuffer format for each node. Only the node where the procedure is served needs to have to corresponding proto file.

myproject/src/receiver/proto/receive.proto

syntax = "proto3";

service Hello {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}
  1. Build your environments
sym build
  1. Now, setup the method and call in the node.py files:

myproject/src/receiver/node.py

import sym

@sym.method("Hello")
def SayHello(name):
    print("Received hello from", name)
    return {
        "message": f"Hello {name}!"
    }

sym.serve()

myproject/src/sender/node.py

import sym
import time

SayHello = sym.call("receiver", "Hello", "SayHello")

while True:
  time.sleep(1)
  result = SayHello(name="Sender")
  print(result)
  1. Start your system
sym run

Generating Documentation

To generate documentation for all .proto files, run:

sym docs

This will create documentation html files in mypackage/docs/nodename

About

A tool to build and run dockerized nodes connected with gRPC in a clear project structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages