Stateless compiler that transforms AgentGraph builder state into a CompiledExecutionGraph.

Compilation steps:

  1. Flatten the nodes Map into a plain array (preserving insertion order).
  2. Copy the edges array without transformation.
  3. Lower each Zod state schema to a JSON Schema object via lowerZodToJsonSchema.
  4. Assign a unique id based on name and the current timestamp.
  5. Forward reducers, memoryConsistency, and checkpointPolicy unchanged.

Example

const ir = GraphCompiler.compile({
name: 'my-agent',
nodes,
edges,
stateSchema: { input: z.object({ topic: z.string() }), scratch: z.object({}), artifacts: z.object({}) },
reducers: {},
memoryConsistency: 'snapshot',
checkpointPolicy: 'none',
});

Constructors

Methods

Constructors

Methods