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.
- Make sure docker and docker compose plugin are installed:
sudo apt install docker-ce docker-compose-plugin
- install SymphonAI using pip
pip3 install git+https://github.com/svenschultze/symphonai
- (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"
- Set up a new Project
mkdir myproject
cd myproject
sym setup
- Create new nodes sender and receiver in environment python3
sym create sender python3
sym create receiver python3
- 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;
}
- Build your environments
sym build
- 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)
- Start your system
sym run
To generate documentation for all .proto files, run:
sym docs
This will create documentation html files in mypackage/docs/nodename