bot_task

package
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

README

Generic Bot Task ingress

POST /v1/internal/bot-tasks accepts source-authenticated work for an active User Bot and enqueues the fixed bot_task event consumed by Octo channel plugins. The server treats source, task_type, prompt, context, and metadata as business-neutral transport data.

Configure sources with OCTO_BOT_TASK_SOURCES:

{
  "loop": {
    "token": "",
    "enabled": true,
    "allowed_bot_uids": ["bot-uid"]
  }
}

Each source must have a unique token of at least 32 bytes. An empty or invalid registry disables ingress. allowed_bot_uids should list explicit Bot IDs; "*" permits that source to address every active Bot across all Spaces and should only be used in controlled development environments.

The endpoint authenticates the bearer token before reading the request body. The authenticated source must match the body source; one source cannot spend another source's quota or submit tasks under its name.

Two rate-limit layers protect the endpoint:

  • A strict per-IP floor defaults to 100 requests/second with a burst of 200. Configure it with DM_BOT_TASK_IP_RPS and DM_BOT_TASK_IP_BURST.
  • A Redis-backed per-source quota defaults to 20 requests/second with a burst of 60. Configure it with DM_BOT_TASK_SOURCE_RPS and DM_BOT_TASK_SOURCE_BURST.

Each process also keeps the same per-source token bucket locally. It remains active when Redis is unavailable, so a Redis outage degrades cluster-wide coordination without making the authenticated ingress unbounded.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BotTask

type BotTask struct {
	log.Log
	// contains filtered or unexported fields
}

func New

func New(ctx *config.Context) *BotTask

func (*BotTask) Route

func (m *BotTask) Route(r *wkhttp.WKHttp)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL