Skip to content

Commit 672b654

Browse files
committed
docs(cli): document --runtime --force in tutorial 00-cli
New section explains the AgentRuntime SPI swap pattern and adds the --force flag for samples that pre-pin a specific adapter (e.g. ai-tools). Notes the caveat that provider-coupled Java imports still need manual edits.
1 parent 02e15ef commit 672b654

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

docs/src/content/docs/tutorial/00-cli.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,46 @@ plain `mvn compile`.
132132
Pass `--skill-file <path>` to auto-select the `agent` template with
133133
your skill file wired in.
134134

135+
### Swap the AI Runtime (`--runtime`)
136+
137+
Atmosphere's `AgentRuntime` SPI picks the highest-priority adapter on
138+
the classpath, so you can switch LLM providers by changing one
139+
dependency. The CLI does that for you:
140+
141+
```bash
142+
atmosphere new my-ai-app --template ai-chat --runtime spring-ai
143+
atmosphere new my-ai-app --template ai-chat --runtime langchain4j
144+
atmosphere new my-ai-app --template ai-chat --runtime adk
145+
atmosphere new my-kotlin-ai --template ai-chat --runtime embabel
146+
```
147+
148+
Available runtimes: `builtin` (default — no extra deps),
149+
`spring-ai`, `langchain4j`, `adk`, `koog`, `embabel`,
150+
`semantic-kernel`. The mapping lives in `cli/runtime-overlays.json`;
151+
each entry lists the dep set to inject (and any extra repository, e.g.
152+
Embabel's release repo).
153+
154+
#### `--force`: Strip Pre-Pinned Adapters
155+
156+
Some templates already pin a specific adapter for demo purposes
157+
(`ai-tools` ships with `atmosphere-langchain4j`). On those, plain
158+
`--runtime spring-ai` is *additive* — both adapters end up on the
159+
classpath and the resolver picks one based on `ServiceLoader`
160+
iteration order, which isn't stable.
161+
162+
`--force` (only valid with `--runtime`) wipes every adapter dep
163+
declared in the overlay registry from the scaffolded `pom.xml` *before*
164+
injecting the chosen overlay, making the swap deterministic:
165+
166+
```bash
167+
atmosphere new my-ai-app --template ai-tools --runtime spring-ai --force
168+
```
169+
170+
Note: samples whose Java code imports a specific provider's API
171+
directly (e.g. `OpenAiStreamingChatModel` in `ai-tools`) will still
172+
need manual edits after force-swap. Transparent templates like
173+
`ai-chat` and `multi-agent` work end-to-end with no code changes.
174+
135175
### npx Alternative (Zero Install)
136176

137177
No Java CLI needed — scaffold from npm:

0 commit comments

Comments
 (0)