Interface IToolRouter
Selects which tools to forward to the LLM for a given user message. Implement this interface to provide a custom routing strategy (e.g. rule-based, tag-based, or embedding-based).
Namespace: Glitch9.AIDevKit.Agents
Assembly: Glitch9.AIDevKit.dll
Syntax
public interface IToolRouter
Methods
| Edit this page View SourceInitialize(ToolRegistry, ILogger)
Declaration
void Initialize(ToolRegistry registry, ILogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ToolRegistry | registry | |
| ILogger | logger |
Invalidate()
Notifies the router that the registered tool list has changed and any cached state (e.g. an embedding index) should be rebuilt on the next call.
Declaration
void Invalidate()
RouteAsync(string, int, CancellationToken)
Returns the subset of tools most relevant to userMessage.
Declaration
UniTask<List<Tool>> RouteAsync(string userMessage, int topK = 12, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | userMessage | The user's latest text input. |
| int | topK | Maximum number of tools to return. |
| CancellationToken | ct | Cancellation token. |
Returns
| Type | Description |
|---|---|
| UniTask<List<Tool>> |