TAAFT
Free mode
100% free
Freemium
Free Trial
Deals

Smarter tool selection & execution for AI SDK agents

21 1 Language: TypeScript License: Apache-2.0 Updated: 5d ago

README

Reflex

Reflex is an AI SDK library that replaces your tool list with smarter selection and execution. Instead of loading all tools into context, your agent picks the right ones on-demand. It can also chain tool calls by writing code—handling loops, conditionals, and error recovery without round-trips to the model.

Based on Anthropic's advanced tool use patterns.

Install

npm install reflex-ai

Usage

import { createReflexTools } from "reflex-ai";
import { generateText } from "ai";

const { toolSearch, toolExecute } = createReflexTools({
  tools: {
    readNotionDoc,
    sendSlackMessage,
    // ... your AI SDK tools
  },
  model: optionalSelectorModel, // used for smart tool matching
});

const result = await generateText({
  model: yourModel,
  tools: { toolSearch, toolExecute },
  prompt: "...",
});

Tools

toolSearch

Finds relevant tools by query. Uses simple string matching by default, or semantic matching if you provide a model.

toolExecute

Runs JavaScript in a sandbox with your tools exposed as async functions. Lets the agent orchestrate multiple calls, loop over data, and combine results in one shot.

// Example: batch operation in a single execution
const users = await getUsers();
const results = [];
for (const user of users) {
  results.push(await sendEmail({ to: user.email, subject: "Hello" }));
}
return results;
0 AIs selected
Clear selection
#
Name
Task