The first end-to-end test: a Project Think agent, on the real model, writes code that runs in a dynamic worker and drives a mower; the test counts the cells cut, and saves the turn to itest-output/. Installs @cloudflare/think, @cloudflare/codemode, agents, ai, workers-ai-provider, zod. The model-test worker now has a main entry, the Neighbor DO, and a LOADER binding. Red: src/worker.ts doesn't exist yet. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
14 lines
625 B
TypeScript
14 lines
625 B
TypeScript
/** @file A Think agent, lent a mower, mows: model, generated code, sandbox, mower. */
|
|
import { getAgentByName } from "agents";
|
|
import { env } from "cloudflare:workers";
|
|
import { expect, test } from "vitest";
|
|
|
|
test("lent a mower, the neighbor mows", async ({ annotate }) => {
|
|
const neighbor = await getAgentByName(env.Neighbor, "weekend");
|
|
const turn = await neighbor.runTurn({ input: "you can use this mower for the weekend" });
|
|
await annotate("the turn", { body: JSON.stringify(turn, null, 2), contentType: "application/json" });
|
|
|
|
const cells = await neighbor.cutCells();
|
|
expect(cells.length).toBeGreaterThan(10);
|
|
});
|