Source:
anthropic-patterns
The glue in every pattern is structured output:
session.run(prompt, { output: zodSchema })
instructs the agent to reply with matching JSON, validates the reply, and gives you a fully typed
outcome.output to branch on in plain TypeScript. Nothing here is Devin-specific beyond that
one call, which is the point: control flow stays in your code, the model fills in one step.
evaluator-optimizer.ts (excerpt)
What you should see
Model text varies run to run, but the shape is stable.bun run evaluator-optimizer prints the
grading loop converging:
bun run parallelization prints three independent one-sentence reviews followed by
votes safe=[false, false, false] -> majority: unsafe.
Run
createDevin(), so it runs in the cloud. Pass
createDevin({ cwd: process.cwd() }) to run through the bundled CLI instead (the patterns are
chat-only, so nothing is written there), or createSession({ repos: ["your-org/your-repo"] })
to give a cloud session a repository to work in.
Launch and structured output
How
run(prompt, {output}) validates the reply and what happens when it doesn’t match.Ticket enricher
One of these patterns deployed as a webhook, with a queue and a typed result.

