import { OpenFilesTools } from '@openfiles-ai/sdk/tools'import OpenAI from 'openai'const tools = new OpenFilesTools({ apiKey: process.env.OPENFILES_API_KEY})const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY})// Add OpenFiles tools to OpenAIconst response = await openai.chat.completions.create({ model: 'gpt-4', messages: [{ role: 'user', content: 'Create a vacation itinerary for 5 days in Paris and save it as paris-trip.md' }], tools: tools.openai.definitions})// Process file operationsconst processed = await tools.openai.processToolCalls(response)if (processed.handled) { console.log(`✅ Handled ${processed.results.length} file operations`)}
import { OpenFilesTools } from '@openfiles-ai/sdk/tools'import Anthropic from '@anthropic-ai/sdk'const tools = new OpenFilesTools({ apiKey: process.env.OPENFILES_API_KEY})const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY})// Add OpenFiles tools to Claudeconst response = await anthropic.messages.create({ model: 'claude-sonnet-4-20250514', max_tokens: 1024, messages: [{ role: 'user', content: 'Create a vacation itinerary for 5 days in Paris and save it as paris-trip.md' }], tools: tools.anthropic.definitions})// Process file operationsconst processed = await tools.anthropic.processToolCalls(response)if (processed.handled) { console.log(`✅ Handled ${processed.results.length} file operations`)}
const personalTools = new OpenFilesTools({ apiKey: 'oa-...', basePath: 'personal/recipes'})const travelTools = new OpenFilesTools({ apiKey: 'oa-...', basePath: 'travel/itineraries'})// Each tool set operates in its own namespace
// Create specialized agents with different file scopesconst recipeAgent = new OpenFilesTools({ apiKey: 'oa-...', basePath: 'recipes'})const travelAgent = new OpenFilesTools({ apiKey: 'oa-...', basePath: 'travel-plans'})const shoppingAgent = new OpenFilesTools({ apiKey: 'oa-...', basePath: 'shopping-lists'})// Each agent works in isolated file spaces// but can collaborate on shared projects