Skip to content

handoffFilters

const handoffFilters: object;

Convenience namespace for all pre-built filters.

compose: (...filters) => HandoffInputFilter = composeFilters;

Composes multiple filters into a single filter. Filters are applied left-to-right: each filter receives the output of the previous one.

Parameter Type

filters

HandoffInputFilter[]

HandoffInputFilter

keepRecentMessages: (count) => (data) => HandoffInputResult;

Keeps only the last N non-system messages. System messages are always preserved.

Respects tool-call/tool-result pair integrity: if a tool-result message is included but its preceding tool-call assistant message is cut, both are excluded.

Parameter Type

count

number

(data) => HandoffInputResult

removeKeys: (keys) => (data) => HandoffInputResult;

Removes specified keys from workingMemory. Passes messages through unchanged.

Parameter Type

keys

string[]

(data) => HandoffInputResult

removeToolHistory: (data) => HandoffInputResult;

Removes all tool-call and tool-result messages from the history. The target agent sees only user/assistant conversational turns.

  • Messages with role ‘tool’ are removed entirely.
  • Assistant messages that contain ONLY tool-call content parts are removed.
  • Assistant messages with mixed content (text + tool-call) are preserved.
Parameter Type

data

HandoffInputData

HandoffInputResult