diff --git a/apps/playground/src/lib/dynamic-tool-loader.ts b/apps/playground/src/lib/dynamic-tool-loader.ts index 9133d55..f2be8ae 100644 --- a/apps/playground/src/lib/dynamic-tool-loader.ts +++ b/apps/playground/src/lib/dynamic-tool-loader.ts @@ -1,4 +1,3 @@ -import { prisma } from '@tpmjs/db'; import { jsonSchema, tool } from 'ai'; // Cache for tool wrappers (process-level) @@ -49,6 +48,9 @@ async function reportToolFailure( phase: 'import' | 'execution' ): Promise { try { + // Lazy load Prisma to avoid module initialization failures + const { prisma } = await import('@tpmjs/db'); + // Find the tool in the database const tool = await prisma.tool.findFirst({ where: {