feat(planning): enable agent planning (#68)

* feat(planning): Allow the agent to plan subtasks

Signed-off-by: mudler <mudler@localai.io>

* feat(planning): enable planning toggle in the webui

Signed-off-by: mudler <mudler@localai.io>

* feat(planning): take in consideration the overall goal

Signed-off-by: mudler <mudler@localai.io>

* Update core/action/plan.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Signed-off-by: mudler <mudler@localai.io>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Ettore Di Giacinto
2025-03-21 12:28:11 +01:00
committed by GitHub
parent 638eedc2a0
commit 33483ab4b9
37 changed files with 259 additions and 35 deletions

View File

@@ -66,3 +66,7 @@ func (a *BrowseAction) Definition() action.ActionDefinition {
Required: []string{"url"},
}
}
func (a *BrowseAction) Plannable() bool {
return true
}

View File

@@ -85,3 +85,7 @@ func (a *CallAgentAction) Definition() action.ActionDefinition {
Required: []string{"agent_name", "message"},
}
}
func (a *CallAgentAction) Plannable() bool {
return true
}

View File

@@ -44,7 +44,7 @@ func (a *CounterAction) Run(ctx context.Context, params action.ActionParams) (ac
// Get current value or initialize if it doesn't exist
currentValue, exists := a.counters[request.Name]
// Update the counter
newValue := currentValue + request.Adjustment
a.counters[request.Name] = newValue
@@ -93,3 +93,6 @@ func (a *CounterAction) Definition() action.ActionDefinition {
}
}
func (a *CounterAction) Plannable() bool {
return true
}

View File

@@ -92,3 +92,7 @@ func (a *GenImageAction) Definition() action.ActionDefinition {
Required: []string{"prompt"},
}
}
func (a *GenImageAction) Plannable() bool {
return true
}

View File

@@ -116,3 +116,7 @@ func (g *GithubIssuesCloser) Definition() action.ActionDefinition {
Required: []string{"issue_number", "repository", "owner"},
}
}
func (a *GithubIssuesCloser) Plannable() bool {
return true
}

View File

@@ -103,3 +103,7 @@ func (g *GithubIssuesCommenter) Definition() action.ActionDefinition {
Required: []string{"issue_number", "repository", "owner", "comment"},
}
}
func (a *GithubIssuesCommenter) Plannable() bool {
return true
}

View File

@@ -118,3 +118,7 @@ func (g *GithubIssuesLabeler) Definition() action.ActionDefinition {
Required: []string{"issue_number", "repository", "owner", "label"},
}
}
func (a *GithubIssuesLabeler) Plannable() bool {
return true
}

View File

@@ -109,3 +109,7 @@ func (g *GithubIssuesOpener) Definition() action.ActionDefinition {
Required: []string{"title", "text", "owner", "repository"},
}
}
func (a *GithubIssuesOpener) Plannable() bool {
return true
}

View File

@@ -97,3 +97,7 @@ func (g *GithubIssuesReader) Definition() action.ActionDefinition {
Required: []string{"issue_number", "repository", "owner"},
}
}
func (a *GithubIssuesReader) Plannable() bool {
return true
}

View File

@@ -106,3 +106,7 @@ func (g *GithubIssueSearch) Definition() action.ActionDefinition {
Required: []string{"query", "repository", "owner"},
}
}
func (a *GithubIssueSearch) Plannable() bool {
return true
}

View File

@@ -142,3 +142,7 @@ func (g *GithubRepositoryCreateOrUpdateContent) Definition() action.ActionDefini
Required: []string{"path", "repository", "owner", "content"},
}
}
func (a *GithubRepositoryCreateOrUpdateContent) Plannable() bool {
return true
}

View File

@@ -107,3 +107,7 @@ func (g *GithubRepositoryGetContent) Definition() action.ActionDefinition {
Required: []string{"path", "repository", "owner"},
}
}
func (a *GithubRepositoryGetContent) Plannable() bool {
return true
}

View File

@@ -73,3 +73,7 @@ func (g *GithubRepositoryREADME) Definition() action.ActionDefinition {
Required: []string{"repository", "owner"},
}
}
func (a *GithubRepositoryREADME) Plannable() bool {
return true
}

View File

@@ -54,3 +54,7 @@ func (a *ScraperAction) Definition() action.ActionDefinition {
Required: []string{"url"},
}
}
func (a *ScraperAction) Plannable() bool {
return true
}

View File

@@ -85,3 +85,7 @@ func (a *SearchAction) Definition() action.ActionDefinition {
Required: []string{"query"},
}
}
func (a *SearchAction) Plannable() bool {
return true
}

View File

@@ -76,3 +76,7 @@ func (a *SendMailAction) Definition() action.ActionDefinition {
Required: []string{"to", "subject", "message"},
}
}
func (a *SendMailAction) Plannable() bool {
return true
}

View File

@@ -134,3 +134,7 @@ func sshCommand(privateKey, command, user, host string) (string, error) {
return string(output), nil
}
func (a *ShellAction) Plannable() bool {
return true
}

View File

@@ -58,3 +58,7 @@ func (a *PostTweetAction) Definition() action.ActionDefinition {
Required: []string{"text"},
}
}
func (a *PostTweetAction) Plannable() bool {
return true
}

View File

@@ -48,3 +48,7 @@ func (a *WikipediaAction) Definition() action.ActionDefinition {
Required: []string{"query"},
}
}
func (a *WikipediaAction) Plannable() bool {
return true
}