import { Agent, openai, anthropic, google, withFallback } from "@agentium/core";
const resilientModel = withFallback(
[openai(process.env.OPENAI_MODEL ?? "gpt-6.1-sol"), anthropic(process.env.ANTHROPIC_MODEL ?? "claude-sonnet-5-5"), google(process.env.GOOGLE_MODEL ?? "gemini-3.8-flash")],
{
circuitBreaker: { failureThreshold: 3, cooldownMs: 30_000 },
onFallback: (from, to, error) => {
console.log(`Fallback: ${from} → ${to} (${error})`);
},
},
);
const agent = new Agent({
name: "resilient-agent",
model: resilientModel,
instructions: "You are a helpful assistant.",
});
const result = await agent.run("What is the capital of France?");