microfoom
API referenceType aliases

AgentValueTemplate

Type Alias: AgentValueTemplate

type AgentValueTemplate = <S>(schema) => (strings, ...values) => AgentResult<StandardSchemaV1.InferOutput<S>>;

Defined in: packages/microfoom-core/src/program.ts:67

A structured-value turn: pass a Standard Schema, then tag a template literal. The agent must foom_return a value; it is validated against the schema and the awaited result is typed as the schema's output.

Type Parameters

Type Parameter
S extends StandardSchemaV1

Parameters

ParameterType
schemaS

Returns

(strings, ...values) => AgentResult<StandardSchemaV1.InferOutput<S>>

Example

const n = await this.agent.value(z.number().int())`
  Pick a number between 0 and 100, then foom_return it.`;

On this page