1.0.4 ⢠Published 4 months ago
@gopluto_ai/llm-tools-orchestration v1.0.4
š ļø @gopluto_ai/llm-tools-orchestration
Scalable LLM tool orchestration SDK with memory hooks, parallel Multi function execution, and GPT-4o (or any model) planning ā built for production AI agents. Alternative of MCP for AI or LLM Parallel multi tool calling which is easy to understand.
š Features
- ā Register tools with full JSON schema
- š§ Pre/post tool memory lifecycle hooks
- š Plans tools dynamically using OpenAI
/v1/responses
API (ā ļø not chat completion) - š ļø Parallel tool execution with context-rich synthesis
- š ESM + CommonJS ready for Node.js and serverless
- š Works with any GPT model (
gpt-4o
,gpt-4-turbo
, etc.) ā dynamic model control
š¦ Installation
npm install @gopluto_ai/llm-tools-orchestration
Set in .env
OPENAI_API_KEY = xxxxxxxxxxxx
ā” Quick Example
import {
registerTool,
planTools,
executeParallelTools,
synthesizeFinalReply,
registerHookProcessor
} from "@gopluto_ai/llm-tools-orchestration";
import { getOpenAIResData } from "@gopluto_ai/llm-tools-orchestration/dist/openaiHelpers";
registerHookProcessor("logStart", async (memory) => {
console.log("š§ Memory:", memory);
return memory;
});
registerTool({
type: "function",
name: "get_stock_price",
description: "Returns dummy stock price",
parameters: {
type: "object",
required: ["ticker", "currency"],
properties: {
ticker: { type: "string" },
currency: { type: "string" }
}
},
preHooks: ["logStart"],
handler: async ({ ticker, currency }) => {
return { ticker, currency, price: 999.99 };
}
});
const messages = {
sysprompt: "You are a stock price assistant.",
userMessage: "What's the price of TSLA in USD?",
conversationHistory: [],
agentMemory: {},
imageUrl:'',
fileUrl:''
};
(async () => {
const plan = await planTools(messages, getOpenAIResData, "gpt-4o");
const results = await executeParallelTools(plan.neededTools, plan.args, { userId: "xyz" });
const reply = await synthesizeFinalReply(messages.userMessage, results, messages, plan.tools, getOpenAIResData, "gpt-4o");
console.log("š§ Final AI Reply:", reply);
})();
š Structure
src/
āāā index.ts # Entry point
āāā toolOrchestrator.ts # Tool registration + planning
āāā openaiHelpers.ts # Handles OpenAI /v1/responses payloads
examples/
āāā index.js # CLI-ready use case
š This SDK Uses OpenAI's /v1/responses
Endpoint
Unlike typical chat/completions
, this SDK uses the new /v1/responses
API to support multi-modal inputs (text, file, image) and tool usage natively.
This gives you:
- Context-rich messages (system + memory)
- Native tool calling structure
- Easy agent memory injection
- Full control over function outputs
š¤ Contributing
- Clone this repo
- Run
npm install && npm run build
- Edit tools in
src/toolOrchestrator.ts
- Submit PRs!
Contact
Email: shubham@e2ecapital.com
Contact: +91 9110035665
Whatsapp: https://wa.me/919110035665
š License
MIT Ā© GoPluto.ai