Getting started — author a template and generate a document¶
This is a hands-on lesson. By the end you will have the app running, authored a
template over the /v1 API, and generated a document from it. It's a guided
happy path — for the full API surface and every option, follow the pointers to
the how-to guide as you go.
Prerequisite: a working checkout. The repo README has the full clone → submodules →
pnpm install→ build →uv sync→.env.localsequence. Come back here oncecd docgen && uv run pytest -m 'not llm'passes.
1. Start the app¶
cd apps/web && pnpm dev
pnpm dev builds docgen-ui, frees the ports, then runs the Python engine
(uvicorn) and the Next app together. Two things are now up:
- the demo UI at
http://127.0.0.1:3000 - the
/v1API athttp://127.0.0.1:8769
Confirm the API is alive:
curl -s http://127.0.0.1:8769/v1/config-schema | head -c 200
GET /v1/config-schema returns the live, authoritative description of every
field a template spec accepts — it's the reference you'll consult while authoring.
2. Author your first template¶
Everything about a template — sections, prompts, models-per-step, data needs,
voice — is authored over /v1. There are two equivalent paths (granular API
calls, or author a spec and apply it); this tutorial uses the spec path because
it's the fastest way to see a whole template at once.
- Open the authoring how-to guide and
copy its minimal worked spec (the guide keeps the one authoritative,
copy-pasteable example so it never drifts). Save it as
my-template.json. - Dry-run it first — validate without writing anything:
curl -s -X POST 'http://127.0.0.1:8769/v1/templates?dry_run=true' \
-H 'content-type: application/json' \
--data @my-template.json
A dry run compiles the spec and reports what would be created (or the
validation errors). Fix any errors and re-run until it's clean.
3. Apply it — drop ?dry_run=true and the template is created:
curl -s -X POST 'http://127.0.0.1:8769/v1/templates' \
-H 'content-type: application/json' \
--data @my-template.json
Refresh the UI — your template is in the library.
3. Generate a document¶
- In the UI, instantiate your template (create a document from it) and fill in any per-document fields.
- Click Generate. Watch the pipeline run: gather → compute → synthesize →
render. Each section fills in according to its
render_mode. - Open the document to read the output, or export it to
.docx.
That's the full loop: author → instantiate → generate.
Where to go next¶
- The complete API — programmatic instantiate + generate,
PUT …/configto change models/prompts,GET/PUT …/specto export and edit a template in place:how-to/authoring-and-config-api.md. - How rendering actually works — render modes, the batched synthesis call,
voice, citations:
explanation/rendering-and-prompts.md. - The vocabulary — organizations, sections, data needs, synthesized context:
reference/domain-model.md.