mudler / mudler/LocalAGI

0-parameter actions such as list_memory and list_reminders cause tool calling to break

Open
#362 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2k
Forks
291
Avg merge
30m
Merged PRs (30d)
3

Description

0-parameter actions such as list_memory and list_reminders in the LocalAGI agent settings / actions tab cause tool calling to break the vast majority of the time with most models. In my testing I have only seen the tool call executed successfully once. I found a workaround for the list_memory by creating this custom action with a corresponding configuration matching the agent name + ".json" - this replicates the naming scheme used by add_memory and remove_memory actions. I don't have the appropriate development environment to test and PR a proper fix for memory.go but here is the workaround custom script for reference:

import (
    "encoding/json"
    "fmt"
    "os"
    "io"
    "path/filepath"
)

var filePath string

type ListMemoryParams struct {
    Confirm bool `json:"confirm"`  // Dummy required parameter
}

func Init(configuration string) error {
    // Store the configuration that was passed in
    filePath = configuration
    return nil
}

func Run(config map[string]interface{}) (string, map[string]interface{}, error) {
    p := ListMemoryParams{}
    b, err := json.Marshal(config)
    if err != nil {
        return "", map[string]interface{}{}, err
    }
    if err := json.Unmarshal(b, &p); err != nil {
        return "", map[string]interface{}{}, err
    }
    
    memoryFile := os.Getenv("LOCALAGI_STATE_DIR") + "/memory/" + filePath
    
    f, err := os.Open(memoryFile)
    if err != nil {
        return "", map[string]interface{}{}, err
    }
    defer f.Close()
    
    data, err := io.ReadAll(f)
    if err != nil {
        return "", map[string]interface{}{}, err
    }
    
    if len(data) == 0 {
        return "Memory is empty", map[string]interface{}{"count": 0}, nil
    }
    
    var items []string
    if err := json.Unmarshal(data, &items); err != nil {
        return "", map[string]interface{}{}, err
    }
    
    result := fmt.Sprintf("Memory contains %d item(s):\n", len(items))
    for i, item := range items {
        result += fmt.Sprintf("%d. %s\n", i, item)
    }
    
    return result, map[string]interface{}{
        "count": len(items),
        "items": items,
    }, nil
}

func Definition() map[string][]string {
    return map[string][]string{
        "confirm": []string{
            "boolean",
            "Set to true to list memory contents",
        },
    }
}

func RequiredFields() []string {
    return []string{"confirm"}  // Make it required
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting memory.go and the action definitions for list_memory and list_reminders, then reproduce tool calls with these zero-parameter actions across the affected models. Compare their behavior with the custom action workaround described in the issue. Done means both actions can be called reliably without requiring a dummy parameter.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ai, api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.