Skip to content

Function: hasToolDependencies()

@providerprotocol/agents


@providerprotocol/agents / index / hasToolDependencies

hasToolDependencies(tools): boolean

Defined in: src/execution/tool-ordering.ts:233

Checks if any tools in the array have execution dependencies defined.

This is a quick check to determine if tool ordering is needed. If no tools have dependencies, all calls can execute in parallel without the overhead of dependency resolution.

Tool<unknown, unknown>[]

Tool definitions to check

boolean

true if any tool has sequential or dependsOn set

import { hasToolDependencies } from '@providerprotocol/agents/execution';
if (hasToolDependencies(tools)) {
// Need to use orderToolCalls for proper ordering
const groups = orderToolCalls(toolCalls, tools);
} else {
// Can execute all calls in parallel
await Promise.all(toolCalls.map(executeTool));
}