@@ -728,12 +728,17 @@ export type AgentAddon = (
728728 context : AgentAddonContext ,
729729 next : ( ) => Promise < void > ,
730730) => void | Promise < void > ;
731+ /** Options for the {@link steering} addon. */
731732export type SteeringOptions = {
733+ /** Warning message appended to the prompt on the last available turn. Defaults to a generic "you are running out of turns" notice. */
732734 message ?: string ;
733735} ;
736+ /** Options for the {@link timeout} addon. */
734737export type TimeoutOptions = {
738+ /** Maximum milliseconds to wait for a single agent turn before raising an `AbortError`. */
735739 timeout : number ;
736740} ;
741+ /** Callback invoked once per unique {@link Agent} instance when {@link oncePerAgent} is used. */
737742export type AgentRegistration = (
738743 agent : Agent ,
739744 context : AgentAddonContext ,
@@ -1421,6 +1426,24 @@ export function oncePerAgent(register: AgentRegistration): AgentAddon {
14211426 } ;
14221427}
14231428
1429+ /**
1430+ * Namespace of built-in addon factories. Import and combine these to customize
1431+ * agent behaviour without modifying the core harness.
1432+ *
1433+ * | Addon | Purpose |
1434+ * |---|---|
1435+ * | `repair` | Re-prompts when the model returns invalid JSON or fails schema validation (up to `maxTurns`). Built in by default. |
1436+ * | `steering` | Appends a warning to the prompt on the last turn so the model knows it must correct output now. |
1437+ * | `timeout` | Cancels the in-flight turn via `AbortSignal` after the given number of milliseconds. |
1438+ * | `oncePerAgent` | Runs a registration callback exactly once per unique `Agent` instance (e.g. to register tools). |
1439+ *
1440+ * @example
1441+ * import { addons, agent, s } from "rig";
1442+ * const a = agent({
1443+ * output: s.object({ answer: s.string }),
1444+ * addons: [addons.steering(), addons.timeout({ timeout: 30_000 })],
1445+ * });
1446+ */
14241447export const addons = {
14251448 oncePerAgent,
14261449 timeout,
0 commit comments