router

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package router is Fort's deterministic matcher engine (backlog AO-013).

It maps a Task to exactly one route by applying an ordered ruleset with first-match-wins semantics and a default fallback. Every decision is recorded as a RouteDecision. There are zero model/LLM calls on this path: Route is a pure function of the Task and the Ruleset (proven by TestRoutingIsDeterministic).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteDecision

type RouteDecision struct {
	TaskID      string `json:"task_id"`
	Route       string `json:"route"`        // the chosen agent
	MatchedRule string `json:"matched_rule"` // rule id, "" when defaulted
	Default     bool   `json:"default"`      // true when no rule matched
	Reason      string `json:"reason"`
}

RouteDecision is the recorded outcome of routing a single task.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router applies a ruleset to tasks.

func New

func New(rs *rules.Ruleset) *Router

New builds a Router over a validated ruleset.

func (*Router) Route

func (r *Router) Route(t task.Task) RouteDecision

Route returns the single route for a task. It walks rules in order and returns the first match; if none match it returns the default route.

Jump to

Keyboard shortcuts

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