import { createStep, createWorkflow } from "@ai_kit/core";
import { z } from "zod";
const normalizeInput = createStep({
id: "normalize",
inputSchema: z.object({ city: z.string() }),
outputSchema: z.object({ city: z.string() }),
handler: ({ input }) => ({ city: input.city.trim() }),
});
export const weatherWorkflow = createWorkflow({
id: "weather-run",
description: "Fetch weather data and generate a summary",
inputSchema: z.object({ city: z.string() }),
outputSchema: z.object({ forecast: z.string() }),
telemetry: {
traceName: "workflow.weather-run",
recordInputs: true,
recordOutputs: true,
metadata: {
domain: "weather",
},
userId: "anonymous",
},
})
.then(normalizeInput)
.commit();