Documentation
¶
Overview ¶
Package trigger provides scheduled and event-driven agent invocation.
The scheduler component uses cron expressions to trigger agents on a schedule without external HTTP requests.
Package trigger provides scheduled and event-driven agent invocation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentInvoker ¶
AgentInvoker is a function that invokes an agent with optional input. Returns the A2A task ID for tracking, or empty string if task tracking is unavailable.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages scheduled agent invocations.
func NewScheduler ¶
func NewScheduler(invoker AgentInvoker) *Scheduler
NewScheduler creates a new scheduler.
func (*Scheduler) RegisterAgent ¶
func (s *Scheduler) RegisterAgent(agentName string, ag agent.Agent, cfg *config.TriggerConfig) error
RegisterAgent registers an agent's trigger with the scheduler.
type WebhookHandler ¶ added in v1.15.0
type WebhookHandler struct {
// contains filtered or unexported fields
}
WebhookHandler handles incoming webhook requests and invokes agents.
func NewWebhookHandler ¶ added in v1.15.0
func NewWebhookHandler(agentName string, cfg *config.TriggerConfig, invoker AgentInvoker, opts ...Option) (*WebhookHandler, error)
NewWebhookHandler creates a new webhook handler for an agent.
func (*WebhookHandler) ServeHTTP ¶ added in v1.15.0
func (h *WebhookHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles incoming webhook requests.
type WebhookPayloadContext ¶ added in v1.15.0
type WebhookPayloadContext struct {
Body map[string]any `json:"body"`
Headers map[string]string `json:"headers"`
Query map[string]string `json:"query"`
Fields map[string]any `json:"fields"` // Extracted fields
}
WebhookPayloadContext provides data for template execution.
type WebhookResult ¶ added in v1.15.0
type WebhookResult struct {
TaskID string `json:"task_id,omitempty"`
Status string `json:"status"`
Result string `json:"result,omitempty"`
Error string `json:"error,omitempty"`
AgentName string `json:"agent_name"`
}
WebhookResult represents the result of a webhook invocation.