---
title: "Graph quickstart"
description: "Define state, connect nodes, and invoke a compiled graph."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.cortavyn.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Graph quickstart

```java
var schema = StateSchema.builder(GraphState.adapter())
    .channel("answer", StateChannel.lastValue())
    .build();

var graph = new StateGraph<>(schema)
    .addNode("answer", (state, runtime) ->
            completedFuture(new StateUpdate(Map.of("answer", "done"))))
    .addEdge(StateGraph.START, "answer")
    .addEdge("answer", StateGraph.END)
    .compile();

RunResult<GraphState> result = graph.invoke("customer-42", GraphState.empty())
    .toCompletableFuture().join();
```

Use stable thread IDs when a run must later be resumed or inspected.

Source: https://docs.cortavyn.org/graph/quickstart/index.mdx
