Class: GraphCompiler
Defined in: packages/agentos/src/orchestration/compiler/GraphCompiler.ts:91
Stateless compiler that transforms AgentGraph builder state into a CompiledExecutionGraph.
Compilation steps:
- Flatten the
nodesMap into a plain array (preserving insertion order). - Copy the
edgesarray without transformation. - Lower each Zod state schema to a JSON Schema object via
lowerZodToJsonSchema. - Assign a unique
idbased onnameand the current timestamp. - Forward
reducers,memoryConsistency, andcheckpointPolicyunchanged.
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
Constructor
new GraphCompiler():
GraphCompiler
Returns
GraphCompiler
Methods
compile()
staticcompile(input):CompiledExecutionGraph
Defined in: packages/agentos/src/orchestration/compiler/GraphCompiler.ts:101
Compile builder state into a CompiledExecutionGraph IR object.
This method is pure — it reads from input and returns a new object without
mutating any of its arguments.
Parameters
input
The full set of builder state required for compilation.
Returns
A CompiledExecutionGraph ready for validation and execution.