feat/inter-agent-communication #10

Merged
JohnCosta27 merged 9 commits from feat/inter-agent-communication into main 2025-04-17 17:51:57 +01:00
9 changed files with 221 additions and 176 deletions
Showing only changes of commit 8fff043849 - Show all commits

View File

@ -182,7 +182,7 @@ func (client AgentClient) Request(req *AgentRequestBody) (AgentResponse, error)
return agentResponse, nil return agentResponse, nil
} }
func (client AgentClient) ToolLoop(info ToolHandlerInfo, req *AgentRequestBody) error { func (client *AgentClient) ToolLoop(info ToolHandlerInfo, req *AgentRequestBody) error {
for { for {
err := client.Process(info, req) err := client.Process(info, req)
if err != nil { if err != nil {
@ -235,7 +235,7 @@ func (client *AgentClient) Process(info ToolHandlerInfo, req *AgentRequestBody)
return err return err
} }
func (client AgentClient) RunAgent(userId uuid.UUID, imageId uuid.UUID, imageName string, imageData []byte) error { func (client *AgentClient) RunAgent(userId uuid.UUID, imageId uuid.UUID, imageName string, imageData []byte) error {
var tools any var tools any
err := json.Unmarshal([]byte(client.Options.JsonTools), &tools) err := json.Unmarshal([]byte(client.Options.JsonTools), &tools)

View File

@ -65,7 +65,12 @@ const eventTools = `
"endDateTime": { "endDateTime": {
"type": "string", "type": "string",
"description": "The end time as an ISO string" "description": "The end time as an ISO string"
} },
"locationId": {
"type": "string",
"description": "The UUID of this location. You should use getEventLocationId to get this information, but only if you believe the event contains a location"
}
}, },
"required": ["name"] "required": ["name"]
} }
@ -185,6 +190,7 @@ func NewEventAgent(log *log.Logger, eventsModel models.EventModel, locationModel
// TODO: reenable this when I'm creating the agent locally instead of getting it from above. // TODO: reenable this when I'm creating the agent locally instead of getting it from above.
locationAgent.RunAgent(info.UserId, info.ImageId, info.ImageName, *info.Image) locationAgent.RunAgent(info.UserId, info.ImageId, info.ImageName, *info.Image)
log.Debugf("Reply from location %s\n", locationAgent.Reply)
return locationAgent.Reply, nil return locationAgent.Reply, nil
}) })

View File

@ -161,7 +161,6 @@ func NewLocationAgent(log *log.Logger, locationModel models.LocationModel) clien
}) })
agentClient.ToolHandler.AddTool("reply", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) { agentClient.ToolHandler.AddTool("reply", func(info client.ToolHandlerInfo, args string, call client.ToolCall) (any, error) {
agentClient.Log.Debug(args)
return "ok", nil return "ok", nil
}) })