AgentM Chat

AgentM: Add or modify scripts that can be executed using the /api/scripts/:id API.

Script Editor
Select an existing script to edit or add a new one using the "Add New Script" button.
Script Command is required.

Understanding AgentM Scripts

Scripts in AgentM are powerful tools that allow you to define custom terminal commands for various tasks. When AgentM executes a script, it runs the command and captures the console output, which is then returned for further processing or analysis.

Creating Effective Scripts

When writing a script, you can use any valid terminal command. For added flexibility, you can include {{variable}} placeholders, which AgentM will replace with actual values during execution.

Example: Weather Forecast Script

Here's an example of an interesting script that AgentM could use:

curl wttr.in/{{city}}?format=3

This script fetches a concise weather forecast for a specified city. AgentM can call this script with different city names to get up-to-date weather information.

Tips for Script Writing

1. Keep commands concise and focused on a single task.

2. Use variables for dynamic inputs to make scripts more versatile.

3. Consider potential errors and how to handle them.

4. Test your scripts thoroughly to ensure they work as expected.

5. Provide a clear and concise usage description to help others understand how to use your script.

6. Define the expected variables in the Variables field to document the script's requirements.

Using the Description Field

The Description field allows you to provide a brief explanation of what AgentM can use your script for.

Defining Variables

Use the Variables field to specify any input parameters your script expects. Format it as a JSON object, e.g., { city: string, days?: number }. This helps AgentM know what inputs it needs to provide when running your script.