API referenceFunctions
Program
Function: Program()
function Program<S, R>(input): () => FoomtimeProgram<InferOutput<S>, R>;Defined in: packages/microfoom-core/src/program.ts:182
Name an input schema, then extends Program(Input); main(input) is typed from
it. The return type is taken from your main (inferred by runProgram), so the
common case needs no type arguments at all — just extends Program(schema).
Type Parameters
| Type Parameter | Default type |
|---|---|
S extends StandardSchemaV1 | - |
R | unknown |
Parameters
| Parameter | Type | Description |
|---|---|---|
input | S | A Standard Schema validating the program's /run input. main's parameter is typed as this schema's output. |
Returns
An abstract base class to extend; implement async main(input).
() => FoomtimeProgram<InferOutput<S>, R>
Example
const Input = z.object({ topic: z.string() });
@foom.config({ model: "openrouter/deepseek/deepseek-v4-flash" })
export default class extends Program<typeof Input, number>(Input) {
async main(input: typeof Input._type): Promise<number> {
return await this.agent.value(z.number().int())`Pick a number for ${input.topic}.`;
}
}