Skip to content

Documentation / @agentick/kernel / hasAncestorMatching

Function: hasAncestorMatching()

hasAncestorMatching(ctx, predicate): boolean

Defined in: kernel/src/execution-helpers.ts:113

Check if this execution has an ancestor matching a predicate.

Parameters

ctx

KernelContext

predicate

(node) => boolean

Returns

boolean

Example

typescript
if (hasAncestorMatching(ctx, n => n.metadata?.type === 'agent')) {
  // We're inside an agent execution
}

Released under the ISC License.