Skip to content

altic-dev/Reflex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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;

About

Smarter tool selection & execution for AI SDK agents

Resources

License

Stars

Watchers

Forks