import { startBrowserAgent } from 'magnitude-core';
import z from 'zod';
async function main() {
const agent = await startBrowserAgent({
url: 'https://magnitasks.com/tasks',
narrate: true,
llm: [
{
provider: 'claude-code',
options: {
model: 'claude-sonnet-4-20250514'
}
},
{
roles: ['extract'],
provider: 'google-ai',
options: {
model: 'gemini-2.5-flash-lite-preview-06-17',//'gemini-2.5-flash'
}
},
{
roles: ['query'],
provider: 'google-ai',
options: {
// Balance intelligent querying and cheap tokens
model: 'gemini-2.5-flash'
}
}
]
});
const tasks = await agent.extract(
'Extract all tasks in To Do column',
z.array(z.object({ title: z.string(), desc: z.string() }))
); // ^ this will use gemini-2.5-flash-lite-preview-06-17
await agent.act('Move each to in progress', { data: tasks });
// ^ this will use Claude
const numTodosMoved = await agent.query(
'How many todos were moved?',
z.number()
); // ^ this will use gemini-2.5-flash
console.log(numTodosMoved);
await agent.stop();
}
main();