Skip to content

feat: Add standalone agent run mode inspired by LocalAGI#8974

Open
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:task-8960-standalone-agent-mode
Open

feat: Add standalone agent run mode inspired by LocalAGI#8974
localai-bot wants to merge 1 commit intomudler:masterfrom
localai-bot:task-8960-standalone-agent-mode

Conversation

@localai-bot
Copy link
Contributor

Add standalone agent run mode

This PR adds support for running agents in standalone mode, similar to LocalAGI's agent run command.

Features

  • local-ai agent run <agent_name>: Run an agent by its ID from the registry
  • local-ai agent run --config <file>: Run an agent from a JSON config file
  • local-ai agent run <agent_name> --prompt "...": Foreground mode with single prompt
  • Interactive mode: Continuous interaction with the agent

Implementation Details

  • Added new AgentCMD struct in core/cli/agent.go
  • Registered the agent subcommand in core/cli/cli.go
  • Integrates with existing AgentPoolService for agent management
  • Supports all existing agent pool configuration options

Usage Examples

# Run an agent by name
local-ai agent run my-agent

# Run an agent with a single prompt
local-ai agent run my-agent --prompt "Analyze this text"

# Run an agent from a config file
local-ai agent run --config agent-config.json

# Run in interactive mode (default)
local-ai agent run my-agent
> Your prompt here

Related

Fixes #8960

@netlify
Copy link

netlify bot commented Mar 12, 2026

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 442815d
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/69b4e10708e3f20008ae9588
😎 Deploy Preview https://deploy-preview-8974--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.

@localai-bot localai-bot moved this from Todo to In review in LocalAI Agent team Mar 12, 2026
@localai-bot localai-bot force-pushed the task-8960-standalone-agent-mode branch from c8ad4b5 to af845bf Compare March 12, 2026 12:47
@localai-bot
Copy link
Contributor Author

Fixed DCO issue by amending commit with proper author information. CI checks should now be re-run.

- Fixed build errors by removing incorrect CreateAgent usage
- Now uses Chat API for agent interaction in standalone mode
- Supports running agents by ID or from config file
- Added interactive mode with --prompt flag support
@localai-bot localai-bot force-pushed the task-8960-standalone-agent-mode branch from af845bf to 442815d Compare March 14, 2026 04:16
@localai-bot
Copy link
Contributor Author

Fix Applied - Build Errors Resolved

I've fixed the build errors in this PR:

Issues Fixed:

  1. Removed incorrect CreateAgent usage: The original code tried to use with the wrong config type ( instead of )
  2. Removed incorrect manager.Run() calls: The interface doesn't have a method
  3. Removed unused import: Cleaned up the unused import

Solution:

  • Now using the API for agent interaction in standalone mode
  • This approach is simpler and works with the existing AgentPoolService implementation
  • The agent configuration is still validated and the agent ID is extracted from the config

Build Status:

The code now compiles successfully. CI checks should pass after re-running.

Functionality:

The standalone agent run mode still provides:

  • Running agents by ID:
  • Running agents from config:
  • Interactive mode with prompts
  • Support for the --prompt flag for single-prompt execution

Please re-run CI checks. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Add standalone agent run mode inspired by LocalAGI

1 participant