Context
Follow-up to #2020 (dynamic tool schema filtering). Community feedback from @Docat0209 highlighted an important gap: some tools become relevant only after other tasks complete.
Problem
Current filtering exposes tools in two states:
- Iteration 0: filtered by relevance (30-60% token savings ✓)
- Iterations 1+: full tool set available
This doesn't account for sequential dependencies. For example:
- Format results tool should only be visible after search succeeds
- Data validation tool should only be visible after data load completes
- Rollback tool should only be visible after operation attempt
Without explicit dependencies, LLM may request unavailable tools, wasting tokens and confusing the agent.
Solution
Implement a tool dependency graph to make tools conditionally available:
-
ToolDependency struct — define prerequisites
must_complete_before: tools that must finish first
works_better_after: soft suggestions (for observability)
-
Dependency tracking — in Agent state
- Track completed tools in current conversation turn
- Query: "which tools are available?" based on completions
-
Enhanced filtering — combine relevance + dependencies
- Include tool if: (relevance match) OR (always_on) OR (dependency satisfied)
-
InclusionReason expansion
- Add:
DependencyMet (prerequisite completed)
- Add:
DependencyNotMet (for logging why excluded)
Implementation
- Keep dependencies optional (not all tools need them)
- Config:
[tool.<name>.dependencies] section
- Testing: multi-turn scenarios with sequential tool chains
- UI: TUI status showing unavailable tools + unsatisfied dependencies
Acceptance Criteria
Labels
research, tools, enhancement
Related
Context
Follow-up to #2020 (dynamic tool schema filtering). Community feedback from @Docat0209 highlighted an important gap: some tools become relevant only after other tasks complete.
Problem
Current filtering exposes tools in two states:
This doesn't account for sequential dependencies. For example:
Without explicit dependencies, LLM may request unavailable tools, wasting tokens and confusing the agent.
Solution
Implement a tool dependency graph to make tools conditionally available:
ToolDependency struct — define prerequisites
must_complete_before: tools that must finish firstworks_better_after: soft suggestions (for observability)Dependency tracking — in Agent state
Enhanced filtering — combine relevance + dependencies
InclusionReason expansion
DependencyMet(prerequisite completed)DependencyNotMet(for logging why excluded)Implementation
[tool.<name>.dependencies]sectionAcceptance Criteria
Labels
research, tools, enhancement
Related