Next applies the outgoing transition's side effects (e.g. AgentTask prompt evaluation) against the scope and returns the target node ID. Returns StateIdle with a nil error when no transition is wired to the port.
(port string, scope *Scope)
| 109 | // evaluation) against the scope and returns the target node ID. Returns |
| 110 | // StateIdle with a nil error when no transition is wired to the port. |
| 111 | func (b *LinearNode) Next(port string, scope *Scope) (string, error) { |
| 112 | tr, ok := b.transitions[port] |
| 113 | if !ok { |
| 114 | return StateIdle, nil |
| 115 | } |
| 116 | if err := tr.Apply(scope); err != nil { |
| 117 | return "", fmt.Errorf("node %s port %s: %w", b.id, port, err) |
| 118 | } |
| 119 | return tr.TargetID, nil |
| 120 | } |
| 121 | |
| 122 | // BranchingNode is a base for a node that can decide between multiple |
| 123 | // state transitions per port (e.g. LLM agent) |