Agents. Bring your own agent
Adapters for Vercel AI SDK, OpenAI, Anthropic, LangChain, and anything else that accepts OpenAI-style function schemas.
Tool schemas
All 14 tools ship as OpenAI-style function definitions. Anything that accepts that shape. Vercel AI SDK, Anthropic's tool use, OpenAI Assistants, LangChain, takes them as-is.
import { getToolSchemas } from "@eigenpal/docx-editor-agents";
const schemas = getToolSchemas();
// [{ name: "add_comment", description: "...", parameters: { ... } }, ...]Vercel AI SDK
The shortest path. Use the AI SDK subpath:
// server
import { streamText } from "ai";
import { getAiSdkTools } from "@eigenpal/docx-editor-agents/ai-sdk/server";
export async function POST(req: Request) {
const { messages, tools: clientTools } = await req.json();
return streamText({
model: "openai/gpt-4o",
messages,
tools: getAiSdkTools(clientTools),
}).toUIMessageStreamResponse();
}// client
import { useChat } from "@ai-sdk/react";
import { useDocxAgentTools } from "@eigenpal/docx-editor-agents/react";
import { toAgentMessages } from "@eigenpal/docx-editor-agents/ai-sdk/react";
const { tools } = useDocxAgentTools({ editorRef });
const chat = useChat({ api: "/api/agent-chat", body: { tools } });
const agentMessages = toAgentMessages(chat.messages);Anthropic (Claude)
Use the tool schemas with the Anthropic SDK's tool_use blocks.
import Anthropic from "@anthropic-ai/sdk";
import { getToolSchemas, executeToolCall } from "@eigenpal/docx-editor-agents";
const client = new Anthropic();
const schemas = getToolSchemas();
const response = await client.messages.create({
model: "claude-sonnet-4-7",
max_tokens: 1024,
tools: schemas.map(toAnthropicTool),
messages: [/* ... */],
});
// On tool_use blocks, dispatch to executeToolCall against your DocxReviewer instance.OpenAI
Same schemas, same shape, just pass them to tools: in the chat completions API.
MCP clients
If your agent already speaks MCP, expose the toolkit as a server instead:
import { McpServer } from "@eigenpal/docx-editor-agents/mcp";
const server = new McpServer(reviewer);
// wire to your MCP transport (stdio, websocket, etc.)See the API reference: agents for full signatures.
LangChain / custom
agentTools is the underlying tool definition array. Wrap each entry however your framework expects.
import { agentTools, executeToolCall } from "@eigenpal/docx-editor-agents";
for (const tool of agentTools) {
// Convert to your framework's tool shape...
}
// When the framework dispatches a tool call:
const result = await executeToolCall(reviewerOrBridge, toolName, toolInput);Where to go next
- Live editor, full client wiring
- Word JS API parity, the Office.js mapping
- API reference, every subpath