Back to Localai

Agent Task Details

core/http/views/agent-task-details.html

4.1.35.3 KB
Original Source

Execute Edit Delete

Cancel Save Back

Basic Information

Name *

Description

Model *Select a model with MCP configuration... {{ range .ModelsConfig }} {{ $cfg := . }} {{ $hasMCP := or (ne $cfg.MCP.Servers "") (ne $cfg.MCP.Stdio "") }} {{ if $hasMCP }} {{$cfg.Name}} {{ end }} {{ end }}

Only models with MCP configuration are shown

Enabled

Prompt Template

Prompt *

Use Go template syntax with {{"{{"}}.param{{"}}"}} for dynamic parameters. Parameters are provided when executing the job and will be substituted into the prompt.

Example Prompt:

You are a helpful assistant. The user's name is {{"{{"}}.user_name{{"}}"}} and they work as a {{"{{"}}.job_title{{"}}"}}.

Please help them with the following task: {{"{{"}}.task_description{{"}}"}}

Provide a detailed response that addresses their specific needs.

The prompt will be processed as a Go template. All parameters passed during job execution will be available as template variables.

Cron Schedule (Optional)

Cron Expression

Standard 5-field cron format (minute hour day month weekday)

Cron Parameters (Optional)

Parameters to use when executing jobs triggered by cron. These will be used to template the prompt. Enter as key-value pairs (one per line, format: key=value).

Example: user_name=Alice

Multimedia Sources (Optional)

Configure multimedia sources (images, videos, audios, files) to fetch when cron jobs execute. Each source can have custom headers for authentication/authorization. These will be fetched and included in the job execution.

Multimedia Source

Type *Select type...ImageVideoAudioFile

URL *

URL where multimedia content will be fetched from

Headers (JSON)

Custom headers for the HTTP request (e.g., Authorization)

Add Multimedia Source

Webhooks (Optional)

Configure webhook URLs to receive notifications when jobs complete. You can add multiple webhooks, each with custom headers and HTTP methods.

Webhook

URL *

URL where webhook notifications will be sent

HTTP MethodPOSTPUTPATCH

Headers (JSON)

Custom headers for the webhook request (e.g., Authorization)

Custom Payload Template (Optional)

Customize the webhook payload using Go template syntax. Available variables: .Job, .Task, .Result, .Error, .Status

Note: .Error will be empty string if job succeeded, or contain the error message if it failed. Use this to handle both success and failure cases in a single webhook.

Example (Slack with error handling):

{
  "text": "Job {{.Job.ID}} {{if .Error}}failed{{else}}completed{{end}}",
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "*Task:* {{.Task.Name}}\n*Status:* {{.Status}}\n{{if .Error}}*Error:* {{.Error}}{{else}}*Result:* {{.Result}}{{end}}"
      }
    }
  ]
}

Add Webhook

Task Information

Name

Status

Model

Cron Schedule

Cron Parameters

Description

Prompt Template

API Usage Examples

Use these curl commands to interact with this task programmatically.

Execute Task by ID

curl -X POST {{ .BaseURL }}api/agent/jobs/execute \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "task_id": "",
    "parameters": {
      "user_name": "Alice",
      "job_title": "Software Engineer",
      "task_description": "Review code changes"
    }
  }'

Execute Task by Name

curl -X POST {{ .BaseURL }}api/agent/tasks//execute \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "user_name": "Bob",
    "job_title": "Data Scientist",
    "task_description": "Analyze sales data"
  }'

The request body should be a JSON object where keys are parameter names and values are strings. If no body is provided, the task will execute with empty parameters.

Execute Task with Multimedia (Images)

curl -X POST {{ .BaseURL }}api/agent/jobs/execute \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "task_id": "",
    "parameters": {
      "user_name": "Alice",
      "task_description": "Analyze this image"
    },
    "images": [
      "https://example.com/image.png",
      "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="
    ]
  }'

You can provide multimedia content as URLs or base64-encoded data URIs. Supported types: images, videos, audios, and files.

Check Job Status

curl -X GET {{ .BaseURL }}api/agent/jobs/JOB_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

After executing a task, you will receive a job_id in the response. Use it to query the job's status and results.

Webhook Configuration

Webhook

URL

Method

Headers

Payload Template

Job History

All StatusPendingRunningCompletedFailedCancelledClear History

Job IDStatusCreatedTriggered ByActions
No jobs found for this task

Execute Task

Task

Parameters Multimedia

Parameters

Enter parameters as key-value pairs (one per line, format: key=value). These will be used to template the prompt.

Example: user_name=Alice

Provide multimedia content as URLs or base64-encoded data URIs. You can also upload files which will be converted to base64.

Images

Videos

Audios

Files

Cancel Execute

{{template "views/partials/footer" .}}