Skip to content

Compare two models

Time: 5–8 minutes

Compare the parent agent’s Gemma model with the Llama model already used by venue-scout. Both run through the existing Workers AI binding and need no API key.

Terminal window
npm run deploy
sleep 5
npm run smoke -- https://field-trip-agent.<subdomain>.workers.dev model-gemma-live \
"In exactly one sentence, explain what you do."

Save your workers.dev subdomain to open this test ↗https://field-trip-agent.<subdomain>.workers.dev/?id=model-gemma-live

This opens the same conversation as the smoke test. If you repeat this checkpoint, before copying its commands.

Update src/agents/field-trip.ts to use Llama for the parent model. The diff changes only useModel(...) from completed checkpoint 6; Complete file includes the existing trip brief, tools, subagent, and Sandbox:

src/agents/field-trip.ts+1−1

Changes from Checkpoint 6 (guide) → Compare two models bonus

src/agents/field-trip.ts
===================================================================
--- a/src/agents/field-trip.ts Checkpoint 6 (guide)
+++ b/src/agents/field-trip.ts Compare two models bonus
@@ -20,7 +20,7 @@
};
export function FieldTrip({ id }: AgentProps) {
- useModel('cloudflare/@cf/google/gemma-4-26b-a4b-it');
+ useModel('cloudflare/@cf/meta/llama-4-scout-17b-16e-instruct');
// Durable, per-conversation state (stored in this conversation's Durable Object).
// Shaped like React's useState, but it survives restarts and redeploys.
Terminal window
npm run typecheck
npm run deploy
sleep 5
npm run smoke -- https://field-trip-agent.<subdomain>.workers.dev model-llama-live \
"In exactly one sentence, explain what you do."

Save your workers.dev subdomain to open this test ↗https://field-trip-agent.<subdomain>.workers.dev/?id=model-llama-live

This opens the same conversation as the smoke test. If you repeat this checkpoint, before copying its commands.

Open AI → AI Gateway → default → Logs and compare model, duration, tokens, and answer style. Exact wording is not a pass/fail criterion.

Verification gate

Prove it works

  • Both fresh conversation IDs complete successfully.
  • The gateway logs show one Gemma request and one Llama request.
  • You can compare latency and token usage without changing the agent’s tools or state model.

Restore:

useModel('cloudflare/@cf/google/gemma-4-26b-a4b-it');

Run npm run typecheck once more, then redeploy to restore the live model (or keep Vite running for Local dev).