Handoff does not appear to continue the conversation with the new agent, or if it does, it seems to get dropped somewhere and whatever the last message is comes from the original agent rather than the one being handed off to.
For example, I tried the example provided in the example folder:
package main
import (
"context"
"fmt"
"log"
"os"
dotenv "github.com/joho/godotenv"
swarmgo "github.com/prathyushnallamothu/swarmgo"
"github.com/prathyushnallamothu/swarmgo/llm"
)
func transferToSpanishAgent(args map[string]interface{}, contextVariables map[string]interface{}) swarmgo.Result {
spanishAgent := &swarmgo.Agent{
Name: "SpanishAgent",
Instructions: "You only speak Spanish.",
Model: "gpt-4",
}
return swarmgo.Result{
Agent: spanishAgent,
Data: "Transferring to Spanish Agent.",
}
}
func main() {
dotenv.Load()
client := swarmgo.NewSwarm(os.Getenv("OPENAI_API_KEY"), llm.OpenAI)
englishAgent := &swarmgo.Agent{
Name: "EnglishAgent",
Instructions: "You only speak English.",
Functions: []swarmgo.AgentFunction{
{
Name: "transferToSpanishAgent",
Description: "Transfer Spanish-speaking users immediately.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{},
},
Function: transferToSpanishAgent,
},
},
Model: "gpt-4",
}
messages := []llm.Message{
{Role: "user", Content: "Hola. ¿Cómo estás?"},
}
ctx := context.Background()
response, err := client.Run(ctx, englishAgent, messages, nil, "", false, false, 5, true)
if err != nil {
log.Fatalf("Error: %v", err)
}
fmt.Printf("%s: %s\n", response.Agent.Name, response.Messages[len(response.Messages)-1].Content)
}
When using a debugger, here is the what the response messages look like:
This seems to happen across the board, and the response I'm expecting doesn't show up, and instead it seems to look like a response that would come from the original agent doing the handoff.
Handoff does not appear to continue the conversation with the new agent, or if it does, it seems to get dropped somewhere and whatever the last message is comes from the original agent rather than the one being handed off to.
For example, I tried the example provided in the example folder:
When using a debugger, here is the what the response messages look like:
This seems to happen across the board, and the response I'm expecting doesn't show up, and instead it seems to look like a response that would come from the original agent doing the handoff.