Skip to content

feat: add standalone agent CLI command#8891

Open
localai-bot wants to merge 3 commits intomudler:masterfrom
localai-bot:feat/standalone-agent-cli
Open

feat: add standalone agent CLI command#8891
localai-bot wants to merge 3 commits intomudler:masterfrom
localai-bot:feat/standalone-agent-cli

Conversation

@localai-bot
Copy link
Contributor

Summary

Implemented a new CLI command for running agents in standalone mode in LocalAI.

Changes

  • Added local-ai agent run <agent-name> command
  • Added local-ai agent run --config <path/to/agent.json> command
  • Agent registry lookup from Agent Hub
  • JSON configuration file parsing and validation
  • Standalone agent execution with signal handling
  • Comprehensive tests added
  • Documentation updated

Implementation

  • New files: core/cli/agent.go, core/cli/agent_test.go
  • Modified: core/cli/cli.go, docs/content/features/agents.md

This addresses the P0 task for standalone agent execution CLI in both LocalAI and LocalAGI repositories.

Closes task: 20260308_214118_p0_agent_standalone_cli

@netlify
Copy link

netlify bot commented Mar 9, 2026

Deploy Preview for localai ready!

Name Link
🔨 Latest commit dbf0d30
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/69b1f873351ec0000857efd9
😎 Deploy Preview https://deploy-preview-8891--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

return fmt.Errorf("failed to create agent %q: %w", agentConfig.Name, err)
}

xlog.Info("Agent started successfully", "name", agentConfig.Name)
Copy link
Owner

@mudler mudler Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optionally, if the user specifies a prompt, we will ask to the agent directly and exit. no background service

"github.com/mudler/LocalAGI/core/state"
)

func TestIsJSONFile(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests should be written with ginkgo as the others

// loadFromRegistry fetches an agent configuration from the agent hub registry.
func (a *AgentRunCMD) loadFromRegistry(name string) (*state.AgentConfig, error) {
hubURL := strings.TrimRight(a.AgentHubURL, "/")
endpoint := fmt.Sprintf("%s/api/agents/%s", hubURL, name)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no such endpoint . This is an example of URL of an agent: https://agenthub.localai.io/agents/OpenCodeAgent.json

@localai-bot
Copy link
Contributor Author

Fix Update Addressed

I've addressed the review feedback from @mudler:

Changes Made:

  1. Tests converted to ginkgo - now uses the project's ginkgo/gomega framework with proper // patterns
  2. Added ginkgo suite test - Created for ginkgo bootstrap
  3. Fixed agent registry URL - Changed to correct format: (matches https://agenthub.localai.io/agents/\<agent-name>.json)
  4. Added explanatory comment - Added comment at line 114-115 in explaining the prompt behavior

Commit:

    • fix(agent): address PR review feedback for standalone agent CLI

All changes have been pushed to the branch. Awaiting CI confirmation and further review.

localai-bot added a commit to localai-bot/LocalAI that referenced this pull request Mar 10, 2026
- Add --prompt flag to allow sending a prompt to the agent directly
- Add sendPrompt() method to handle HTTP request to agent
- AgentHub URL was already using correct format (/agents/%s.json)

Addresses PR review feedback for PR mudler#8891

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
localai-bot added a commit to localai-bot/LocalAI that referenced this pull request Mar 11, 2026
- Add --prompt flag to allow sending a prompt to the agent directly
- Add sendPrompt() method to handle HTTP request to agent
- AgentHub URL was already using correct format (/agents/%s.json)

Addresses PR review feedback for PR mudler#8891

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
@localai-bot localai-bot force-pushed the feat/standalone-agent-cli branch from 1447777 to 42e74fd Compare March 11, 2026 20:51
localai-bot and others added 3 commits March 11, 2026 23:16
- Add 'local-ai agent run' command for standalone agent execution
- Support running agents from JSON config file or agent registry lookup
- Add agent configuration parsing and validation
- Implement standalone agent execution with signal handling
- Add comprehensive tests
- Update documentation

Signed-off-by: claude-agent-1 <claude-agent-1@localai.io>
- Convert agent_test.go from standard Go testing to ginkgo/gomega framework
- Add cli_suite_test.go for ginkgo test runner
- Fix agent registry URL to use correct format: /agents/<name>.json
- Add comment explaining future prompt behavior (ask agent directly and exit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: claude-agent-1 <claude-agent-1@localai.io>
- Add --prompt flag to allow sending a prompt to the agent directly
- Add sendPrompt() method to handle HTTP request to agent
- AgentHub URL was already using correct format (/agents/%s.json)

Addresses PR review feedback for PR mudler#8891

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
Signed-off-by: claude-agent-1 <claude-agent-1@localai.io>
@localai-bot localai-bot force-pushed the feat/standalone-agent-cli branch from 42e74fd to dbf0d30 Compare March 11, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants