### Clone LocalAGI Repository and Setup Frontend Source: https://github.com/mudler/localagi/blob/main/README.md Steps to clone the repository, navigate to the frontend directory, install dependencies, build the frontend, and start the development server. ```bash git clone https://github.com/mudler/LocalAGI.git cd LocalAGI cd webui/react-ui # Install dependencies bun i # Compile frontend (the build directory needs to exist for the backend to start) bun run build # Start frontend development server bun run dev ``` -------------------------------- ### Clone Repository and Basic CPU Setup Source: https://github.com/mudler/localagi/blob/main/README.md Clone the LocalAGI repository and start the service using Docker Compose for CPU-only environments. ```bash # Clone the repository git clone https://github.com/mudler/LocalAGI cd LocalAGI # CPU setup (default) docker compose up ``` -------------------------------- ### Start LocalAGI Development Server with Environment Variables Source: https://github.com/mudler/localagi/blob/main/README.md Instructions to start the LocalAGI development server, including creating a state directory and setting essential environment variables for model configuration, API URLs, and service settings. ```bash cd LocalAGI # Create a "pool" directory for agent state mkdir pool # Set required environment variables export LOCALAGI_MODEL=gemma-3-4b-it-qat export LOCALAGI_MULTIMODAL_MODEL=moondream2-20250414 export LOCALAGI_IMAGE_MODEL=sd-1.5-ggml export LOCALAGI_LLM_API_URL=http://localai:8080 # Knowledge base is built-in; no separate LocalRecall service needed export LOCALAGI_STATE_DIR=./pool export LOCALAGI_TIMEOUT=5m export LOCALAGI_ENABLE_CONVERSATIONS_LOGGING=false export LOCALAGI_SSHBOX_URL=root:root@sshbox:22 # Start development server go run main.go ``` -------------------------------- ### NVIDIA GPU Setup with Custom Models Source: https://github.com/mudler/localagi/blob/main/README.md Advanced NVIDIA GPU setup allowing custom multimodal and image models to be specified. ```bash # NVIDIA GPU setup with custom multimodal and image models MODEL_NAME=gemma-3-12b-it \ MULTIMODAL_MODEL=moondream2-20250414 \ IMAGE_MODEL=flux.1-dev-ggml \ docker compose -f docker-compose.nvidia.yaml up ``` -------------------------------- ### AMD GPU Setup Source: https://github.com/mudler/localagi/blob/main/README.md Launch LocalAGI with AMD GPU support. ```bash # AMD GPU setup docker compose -f docker-compose.amd.yaml up ``` -------------------------------- ### Example Custom Action: Weather Information Source: https://github.com/mudler/localagi/blob/main/README.md A Go code example demonstrating a custom action to fetch weather information. It includes parsing parameters, making an API call, and formatting the response. Ensure you replace 'YOUR_API_KEY' with your actual OpenWeatherMap API key. ```go import ( "encoding/json" "fmt" "net/http" "io" ) type WeatherParams struct { City string `json:"city"` Country string `json:"country"` } type WeatherResponse struct { Main struct { Temp float64 `json:"temp"` Humidity int `json:"humidity"` } `json:"main"` Weather []struct { Description string `json:"description"` } `json:"weather"` } func Run(config map[string]interface{}) (string, map[string]interface{}, error) { // Parse parameters p := WeatherParams{} 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 } // Make API call to weather service url := fmt.Sprintf("http://api.openweathermap.org/data/2.5/weather?q=%s,%s&appid=YOUR_API_KEY&units=metric", p.City, p.Country) resp, err := http.Get(url) if err != nil { return "", map[string]interface{}{}, err } defer resp.Body.Close() body, err := io.ReadAll(resp.Body) if err != nil { return "", map[string]interface{}{}, err } var weather WeatherResponse if err := json.Unmarshal(body, &weather); err != nil { return "", map[string]interface{}{}, err } // Format response result := fmt.Sprintf("Weather in %s, %s: %.1f°C, %s, Humidity: %d%%", p.City, p.Country, weather.Main.Temp, weather.Weather[0].Description, weather.Main.Humidity) return result, map[string]interface{}{}, nil } func Definition() map[string][]string { return map[string][]string{ "city": []string{ "string", "The city name to get weather for", }, "country": []string{ "string", "The country code (e.g., US, UK, DE)", }, } } func RequiredFields() []string { return []string{"city", "country"} } ``` -------------------------------- ### NVIDIA GPU Setup Source: https://github.com/mudler/localagi/blob/main/README.md Use this command to set up LocalAGI with NVIDIA GPU acceleration. ```bash # NVIDIA GPU setup docker compose -f docker-compose.nvidia.yaml up ``` -------------------------------- ### Start with a Specific Model Source: https://github.com/mudler/localagi/blob/main/README.md Initiate LocalAGI with a predefined model by setting the MODEL_NAME environment variable. ```bash # Start with a specific model (see available models in models.localai.io, or localai.io to use any model in huggingface) MODEL_NAME=gemma-3-12b-it docker compose up ``` -------------------------------- ### Get All Agents Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves a list of all available agents. Use this endpoint to get an overview of your agents. ```bash curl -X GET "http://localhost:3000/api/agents" ``` -------------------------------- ### Intel GPU Setup Source: https://github.com/mudler/localagi/blob/main/README.md Configure LocalAGI for Intel GPUs, including Arc and integrated graphics. ```bash # Intel GPU setup (for Intel Arc and integrated GPUs) docker compose -f docker-compose.intel.yaml up ``` -------------------------------- ### Basic LocalAGI Agent Creation Source: https://github.com/mudler/localagi/blob/main/README.md Example of creating a single AI agent with basic configuration, including model, API details, system prompt, and character. ```go import ( "github.com/mudler/LocalAGI/core/agent" "github.com/mudler/LocalAGI/core/types" ) // Create a new agent with basic configuration agent, err := agent.New( agent.WithModel("gpt-4"), agent.WithLLMAPIURL("http://localhost:8080"), agent.WithLLMAPIKey("your-api-key"), agent.WithSystemPrompt("You are a helpful assistant."), agent.WithCharacter(agent.Character{ Name: "my-agent", }), agent.WithActions( // Add your custom actions here ), agent.WithStateFile("./state/my-agent.state.json"), agent.WithCharacterFile("./state/my-agent.character.json"), agent.WithTimeout("10m"), agent.EnableKnowledgeBase(), agent.EnableReasoning(), ) if err != nil { log.Fatal(err) } // Start the agent go func() { if err := agent.Run(); err != nil { log.Printf("Agent stopped: %v", err) } }() // Stop the agent when done agent.Stop() ``` -------------------------------- ### Advanced LocalAGI Agent Pool Management Source: https://github.com/mudler/localagi/blob/main/README.md Example demonstrating the creation and management of an agent pool for multiple agents, including configuration and lifecycle operations. ```go import ( "github.com/mudler/LocalAGI/core/state" "github.com/mudler/LocalAGI/core/types" ) // Create a new agent pool (call pool.SetRAGProvider(...) for knowledge base; see main.go) pool, err := state.NewAgentPool( "default-model", // default model name "default-multimodal-model", // default multimodal model "transcription-model", // default transcription model "en", // default transcription language "tts-model", // default TTS model "http://localhost:8080", // API URL "your-api-key", // API key "./state", // state directory func(config *AgentConfig) func(ctx context.Context, pool *AgentPool) []types.Action { // Define available actions for agents return func(ctx context.Context, pool *AgentPool) []types.Action { return []types.Action{ // Add your custom actions here } } }, func(config *AgentConfig) []Connector { // Define connectors for agents return []Connector{ // Add your custom connectors here } }, func(config *AgentConfig) []DynamicPrompt { // Define dynamic prompts for agents return []DynamicPrompt{ // Add your custom prompts here } }, func(config *AgentConfig) types.JobFilters { // Define job filters for agents return types.JobFilters{ // Add your custom filters here } }, "10m", // timeout true, // enable conversation logs nil, // skills service (optional) ) // Create a new agent in the pool agentConfig := &AgentConfig{ Name: "my-agent", Model: "gpt-4", SystemPrompt: "You are a helpful assistant.", EnableKnowledgeBase: true, EnableReasoning: true, // Add more configuration options as needed } err = pool.CreateAgent("my-agent", agentConfig) // Start all agents err = pool.StartAll() // Get agent status status := pool.GetStatusHistory("my-agent") // Stop an agent pool.Stop("my-agent") // Remove an agent err = pool.Remove("my-agent") ``` -------------------------------- ### Example Agent Configuration Structure Source: https://github.com/mudler/localagi/blob/main/README.md This JSON object illustrates the structure of an agent's configuration, defining its name, model, capabilities, and operational parameters. ```json { "name": "my-agent", "model": "gpt-4", "multimodal_model": "gpt-4-vision", "hud": true, "standalone_job": false, "random_identity": false, "initiate_conversations": true, "enable_planning": true, "identity_guidance": "You are a helpful assistant.", "periodic_runs": "0 * * * *", "permanent_goal": "Help users with their questions.", "enable_kb": true, "enable_reasoning": true, "kb_results": 5, "can_stop_itself": false, "system_prompt": "You are an AI assistant.", "long_term_memory": true, "summary_long_term_memory": false } ``` -------------------------------- ### Run NVIDIA GPU Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Use this command to run LocalAGI with NVIDIA GPU acceleration. Ensure you have NVIDIA drivers installed. ```bash docker compose -f docker-compose.nvidia.yaml up ``` -------------------------------- ### Get agent configuration metadata Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves metadata for agent configurations. ```APIDOC ## GET /api/meta/agent/config ### Description Get agent configuration metadata. ### Method GET ### Endpoint /api/meta/agent/config ``` -------------------------------- ### Get agent configuration Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves the configuration for a specific agent. ```APIDOC ## GET /api/agent/:name/config ### Description Get agent configuration. ### Method GET ### Endpoint /api/agent/:name/config ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent. ``` -------------------------------- ### Start Agent Source: https://github.com/mudler/localagi/blob/main/README.md Resumes a paused agent, allowing it to continue its activities. This is the counterpart to the pause agent endpoint. ```bash curl -X PUT "http://localhost:3000/api/agent/my-agent/start" ``` -------------------------------- ### Get Agent Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves the current configuration settings for a specific agent. This is useful for auditing or understanding agent parameters. ```bash curl -X GET "http://localhost:3000/api/agent/my-agent/config" ``` -------------------------------- ### Send message & get response Source: https://github.com/mudler/localagi/blob/main/README.md Sends a message to an agent and receives a response. ```APIDOC ## POST /api/chat/:name ### Description Send message & get response. ### Method POST ### Endpoint /api/chat/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to chat with. ### Request Body - **message** (string) - Required - The message to send to the agent. ``` -------------------------------- ### Send message & get response (v1) Source: https://github.com/mudler/localagi/blob/main/README.md Sends a message to an agent and receives a response, compatible with OpenAI's API format. ```APIDOC ## POST /v1/responses ### Description Send message & get response. This endpoint is compatible with OpenAI's Responses API. ### Method POST ### Endpoint /v1/responses ### Documentation See [OpenAI's Responses](https://platform.openai.com/docs/api-reference/responses/create) for request and response details. ``` -------------------------------- ### Get Agent Status Source: https://github.com/mudler/localagi/blob/main/README.md Fetches the status history for a specific agent. Useful for monitoring agent activity. ```bash curl -X GET "http://localhost:3000/api/agent/my-agent/status" ``` -------------------------------- ### Build and Run LocalAGI from Source Source: https://github.com/mudler/localagi/blob/main/README.md Steps to clone the repository, build the project using Go and Bun, and run the application. ```bash git clone https://github.com/mudler/LocalAGI.git cd LocalAGI # Build it cd webui/react-ui && bun i && bun run build cd ../.. go build -o localagi # Run it ./localagi ``` -------------------------------- ### Create Agent Source: https://github.com/mudler/localagi/blob/main/README.md Creates a new agent with specified configurations. Requires agent name, model, system prompt, and optional settings for knowledge base and reasoning. ```bash curl -X POST "http://localhost:3000/api/agent/create" \ -H "Content-Type: application/json" \ -d '{ "name": "my-agent", "model": "gpt-4", "system_prompt": "You are an AI assistant.", "enable_kb": true, "enable_reasoning": true }' ``` -------------------------------- ### Customize Intel GPU Models Source: https://github.com/mudler/localagi/blob/main/README.md Specify custom text, multimodal, and image models for Intel GPU acceleration using environment variables. ```bash MODEL_NAME=gemma-3-12b-it \ MULTIMODAL_MODEL=moondream2-20250414 \ IMAGE_MODEL=sd-1.5-ggml \ docker compose -f docker-compose.intel.yaml up ``` -------------------------------- ### Go File System Operations Source: https://github.com/mudler/localagi/blob/main/README.md This Go code handles reading, writing, and listing files. It expects a configuration map with 'path', 'action', and optional 'content' fields. ```go import ( "encoding/json" "fmt" "os" "path/filepath" ) type FileParams struct { Path string `json:"path"` Action string `json:"action"` Content string `json:"content,omitempty"` } func Run(config map[string]interface{}) (string, map[string]interface{}, error) { p := FileParams{} 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 } switch p.Action { case "read": content, err := os.ReadFile(p.Path) if err != nil { return "", map[string]interface{}{}, err } return string(content), map[string]interface{}{}, nil case "write": err := os.WriteFile(p.Path, []byte(p.Content), 0644) if err != nil { return "", map[string]interface{}{}, err } return fmt.Sprintf("Successfully wrote to %s", p.Path), map[string]interface{}{}, nil case "list": files, err := os.ReadDir(p.Path) if err != nil { return "", map[string]interface{}{}, err } var fileList []string for _, file := range files { fileList = append(fileList, file.Name()) } result, _ := json.Marshal(fileList) return string(result), map[string]interface{}{}, nil default: return "", map[string]interface{}{}, fmt.Errorf("unknown action: %s", p.Action) } } func Definition() map[string][]string { return map[string][]string{ "path": []string{ "string", "The file or directory path", }, "action": []string{ "string", "The action to perform: read, write, or list", }, "content": []string{ "string", "Content to write (required for write action)", }, } } func RequiredFields() []string { return []string{"path", "action"} } ``` -------------------------------- ### Customize NVIDIA GPU Models Source: https://github.com/mudler/localagi/blob/main/README.md Specify custom text, multimodal, and image models for NVIDIA GPU acceleration using environment variables. ```bash MODEL_NAME=gemma-3-12b-it \ MULTIMODAL_MODEL=moondream2-20250414 \ IMAGE_MODEL=flux.1-dev-ggml \ docker compose -f docker-compose.nvidia.yaml up ``` -------------------------------- ### Create a new agent Source: https://github.com/mudler/localagi/blob/main/README.md Creates a new agent with specified configurations. ```APIDOC ## POST /api/agent/create ### Description Create a new agent. ### Method POST ### Endpoint /api/agent/create ### Request Body - **name** (string) - Required - The name of the agent. - **model** (string) - Required - The model to be used by the agent. - **system_prompt** (string) - Required - The system prompt for the agent. - **enable_kb** (boolean) - Optional - Whether to enable knowledge base. - **enable_reasoning** (boolean) - Optional - Whether to enable reasoning. ``` -------------------------------- ### Run Intel GPU Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Use this command to run LocalAGI with Intel GPU acceleration. This is suitable for Intel Arc and integrated GPUs. ```bash docker compose -f docker-compose.intel.yaml up ``` -------------------------------- ### Import Agent Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Imports an agent configuration from a JSON file. This allows for restoring or setting up agents with predefined configurations. ```bash curl -X POST "http://localhost:3000/settings/import" \ -F "file=@/path/to/my-agent.json" ``` -------------------------------- ### List available actions Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves a list of all available actions that can be executed. ```APIDOC ## GET /api/actions ### Description List available actions. ### Method GET ### Endpoint /api/actions ``` -------------------------------- ### Customize CPU Model Source: https://github.com/mudler/localagi/blob/main/README.md Set the MODEL_NAME environment variable to specify a custom text model when running LocalAGI on CPU. ```bash MODEL_NAME=gemma-3-12b-it docker compose up ``` -------------------------------- ### Local MCP GitHub Server Configuration Source: https://github.com/mudler/localagi/blob/main/README.md This JSON configures a local MCP server for GitHub using Docker. Ensure the GITHUB_PERSONAL_ACCESS_TOKEN environment variable is set. ```json { "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "" } } } } ``` -------------------------------- ### Fetch Agent Configuration Metadata Source: https://github.com/mudler/localagi/blob/main/README.md Use this curl command to retrieve all available agent configuration fields, including their types and descriptions, from the metadata endpoint. ```bash curl -X GET "http://localhost:3000/api/meta/agent/config" ``` -------------------------------- ### Configure Slack Connector Source: https://github.com/mudler/localagi/blob/main/README.md Configure Slack with your bot token and app token. Obtain these from your Slack app's OAuth & Permissions and Basic Information settings. ```json { "botToken": "xoxb-your-bot-token", "appToken": "xapp-your-app-token" } ``` -------------------------------- ### Execute an action Source: https://github.com/mudler/localagi/blob/main/README.md Executes a specified action. ```APIDOC ## POST /api/action/:name/run ### Description Execute an action. ### Method POST ### Endpoint /api/action/:name/run ### Parameters #### Path Parameters - **name** (string) - Required - The name of the action to execute. ``` -------------------------------- ### Import agent config Source: https://github.com/mudler/localagi/blob/main/README.md Imports agent configuration from a file. ```APIDOC ## POST /settings/import ### Description Import agent config. ### Method POST ### Endpoint /settings/import ### Request Body - **file** (file) - Required - The agent configuration file to import. ``` -------------------------------- ### Configure GitHub Issues Connector Source: https://github.com/mudler/localagi/blob/main/README.md Provide your Personal Access Token, repository details, and bot username to monitor GitHub issues. ```json { "token": "YOUR_PAT_TOKEN", "repository": "repo-to-monitor", "owner": "repo-owner", "botUserName": "bot-username" } ``` -------------------------------- ### Customize Actions Directory Source: https://github.com/mudler/localagi/blob/main/README.md Use the LOCALAGI_CUSTOM_ACTIONS_DIR environment variable to point to a custom directory for actions when running LocalAGI. ```bash LOCALAGI_CUSTOM_ACTIONS_DIR=/app/custom-actions docker compose up ``` -------------------------------- ### Agent SSE Stream Source: https://github.com/mudler/localagi/blob/main/README.md Establishes a Server-Sent Events (SSE) stream for real-time agent events. Requires a client that natively supports SSE for proper handling. ```bash curl -N -X GET "http://localhost:3000/api/sse/my-agent" ``` -------------------------------- ### Configure IRC Connector Source: https://github.com/mudler/localagi/blob/main/README.md Connect to IRC networks by providing server details, nickname, and channel. The `alwaysReply` setting controls bot behavior. ```json { "server": "irc.example.com", "port": "6667", "nickname": "LocalAGIBot", "channel": "#yourchannel", "alwaysReply": "false" } ``` -------------------------------- ### Set Custom Actions Directory Environment Variable Source: https://github.com/mudler/localagi/blob/main/README.md Configure the environment variable to specify the directory for custom Go action files. This allows LocalAGI to automatically load your custom actions. ```bash export LOCALAGI_CUSTOM_ACTIONS_DIR="/path/to/custom/actions" ``` ```yaml environment: - LOCALAGI_CUSTOM_ACTIONS_DIR=/app/custom-actions ``` -------------------------------- ### List all available agents Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves a list of all agents currently available in the system. ```APIDOC ## GET /api/agents ### Description Lists all available agents. ### Method GET ### Endpoint /api/agents ``` -------------------------------- ### Login JavaScript Function Source: https://github.com/mudler/localagi/blob/main/webui/public/views/login.html Handles the login process by validating the access token and setting it as a cookie. Displays an error message if the token is empty. Focuses the input field and applies a shake animation on error. ```javascript function login() { var token = document.getElementById('token'); var errorMsg = document.getElementById('error-message'); var tokenValue = token.value.trim(); if (!tokenValue) { errorMsg.innerHTML = ' Please enter a valid token'; errorMsg.style.display = 'flex'; errorMsg.style.animation = 'none'; errorMsg.offsetHeight; errorMsg.style.animation = 'shake 0.4s ease-out'; token.focus(); return; } var date = new Date(); date.setTime(date.getTime() + (24 * 60 * 60 * 1000)); document.cookie = 'token=' + ``` -------------------------------- ### Configure Email Connector Source: https://github.com/mudler/localagi/blob/main/README.md Configure email integration with SMTP and IMAP server details, authentication credentials, and display name. Set `smtpInsecure` and `imapInsecure` to 'false' for TLS/SSL connections. ```json { "smtpServer": "smtp.gmail.com:587", "imapServer": "imap.gmail.com:993", "smtpInsecure": "false", "imapInsecure": "false", "username": "user@gmail.com", "email": "user@gmail.com", "password": "correct-horse-battery-staple", "name": "LogalAGI Agent" } ``` -------------------------------- ### Login Authentication JavaScript Source: https://github.com/mudler/localagi/blob/main/webui/views/login.html Handles user login by validating the access token, setting it as a cookie, and initiating a page reload upon successful authentication. It also provides visual feedback during the authentication process. ```javascript function login() { var token = document.getElementById('token'); var errorMsg = document.getElementById('error-message'); var tokenValue = token.value.trim(); if (!tokenValue) { errorMsg.innerHTML = ' Please enter a valid token'; errorMsg.style.display = 'flex'; errorMsg.style.animation = 'none'; errorMsg.offsetHeight; // Trigger reflow errorMsg.style.animation = 'shake 0.4s ease-out'; token.focus(); return; } var date = new Date(); date.setTime(date.getTime() + (24 * 60 * 60 * 1000)); // Expires in 24 hours document.cookie = 'token=' + tokenValue + '; expires=' + date.toGMTString() + '; path=/'; var button = document.querySelector('.login-button'); button.disabled = true; button.innerHTML = 'Authenticating...'; button.style.opacity = '0.8'; setTimeout(function() { window.location.reload(); }, 800); } ``` -------------------------------- ### Real-time agent event stream Source: https://github.com/mudler/localagi/blob/main/README.md Establishes a real-time stream of events from an agent. ```APIDOC ## GET /api/sse/:name ### Description Real-time agent event stream. For proper SSE handling, you should use a client that supports SSE natively. ### Method GET ### Endpoint /api/sse/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent. ``` -------------------------------- ### Create a new agent group Source: https://github.com/mudler/localagi/blob/main/README.md Creates a new group of agents. ```APIDOC ## POST /api/agent/group/create ### Description Create a new agent group. ### Method POST ### Endpoint /api/agent/group/create ``` -------------------------------- ### Export Agent Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Exports the configuration of a specific agent to a JSON file. This is useful for backup or migration purposes. ```bash curl -X GET "http://localhost:3000/settings/export/my-agent" --output my-agent.json ``` -------------------------------- ### Update Agent Configuration Source: https://github.com/mudler/localagi/blob/main/README.md Updates the configuration of an existing agent. Only specified fields like model or system prompt will be modified. ```bash curl -X PUT "http://localhost:3000/api/agent/my-agent/config" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "system_prompt": "You are an AI assistant." }' ``` -------------------------------- ### Configure Telegram Connector Source: https://github.com/mudler/localagi/blob/main/README.md Set up your Telegram bot token, and configure group mode, mention-only responses, and admin usernames. Ensure your bot can read messages in groups by disabling group privacy settings via BotFather. ```json { "token": "your-bot-father-token", "group_mode": "true", "mention_only": "true", "admins": "username1,username2" } ``` -------------------------------- ### Configure Discord Connector Source: https://github.com/mudler/localagi/blob/main/README.md Use your Discord bot token and optionally a default channel ID. Ensure 'Message Content Intent' is enabled in your bot's settings. ```json { "token": "Bot YOUR_DISCORD_TOKEN", "defaultChannel": "OPTIONAL_CHANNEL_ID" } ``` -------------------------------- ### Send Message to Agent Source: https://github.com/mudler/localagi/blob/main/README.md Sends a message to a specific agent and receives a response. This is the primary way to interact with agents for chat-like conversations. ```bash curl -X POST "http://localhost:3000/api/chat/my-agent" \ -H "Content-Type: application/json" \ -d '{"message": "Hello, how are you today?"}' ``` -------------------------------- ### Export agent config Source: https://github.com/mudler/localagi/blob/main/README.md Exports the configuration of a specified agent to a file. ```APIDOC ## GET /settings/export/:name ### Description Export agent config. ### Method GET ### Endpoint /settings/export/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to export. ``` -------------------------------- ### Generate group profiles Source: https://github.com/mudler/localagi/blob/main/README.md Generates profiles for an agent group. ```APIDOC ## POST /api/agent/group/generateProfiles ### Description Generate group profiles. ### Method POST ### Endpoint /api/agent/group/generateProfiles ``` -------------------------------- ### Send notification to agent Source: https://github.com/mudler/localagi/blob/main/README.md Sends a notification to a specified agent. ```APIDOC ## POST /api/notify/:name ### Description Send notification to agent. ### Method POST ### Endpoint /api/notify/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to notify. ### Request Body - **message** (string) - Required - The notification message. ``` -------------------------------- ### Resume a paused agent Source: https://github.com/mudler/localagi/blob/main/README.md Resumes the activities of a paused agent. ```APIDOC ## PUT /api/agent/:name/start ### Description Resume a paused agent. ### Method PUT ### Endpoint /api/agent/:name/start ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to resume. ``` -------------------------------- ### Real-time Clock Update JavaScript Source: https://github.com/mudler/localagi/blob/main/webui/views/login.html Updates an HTML element with the current UTC time every second. Ensures the time display is accurate and dynamic. ```javascript function updateCurrentTime() { var timeElement = document.getElementById('current-time'); if (timeElement) { var now = new Date(); var year = now.getUTCFullYear(); var month = String(now.getUTCMonth() + 1).padStart(2, '0'); var day = String(now.getUTCDate()).padStart(2, '0'); var hours = String(now.getUTCHours()).padStart(2, '0'); var minutes = String(now.getUTCMinutes()).padStart(2, '0'); var seconds = String(now.getUTCSeconds()).padStart(2, '0'); timeElement.textContent = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; } } updateCurrentTime(); setInterval(updateCurrentTime, 1000); ``` -------------------------------- ### Update agent configuration Source: https://github.com/mudler/localagi/blob/main/README.md Updates the configuration of a specific agent. ```APIDOC ## PUT /api/agent/:name/config ### Description Update agent configuration. ### Method PUT ### Endpoint /api/agent/:name/config ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent. ### Request Body - **model** (string) - Optional - The new model for the agent. - **system_prompt** (string) - Optional - The new system prompt for the agent. ``` -------------------------------- ### Notify Agent Source: https://github.com/mudler/localagi/blob/main/README.md Sends a notification to a specific agent. This is useful for alerting agents to important events or information. ```bash curl -X POST "http://localhost:3000/api/notify/my-agent" \ -H "Content-Type: application/json" \ -d '{"message": "Important notification"}' ``` -------------------------------- ### Disable Login Button and Show Spinner Source: https://github.com/mudler/localagi/blob/main/webui/public/views/login.html Disables the login button, displays a spinning icon and 'Authenticating...' text, and then reloads the page after a short delay. This is used to provide visual feedback during the authentication process. ```javascript var button = document.querySelector('.login-button'); button.disabled = true; button.innerHTML = 'Authenticating...'; button.style.opacity = '0.8'; setTimeout(function() { window.location.reload(); }, 800); ``` -------------------------------- ### Pause Agent Source: https://github.com/mudler/localagi/blob/main/README.md Pauses the activities of a specific agent. The agent can be resumed later. ```bash curl -X PUT "http://localhost:3000/api/agent/my-agent/pause" ``` -------------------------------- ### Update and Display Current UTC Time Source: https://github.com/mudler/localagi/blob/main/webui/public/views/login.html Fetches the current UTC date and time and formats it as 'YYYY-MM-DD HH:MM:SS'. The time is updated every second to keep it current. This function is called once on load and then set to repeat. ```javascript function updateCurrentTime() { var timeElement = document.getElementById('current-time'); if (timeElement) { var now = new Date(); var year = now.getUTCFullYear(); var month = String(now.getUTCMonth() + 1).padStart(2, '0'); var day = String(now.getUTCDate()).padStart(2, '0'); var hours = String(now.getUTCHours()).padStart(2, '0'); var minutes = String(now.getUTCMinutes()).padStart(2, '0'); var seconds = String(now.getUTCSeconds()).padStart(2, '0'); timeElement.textContent = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; } } updateCurrentTime(); setInterval(updateCurrentTime, 1000); ``` -------------------------------- ### Pause agent activities Source: https://github.com/mudler/localagi/blob/main/README.md Pauses the activities of a specified agent. ```APIDOC ## PUT /api/agent/:name/pause ### Description Pause agent activities. ### Method PUT ### Endpoint /api/agent/:name/pause ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to pause. ``` -------------------------------- ### View agent status history Source: https://github.com/mudler/localagi/blob/main/README.md Retrieves the status history for a specific agent. ```APIDOC ## GET /api/agent/:name/status ### Description View agent status history. ### Method GET ### Endpoint /api/agent/:name/status ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent. ``` -------------------------------- ### Delete Agent Source: https://github.com/mudler/localagi/blob/main/README.md Removes an agent from the system. Use with caution as this action is irreversible. ```bash curl -X DELETE "http://localhost:3000/api/agent/my-agent" ``` -------------------------------- ### Remove an agent Source: https://github.com/mudler/localagi/blob/main/README.md Deletes an agent from the system. ```APIDOC ## DELETE /api/agent/:name ### Description Remove an agent. ### Method DELETE ### Endpoint /api/agent/:name ### Parameters #### Path Parameters - **name** (string) - Required - The name of the agent to remove. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.