@microfox/ai-router 2.0.1-beta.1 → 2.0.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @microfox/ai-router
2
2
 
3
+ ## 2.0.1-beta.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 2a62227: added filter options to agentAsTool
8
+
3
9
  ## 2.0.1-beta.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -688,10 +688,49 @@ interface NextHandler<Metadata, Parts, Tools, State> {
688
688
  callAgent(path: string, params?: Record<string, any>): Promise<Result>;
689
689
  callTool(path: string, params: any): Promise<Result>;
690
690
  attachTool(path: string): Tool<any, any>; // Use to expose a standard .tool() to an LLM.
691
- agentAsTool(path: string, definition?: Tool<any, any>): Tool<any, any>; // Use to expose another .agent() as a tool to an LLM.
691
+ agentAsTool(
692
+ path: string,
693
+ options?: Record<string, any> & { disableAllInputs?: boolean }
694
+ ): Tool<any, any>; // Use to expose another .agent() as a tool to an LLM.
692
695
  }
693
696
  ```
694
697
 
698
+ ### Using Agents as Tools with Controlled Schema
699
+
700
+ The `next.agentAsTool()` method allows you to expose an agent as a tool to an LLM with fine-grained control over the input schema that the LLM sees. This is useful for simplifying the tool for the LLM, fixing certain parameters, or disabling all inputs.
701
+
702
+ #### Examples of `agentAsTool`
703
+
704
+ 1. **Only expose certain inputs to the LLM:**
705
+
706
+ If an agent has an input schema with `query` and `otherParameter`, you can expose only the `query` field to the LLM.
707
+
708
+ ```typescript
709
+ const researchTool = ctx.next.agentAsTool('/research', {
710
+ query: true, // Only 'query' will be in the schema for the LLM
711
+ });
712
+ ```
713
+
714
+ 2. **Fix a parameter value:**
715
+
716
+ You can hide a parameter from the LLM and provide a fixed value for it when the agent is executed.
717
+
718
+ ```typescript
719
+ const specializedResearchTool = ctx.next.agentAsTool('/research', {
720
+ query: 'web development', // 'query' is not in the LLM's schema; it's always 'web development'
721
+ });
722
+ ```
723
+
724
+ 3. **Disable all inputs:**
725
+
726
+ You can expose the agent as a tool that takes no inputs from the LLM.
727
+
728
+ ```typescript
729
+ const parameterlessTool = ctx.next.agentAsTool('/some-agent', {
730
+ disableAllInputs: true,
731
+ });
732
+ ```
733
+
695
734
  ## Error Types
696
735
 
697
736
  The router provides several error types for different scenarios:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microfox/ai-router",
3
- "version": "2.0.1-beta.1",
3
+ "version": "2.0.1-beta.2",
4
4
  "description": "A Router-based Framework built on top of ai-sdk to support Multi-Agentic Workflows.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",