https://github.com/valeryverkhoturov/multiagent-golang
Multi-agents LLM-agnostic framework based on layered parallel communication of agents
https://github.com/valeryverkhoturov/multiagent-golang
agent ai ai-agents aiagentframework llms
Last synced: about 1 month ago
JSON representation
Multi-agents LLM-agnostic framework based on layered parallel communication of agents
- Host: GitHub
- URL: https://github.com/valeryverkhoturov/multiagent-golang
- Owner: ValeryVerkhoturov
- License: mit
- Created: 2025-03-08T16:25:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T18:55:21.000Z (about 1 year ago)
- Last Synced: 2025-12-31T08:20:45.458Z (5 months ago)
- Topics: agent, ai, ai-agents, aiagentframework, llms
- Language: Go
- Homepage: https://pkg.go.dev/github.com/ValeryVerkhoturov/multiagent-golang
- Size: 104 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Multi-agents framework for LLM based on layered communication
## Installation
```shell
go get -u github.com/ValeryVerkhoturov/multiagent-golang
```
## Example
### Code
```go
package main
import (
"fmt"
"time"
"github.com/ValeryVerkhoturov/multiagent-golang"
)
func createCrew() (*multiagent.Crew, error) {
crew := multiagent.NewCrew()
agents := []struct {
Name string
Function func(input string, tasks []*multiagent.Task) string
}{
{
Name: "Agent1",
Function: func(input string, tasks []*multiagent.Task) string {
time.Sleep(1 * time.Second)
return "Processed by Agent1: " + input
},
},
{
Name: "Agent2",
Function: func(input string, tasks []*multiagent.Task) string {
time.Sleep(2 * time.Second)
return "Processed by Agent2: " + input
},
},
}
for _, agent := range agents {
crew.AddAgent(&multiagent.Agent{
Name: agent.Name,
Function: agent.Function,
})
}
tasks := []struct {
Name string
Description string
AgentName string
Dependencies []string
}{
{"Task1", "Data for Task1", "Agent1", []string{}},
{"Task2", "Data for Task2", "Agent2", []string{}},
{"Task3", "Data for Task3", "Agent2", []string{}},
{"Task4", "Data for Task4", "Agent1", []string{"Task1", "Task2"}},
{"Task5", "Data for Task5", "Agent1", []string{"Task3", "Task4"}},
}
for _, task := range tasks {
t := &multiagent.Task{
Name: task.Name,
Description: task.Description,
}
if err := crew.AddTask(t, task.AgentName, task.Dependencies); err != nil {
return nil, fmt.Errorf("error adding %s: %v", task.Name, err)
}
}
return crew, nil
}
func main() {
crew, err := createCrew()
if err != nil {
println(err.Error())
return
}
println("Executing tasks...")
start := time.Now()
crew.Kickoff()
elapsed := time.Since(start)
fmt.Printf("All tasks completed in %s\n", elapsed)
for _, task := range crew.Tasks {
fmt.Printf("%s output: %s\n", task.Name, *task.GetOutput())
}
}
```
### Output
```text
Executing tasks...
All tasks completed in 4.002615625s
Task3 output: Processed by Agent2: Data for Task3
Task4 output: Processed by Agent1: Data for Task4
Task5 output: Processed by Agent1: Data for Task5
Task1 output: Processed by Agent1: Data for Task1
Task2 output: Processed by Agent2: Data for Task2
```
## Paper
