codemie-cdk-python 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. codemie_cdk_python-0.1.0/PKG-INFO +892 -0
  2. codemie_cdk_python-0.1.0/README.md +874 -0
  3. codemie_cdk_python-0.1.0/pyproject.toml +31 -0
  4. codemie_cdk_python-0.1.0/src/codemie_iac/__init__.py +49 -0
  5. codemie_cdk_python-0.1.0/src/codemie_iac/cli/__init__.py +17 -0
  6. codemie_cdk_python-0.1.0/src/codemie_iac/cli/__main__.py +24 -0
  7. codemie_cdk_python-0.1.0/src/codemie_iac/cli/commands/__init__.py +17 -0
  8. codemie_cdk_python-0.1.0/src/codemie_iac/cli/commands/apply.py +119 -0
  9. codemie_cdk_python-0.1.0/src/codemie_iac/cli/commands/plan.py +72 -0
  10. codemie_cdk_python-0.1.0/src/codemie_iac/cli/config_model.py +136 -0
  11. codemie_cdk_python-0.1.0/src/codemie_iac/cli/documents.py +59 -0
  12. codemie_cdk_python-0.1.0/src/codemie_iac/cli/env_file.py +62 -0
  13. codemie_cdk_python-0.1.0/src/codemie_iac/cli/exit_status.py +80 -0
  14. codemie_cdk_python-0.1.0/src/codemie_iac/cli/init_command.py +101 -0
  15. codemie_cdk_python-0.1.0/src/codemie_iac/cli/main.py +152 -0
  16. codemie_cdk_python-0.1.0/src/codemie_iac/cli/render.py +206 -0
  17. codemie_cdk_python-0.1.0/src/codemie_iac/cli/target_config.py +258 -0
  18. codemie_cdk_python-0.1.0/src/codemie_iac/credentials.py +99 -0
  19. codemie_cdk_python-0.1.0/src/codemie_iac/envelope.py +188 -0
  20. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/__init__.py +70 -0
  21. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/bulk_create.py +561 -0
  22. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/credentials.py +306 -0
  23. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/errors.py +223 -0
  24. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/field_policy.py +188 -0
  25. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/guards.py +221 -0
  26. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/kinds.py +815 -0
  27. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/lookup.py +313 -0
  28. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/ordering.py +177 -0
  29. codemie_cdk_python-0.1.0/src/codemie_iac/plan_apply/single_apply.py +751 -0
  30. codemie_cdk_python-0.1.0/src/codemie_iac/resolver.py +61 -0
  31. codemie_cdk_python-0.1.0/src/codemie_iac/schema.py +106 -0
  32. codemie_cdk_python-0.1.0/src/codemie_iac/serializer.py +64 -0
  33. codemie_cdk_python-0.1.0/src/codemie_iac/specs/__init__.py +13 -0
  34. codemie_cdk_python-0.1.0/src/codemie_iac/specs/assistant.py +509 -0
  35. codemie_cdk_python-0.1.0/src/codemie_iac/specs/category.py +36 -0
  36. codemie_cdk_python-0.1.0/src/codemie_iac/specs/datasource.py +595 -0
  37. codemie_cdk_python-0.1.0/src/codemie_iac/specs/integration.py +103 -0
  38. codemie_cdk_python-0.1.0/src/codemie_iac/specs/skill.py +51 -0
  39. codemie_cdk_python-0.1.0/src/codemie_iac/specs/workflow.py +154 -0
@@ -0,0 +1,892 @@
1
+ Metadata-Version: 2.4
2
+ Name: codemie-cdk-python
3
+ Version: 0.1.0
4
+ Summary: CodeMie IaC document envelope (Python)
5
+ Author: EPAM Systems
6
+ Requires-Python: >=3.12,<4.0
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Classifier: Programming Language :: Python :: 3.15
12
+ Requires-Dist: codemie-sdk-python (==0.1.713)
13
+ Requires-Dist: jsonschema (>=4.23.0,<5.0.0)
14
+ Requires-Dist: pydantic (>=2.12.2,<3.0.0)
15
+ Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
16
+ Description-Content-Type: text/markdown
17
+
18
+ # codemie-cdk-python
19
+
20
+ A small Python package that turns CodeMie resources (assistants, datasources,
21
+ integrations, skills, categories, workflows) into plain YAML documents you can
22
+ commit to a repo, and reads those documents back.
23
+
24
+ Most of the library works offline, with no network and no running backend. The
25
+ one exception is `codemie_iac.plan_apply`, which talks to the platform, and only
26
+ through the `codemie_sdk` services (see "Plan and apply against the platform"
27
+ below). Nothing else in the package makes a network call.
28
+
29
+ ## Why this exists
30
+
31
+ Today the only way to describe a CodeMie resource outside the UI is to hand-write
32
+ YAML or call the API directly. This package gives you typed, validated building
33
+ blocks for that YAML instead, plus two safety rules baked in:
34
+
35
+ - **No secrets in the file, for the fields this package recognizes as
36
+ credential-shaped.** Those are stored as references (`env:SOME_NAME`),
37
+ never as real values — and a handful of them (`auth_token`,
38
+ `Integration.credential_values`) are *typed* that way, so a literal value
39
+ can't be constructed at all. A few others (`env`, `headers`, `args`, `url`,
40
+ `arguments`, `mcp_connect_url` on an MCP server) are best-effort,
41
+ whole-value matches only: a value already shaped like a reference is
42
+ recognized, but this package does not scan arbitrary strings for secrets,
43
+ so one embedded inside a larger value (e.g. `--token=sk-live-...` in an
44
+ `args` entry, or a signed query parameter on a `url`) is written to the
45
+ file as plain text. See "Credential narrowing for inline MCP servers"
46
+ below for the exact fields.
47
+ - **No silent typos.** An unknown or misspelled field fails loudly, naming the
48
+ field, instead of being quietly dropped.
49
+
50
+ ## What it can do right now
51
+
52
+ - Build a `Document` for one resource (assistant, datasource, integration,
53
+ skill, category, or workflow) — always a single file, workflows included.
54
+ - Group several documents into a `Bundle`.
55
+ - Write a `Bundle` to YAML and read it back, byte-for-byte stable.
56
+ - Validate a YAML document against a packaged JSON Schema, offline.
57
+ - Resolve a reference like "the integration named X" within a bundle.
58
+ - Create a whole bundle on the platform, in dependency order, and plan or
59
+ apply a single document against one existing entity
60
+ (`codemie_iac.plan_apply`).
61
+
62
+ ## What it can't do yet
63
+
64
+ - `apply` never deletes anything, and bulk apply only creates. See "Plan and
65
+ apply against the platform" and "Not supported" below.
66
+
67
+ ## Install
68
+
69
+ The IaC needs exactly `codemie-sdk-python` 0.1.713 (svn, SharePoint, Xray and
70
+ provider datasource support), the version pinned in `pyproject.toml`.
71
+
72
+ This package lives next to the Node IaC tool, under `iac/codemie-iac-python`.
73
+ Poetry installs the pinned SDK from PyPI:
74
+
75
+ ```bash
76
+ cd iac/codemie-iac-python
77
+ poetry install
78
+ ```
79
+
80
+ ## Documents and bundles
81
+
82
+ Three types tie everything together:
83
+
84
+ - **`Spec`** — one class per resource kind (`CategorySpec`, `AssistantSpec`, ...).
85
+ This holds the resource's actual fields — the same data you'd send to the
86
+ platform to create it. Build one with `SomeSpec.from_entity(entity)` from
87
+ the matching `codemie_sdk` model, or with plain keyword arguments. See
88
+ "One example per asset kind" below for how to build each one.
89
+ - **`Document`** — wraps one `Spec` plus `meta`. This is the unit that gets
90
+ saved to disk.
91
+ - **`Bundle`** — an ordered list of `Document`s. It can mix kinds — an
92
+ assistant, a datasource, a skill, all in one list.
93
+
94
+ ### `DocumentMeta`: a label, not platform data
95
+
96
+ `meta` is a small `DocumentMeta` object with two fields: `kind` (which
97
+ `Spec` type this document holds) and `name`. `name` here is **not** a
98
+ resource field — it's just a label you pick so this document can be found
99
+ inside a `Bundle`. `ReferenceResolver.resolve(kind, name)` matches on it;
100
+ nothing else reads it, and nothing checks it against anything inside `spec`.
101
+
102
+ `kind` is a `DocumentKind` enum (`DocumentKind.CATEGORY`,
103
+ `DocumentKind.ASSISTANT`, ...) — one of the six fixed values, used in every
104
+ example below. You can pass the plain string instead (`kind="category"`);
105
+ pydantic converts it to the matching `DocumentKind` member for you, and an
106
+ unrecognized string is rejected the same way either form would be.
107
+
108
+ In most examples below, `meta.name` is set to the same string as the
109
+ resource's own name (`spec.name`), simply because that's the clearest thing
110
+ to do — not because the code requires it. The Integration example makes the
111
+ difference concrete: `IntegrationSpec` has no `name` field at all (it uses
112
+ `alias` instead), so `meta.name` is set from `integration.alias` there.
113
+ Pick whatever label makes the document easy to find; `spec` is what actually
114
+ describes the resource.
115
+
116
+ The rest of this section covers what you can do once you have a `Bundle`.
117
+
118
+ ### Save to YAML, and read it back
119
+
120
+ ```python
121
+ from codemie_iac import to_yaml, from_yaml
122
+
123
+ text = to_yaml(bundle)
124
+ bundle_again = from_yaml(text)
125
+ assert bundle_again == bundle
126
+ ```
127
+
128
+ Writing the same bundle twice always produces the exact same text, so diffs
129
+ in version control only show real changes.
130
+
131
+ ### Validate a document offline
132
+
133
+ ```python
134
+ from codemie_iac import validate_document, DocumentValidationError
135
+
136
+ try:
137
+ validate_document({"version": "v1", "meta": {"kind": "category", "name": "x"}})
138
+ except DocumentValidationError as exc:
139
+ print(exc.errors) # every problem found, not just the first one
140
+ ```
141
+
142
+ No network call is made — the schema ships inside the package.
143
+
144
+ ### Credentials are references, never values
145
+
146
+ A credential field never holds a secret. It holds a reference such as
147
+ `env:JIRA_PROD_TOKEN`, built by `CredentialRef.from_entity(identifier,
148
+ credential_key)`. That function never reads the real secret value — only the
149
+ identifier and the key — so the same two inputs always produce the same
150
+ reference. See the Integration example below for it in context.
151
+
152
+ ### Finding things by name inside a bundle
153
+
154
+ ```python
155
+ from codemie_iac import ReferenceResolver
156
+
157
+ resolver = ReferenceResolver(bundle)
158
+ support_category = resolver.resolve("category", "support")
159
+ ```
160
+
161
+ This only looks inside the bundle you pass in — it never reaches the
162
+ platform or other files.
163
+
164
+ ## One example per asset kind
165
+
166
+ Each example below does the same two steps: describe the asset with its
167
+ `codemie_sdk` model (the same model you'd use to call the platform), then
168
+ convert it to the matching IaC `Spec` with that `Spec`'s own
169
+ `from_entity(...)` classmethod, and render it to YAML.
170
+
171
+ `from_entity` does the field mapping once, inside the package, instead of
172
+ every caller re-deriving it. For the credential-bearing kinds (Integration,
173
+ and Assistant's MCP/toolkit integration references) it does the same
174
+ narrowing shown explicitly elsewhere in this README — it just does it
175
+ internally, never reading an actual secret value. If you'd rather build a
176
+ `Spec` by hand (no entity object, or a one-off that doesn't map cleanly to
177
+ an existing SDK model), every field is still a plain, settable keyword
178
+ argument — `from_entity` is a convenience, not the only way in.
179
+
180
+ ### Category
181
+
182
+ ```python
183
+ from codemie_sdk.models.categories import CategoryCreateRequest
184
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
185
+ from codemie_iac.specs.category import CategorySpec
186
+
187
+ category = CategoryCreateRequest(name="support", description="Support team resources")
188
+
189
+ doc = Document(
190
+ version="v1",
191
+ meta=DocumentMeta(kind=DocumentKind.CATEGORY, name=category.name),
192
+ spec=CategorySpec.from_entity(category),
193
+ )
194
+ print(to_yaml(Bundle([doc])))
195
+ ```
196
+
197
+ ### Skill
198
+
199
+ ```python
200
+ from codemie_sdk.models.skill import SkillCreateRequest
201
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
202
+ from codemie_iac.specs.skill import SkillSpec
203
+
204
+ skill = SkillCreateRequest(
205
+ name="changelog-writer",
206
+ description="Writes a changelog entry from a diff",
207
+ content="Summarize the given diff as one changelog line.",
208
+ project="my-project",
209
+ )
210
+
211
+ doc = Document(
212
+ version="v1",
213
+ meta=DocumentMeta(kind=DocumentKind.SKILL, name=skill.name),
214
+ spec=SkillSpec.from_entity(skill),
215
+ )
216
+ print(to_yaml(Bundle([doc])))
217
+ ```
218
+
219
+ ### Integration
220
+
221
+ `IntegrationSpec.from_entity` never reads the real credential value — it
222
+ only ever sees the integration's `alias` and each credential entry's `key`,
223
+ the same two inputs you'd pass to `CredentialRef.from_entity` by hand:
224
+
225
+ ```python
226
+ from codemie_sdk.models.integration import Integration, CredentialTypes, CredentialValues
227
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
228
+ from codemie_iac.specs.integration import IntegrationSpec
229
+
230
+ integration = Integration(
231
+ project_name="my-project",
232
+ alias="jira-prod",
233
+ credential_type=CredentialTypes.JIRA,
234
+ credential_values=[
235
+ CredentialValues(key="url", value="https://jira.example.com"),
236
+ CredentialValues(key="username", value="<kept out of the document>"),
237
+ CredentialValues(key="token", value="<kept out of the document>"),
238
+ ],
239
+ )
240
+
241
+ doc = Document(
242
+ version="v1",
243
+ meta=DocumentMeta(kind=DocumentKind.INTEGRATION, name=integration.alias),
244
+ spec=IntegrationSpec.from_entity(integration),
245
+ )
246
+ print(to_yaml(Bundle([doc])))
247
+ ```
248
+
249
+ **A credential `key` must be the platform's own setting name.** The package
250
+ does not check keys: an unknown key is stored as written, and the platform then
251
+ shows the setting as empty and the tool fails at runtime. Some types use
252
+ prefixed names, for example:
253
+
254
+ | `credential_type` | Keys |
255
+ |---|---|
256
+ | `Jira` | `url`, `username`, `token`, `cloud` |
257
+ | `Git` | `url`, `token` |
258
+ | `Elastic` | `url`, `elastic_api_key_id`, `elastic_api_key` |
259
+ | `OpenAPI` | `openapi_spec`, `openapi_api_key`, `openapi_username`, `is_basic_auth`, `timeout`, `auth_header_name` |
260
+
261
+ The reference for a key is `env:<ALIAS>_<KEY>`, upper-cased with `-` turned
262
+ into `_` (`openapi-answers` + `openapi_spec` is `env:OPENAPI_ANSWERS_OPENAPI_SPEC`).
263
+
264
+ ### Datasource
265
+
266
+ A datasource is one of thirteen kinds (code, Jira, Confluence, svn, SharePoint,
267
+ Xray, provider, ...), each with
268
+ its own `*Spec` class. This example uses the code-repository kind:
269
+
270
+ ```python
271
+ from codemie_sdk.models.datasource import CodeDataSourceRequest
272
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
273
+ from codemie_iac.specs.datasource import CodeDatasourceSpec
274
+
275
+ datasource = CodeDataSourceRequest(
276
+ name="my_code_kb",
277
+ project_name="my-project",
278
+ description="Code knowledge base",
279
+ link="https://github.com/org/repo",
280
+ branch="main",
281
+ )
282
+
283
+ doc = Document(
284
+ version="v1",
285
+ meta=DocumentMeta(kind=DocumentKind.DATASOURCE, name=datasource.name),
286
+ spec=CodeDatasourceSpec.from_entity(datasource),
287
+ )
288
+ print(to_yaml(Bundle([doc])))
289
+ ```
290
+
291
+ Each of the other kinds has the matching `*DatasourceSpec.from_entity(request)`.
292
+
293
+ The svn, SharePoint, Xray and provider kinds in document form (svn,
294
+ SharePoint and Xray may carry a `setting_id`, the alias of an integration in
295
+ the bundle or live in the target project; a provider datasource may not, as the
296
+ platform does not store one):
297
+
298
+ ```yaml
299
+ spec: {type: svn, name: svn_kb, project_name: my-project, description: d,
300
+ link: "https://svn.example.com/repo", branch: trunk, index_type: code}
301
+ spec: {type: knowledge_base_sharepoint, name: sp_kb, project_name: my-project,
302
+ description: d, site_url: "https://example.sharepoint.com/sites/x",
303
+ auth_type: integration, setting_id: my-sharepoint-integration}
304
+ spec: {type: knowledge_base_xray, name: xray_kb, project_name: my-project,
305
+ description: d, jql: "project = X"}
306
+ spec: {type: provider, name: prov_kb, project_name: my-project, description: d,
307
+ provider_name: my-provider, toolkit_id: my-toolkit,
308
+ settings: {region: eu, api_key: "env:PROVIDER_API_KEY"}}
309
+ ```
310
+
311
+ The `region` literal above passes the offline name check and is accepted at plan/apply only when `provider_secret_lookup=`
312
+ reports that `region` is not secret (see below); without a lookup it must be an
313
+ `env:` reference too.
314
+
315
+ - **SharePoint OAuth uses an `access_token` reference.** The `oauth_codemie`
316
+ and `oauth_custom` auth types need an access token, which the platform never
317
+ stores or returns. A document carries it as `access_token: env:NAME`. The
318
+ token is optional in a document (an exported one has none), but creating such a
319
+ datasource, or updating it with a reindex, fails without it; a literal token
320
+ is rejected without echoing it. The value is read from the environment on
321
+ create and update. It is listed as not comparable in a plan.
322
+ `auth_type`, `oauth_client_id` and `oauth_tenant_id` are compared.
323
+ - **Provider secret settings are `env:` references.** Two checks apply.
324
+ Offline, `ProviderDatasourceSpec` makes a best-effort, name-based check: a
325
+ literal string under a secret-looking setting name (a whole name part such as
326
+ `password`, `secret`, `token`, `apikey`, `credential`, `passphrase`, or
327
+ `api`/`private`/`access`/`secret`/`auth` + `key`, or `client` + `secret`,
328
+ after splitting on punctuation and camelCase) is rejected, naming the
329
+ document and the setting path such as `settings.auth.api_key`, never the
330
+ value. `key_prefix`, `tokenizer` and `region` are not flagged, and `env:`
331
+ references, empty strings and non-strings pass. At plan or apply, before any
332
+ write, the platform's provider schema decides authoritatively which settings
333
+ are secret; a literal value in such a setting is rejected, naming the field,
334
+ including under names the offline check does not recognise. The value is read from the
335
+ environment only when writing and never appears in plans, errors or logs.
336
+ Pass `provider_secret_lookup=` to `BulkCreator` / `SingleEntityPlanner` (a
337
+ callable `(provider_name, toolkit_id) -> secret setting names`, normally
338
+ built from the provider schema). The lookup belongs to that planner or
339
+ creator only. Without one, or if it fails or returns something other than a
340
+ collection of names (a bare string, non-string names), the check fails
341
+ closed: every non-empty string provider setting must be an `env:`
342
+ reference, and the error says the schema lookup was unavailable and why (no
343
+ lookup configured, or the exception type the lookup raised). Settings without
344
+ a string (numbers, booleans, lists of numbers) are not checked; a list or map
345
+ is checked per string it contains. A lookup that returns an empty collection
346
+ is an answer, not a failure: the schema marks no setting secret. No caller
347
+ in this package supplies a lookup, so unless you pass one, a literal such as
348
+ `region: eu` is refused and must be an `env:` reference.
349
+ `name`, `project_name`, `setting_id`, `description` and
350
+ `project_space_visible` are reserved and rejected inside `settings`.
351
+ Every `env:` reference in the settings is checked before the first write,
352
+ not only the ones the schema calls secret.
353
+ - **Provider settings are compared key by key.** A key holding an `env:`
354
+ reference, or masked on the platform, is reported as not comparable
355
+ (`settings.<key>`); changes to the other keys still show in the plan.
356
+ `toolkit_id` cannot change: a different one is refused, recreate the
357
+ datasource.
358
+ On update, settings the document leaves out keep their stored values: the
359
+ non-secret ones are sent back (the platform would otherwise reset them to the
360
+ schema default), and the secret ones are left out, which keeps them (a read
361
+ returns a secret encrypted, and sending that back would encrypt it again).
362
+ Which ones are secret comes from `provider_secret_lookup`; without it, an
363
+ update that leaves out any stored setting is refused, naming the settings, so
364
+ list them in the document or pass a lookup. A provider
365
+ document takes no `cron_expression` or `timezone`, and a setting value that
366
+ starts with `env:` but is not a valid reference (`env:my-region`, `ENV:FOO`)
367
+ is rejected.
368
+ - **Create-only and optional fields.** An Xray `embedding_model` is used on
369
+ create only (the update route does not store it) and is not compared. An svn
370
+ `branch` left out is `trunk` on create and the stored branch on update.
371
+ - **Reindexing follows the plan.** As for code and Git FAQ datasources, an svn
372
+ update that changes only metadata (description, visibility, schedule) is sent
373
+ with `skip_reindex`. A SharePoint or Xray update that changes a source field
374
+ (`site_url`, `include_*`, `files_filter`, `jql`, auth fields, embedding model,
375
+ `setting_id`) is sent with `full_reindex`; for an OAuth SharePoint datasource
376
+ that needs the `access_token`. A forced write that changes no source field
377
+ reindexes nothing.
378
+ - **Provider settings are validated at plan time, not offline.** The settings
379
+ are free-form and schema-driven, so offline validation covers only the
380
+ envelope and that secret settings are `env:` references. Unknown or missing
381
+ provider settings are reported at plan time from the platform's provider
382
+ schema. svn, SharePoint and Xray are fully validated offline.
383
+ - **Skill categories are values.** A skill's `categories` are entries of the
384
+ platform's fixed list (at most 3), sent as written; unlike an assistant's
385
+ categories they are not Category documents and create no dependency.
386
+ - **Fields of the export round trip.** Documents also carry toolkit and tool
387
+ `auto_credentials_lookup`, an assistant's `hedging_config`,
388
+ `interactive_enabled`, `enable_image_generation` and `file_attachment_enabled`
389
+ (left out of a document, they keep the stored value),
390
+ an inline MCP config's `audience` and `auth_config` (an entry named
391
+ `client_secret`, `refresh_token`, `access_token`, `password`, `private_key`
392
+ and the like must be an `env:` reference; fields such as `token_url` or
393
+ `token_delivery` are plain values), a workflow's `start_hint` and its engine
394
+ switches (compared through `yaml_config`).
395
+ - A datasource create answers with a message only, so apply looks the new
396
+ datasource up by project and name and returns its id. If the platform does
397
+ not list it yet, the page cap (20 pages of 100) is exhausted, or the lookup
398
+ fails, the datasource is reported as created without an id and a warning is
399
+ logged (datasource, project and exception type only); the apply does not fail.
400
+ A provider datasource is updated by its platform id.
401
+
402
+ ### Assistant
403
+
404
+ ```python
405
+ from codemie_sdk.models.assistant import AssistantCreateRequest
406
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
407
+ from codemie_iac.specs.assistant import AssistantSpec
408
+
409
+ assistant = AssistantCreateRequest(
410
+ name="release-notes-writer",
411
+ description="Writes release notes from merged PRs",
412
+ system_prompt="You write concise, user-facing release notes.",
413
+ project="my-project",
414
+ llm_model_type="gpt-4o",
415
+ )
416
+
417
+ doc = Document(
418
+ version="v1",
419
+ meta=DocumentMeta(kind=DocumentKind.ASSISTANT, name=assistant.name),
420
+ spec=AssistantSpec.from_entity(assistant),
421
+ )
422
+ print(to_yaml(Bundle([doc])))
423
+ ```
424
+
425
+ `AssistantSpec` has more fields than this (toolkits, MCP servers, prompt
426
+ variables, ...). `from_entity` narrows all of them: a toolkit's or MCP
427
+ server's referenced `Integration` becomes just its name, and an MCP
428
+ server's `auth_token` becomes a `CredentialRef` keyed by that server's own
429
+ name — the same narrowing shown in the Integration example, just applied
430
+ automatically.
431
+
432
+ `AssistantSpec.skill_ids` lists the skills attached to the assistant. Each
433
+ entry is a reference resolved when the document is applied (see below), and
434
+ an omitted field leaves the skills attached on the platform untouched (they
435
+ are neither compared nor sent), while `skill_ids: []` detaches them all. The installed
436
+ `codemie-sdk-python` must carry `skill_ids` on the assistant create, update
437
+ and read models; if it does not, applying an assistant that sets `skill_ids`
438
+ (even `skill_ids: []`) fails (`unsupported_sdk`) before anything is written,
439
+ instead of silently dropping the skills. The pinned `codemie-sdk-python`
440
+ 0.1.713 carries it, so assistant `skill_ids` works with the pinned version.
441
+
442
+ **Resolving skill and datasource references.** An assistant's `skill_ids` and
443
+ a workflow agent's `skill_ids` and `datasource_ids` are written as names. Each
444
+ value is resolved in this order: (1) a document with that name in the bundle
445
+ wins, even if the value looks like an id; (2) otherwise the name is looked up
446
+ in the target project; (3) otherwise a value shaped like a platform id (UUID)
447
+ is sent unchanged, so documents holding raw ids keep working; (4) otherwise,
448
+ or when a name matches more than one entity, the apply fails with an error
449
+ naming the reference and the document holding it, before anything is written.
450
+ In-bundle skills and datasources are created before the assistant or workflow
451
+ that uses them. A value that falls under (3) is not checked against the
452
+ platform, so a mistyped, deleted or other-project id is only rejected when the
453
+ platform uses it; the apply logs a warning for each one. One failure can
454
+ happen after writes: a datasource or integration created earlier in the same
455
+ apply must show up in the platform's listing within about 30 seconds before a
456
+ document that references it by name can be created. If it does not, that
457
+ document fails with `unresolved_reference` and the entities already created
458
+ stay (apply the remaining documents again, not the whole bundle).
459
+
460
+ ### Workflow
461
+
462
+ A workflow is built with the SDK's own `WorkflowBuilder`, not hand-filled
463
+ field by field like the other five kinds. `WorkflowSpec` wraps the resulting
464
+ `WorkflowDefinition` directly — one file, same as every other kind:
465
+
466
+ ```python
467
+ from codemie_sdk.builders.workflow.builder import WorkflowBuilder
468
+ from codemie_sdk.builders.workflow.definition import WorkflowNextState
469
+ from codemie_sdk.models.workflow import WorkflowMode
470
+ from codemie_iac import Document, DocumentMeta, DocumentKind, Bundle, to_yaml
471
+ from codemie_iac.specs.workflow import WorkflowSpec
472
+
473
+ workflow = (
474
+ WorkflowBuilder("release-notes")
475
+ .with_description("Generate release notes from merged PRs")
476
+ .with_mode(WorkflowMode.SEQUENTIAL)
477
+ .add_assistant("writer", system_prompt="Summarize the given PRs as release notes.")
478
+ .add_state("draft", "writer", "Draft the release notes", next=WorkflowNextState())
479
+ .render()
480
+ )
481
+
482
+ doc = Document(
483
+ version="v1",
484
+ meta=DocumentMeta(kind=DocumentKind.WORKFLOW, name=workflow.name),
485
+ spec=WorkflowSpec.from_entity(workflow),
486
+ )
487
+ print(to_yaml(Bundle([doc])))
488
+ ```
489
+
490
+ `name`, `description`, `shared`, and `icon_url` all come from `workflow`
491
+ itself — nothing is copied onto a sibling field, so nothing can drift out of
492
+ sync with it. The platform's own flattened `yaml_config` text
493
+ (`workflow.to_yaml_config()`) is not generated here at all; that happens
494
+ later, when `plan_apply` publishes the workflow.
495
+
496
+ **Credential narrowing for inline MCP servers.** An inline assistant's MCP
497
+ server config (`WorkflowMCPServer.config`) is typed `MCPServerConfig` — the
498
+ same model `MCPServerDetails.config` already uses on `AssistantCreateRequest`
499
+ — so `WorkflowSpec.from_entity` narrows it by reusing
500
+ `MCPServerConfigSpec.from_entity` wholesale: `auth_token` becomes a
501
+ `CredentialRef` (also listed in `credential_values`, same `{key, ref}` shape
502
+ as `IntegrationSpec.credential_values`), and any `env`/`headers`/`args`/
503
+ `url` value already shaped like a reference (`"env:SOME_REF"`) is recognized
504
+ too — the same narrowing `AssistantSpec` gets for its own MCP servers,
505
+ nothing weaker. `auth_token` is also re-checked on every `WorkflowSpec`,
506
+ including one built directly from model instances or loaded from a file, not
507
+ just one produced by `from_entity` — a literal value there is always
508
+ rejected. The `env`/`headers`/`args`/`url` fields are not: as noted above,
509
+ narrowing them is a best-effort, whole-value match, never an enforced
510
+ guarantee.
511
+
512
+ ## Plan and apply against the platform
513
+
514
+ `codemie_iac.plan_apply` is the only part of this package that talks to the
515
+ platform. It does so by calling `codemie_sdk` services (you pass in the SDK
516
+ client); the rest of the library stays offline. Ground rules:
517
+
518
+ - **Platform ids are passed in and returned, never stored.** A document never
519
+ contains a platform id and nothing is written to a file. Ids are held in
520
+ memory for one run, substituted into request bodies, and handed back in the
521
+ result.
522
+ - **Apply never deletes anything.** Not in bulk, not for a single entity.
523
+ - **Bulk apply is create-only and dependency-ordered.** An entity whose name
524
+ or content equals an existing one is still created; there is no dedupe, no
525
+ update, and no scoped apply. All checks (dependency cycles, unsupported
526
+ kinds, unresolved references, unresolvable credentials) run before the first
527
+ write, so a bad bundle fails without creating anything.
528
+ - **Single-entity plan/apply works by id.** You give the id of the live
529
+ entity; `plan` diffs the document against it with no writes, and `apply`
530
+ updates it (or creates it when no id is given).
531
+ - Credential references (`env:NAME`) are resolved from the environment at
532
+ apply time (`plan` does not need them: an unset variable is reported as an
533
+ unresolvable `CannotCompare`). Masked live values are reported as
534
+ `CannotCompare`, never as a difference, and no secret value appears in any
535
+ result.
536
+ - **An empty plan sends no write.** Fields that cannot be compared (a rotated
537
+ secret, a masked value) do not make a plan non-empty; `apply` lists them in
538
+ `ApplyResult.uncomparable`. Pass `force=True` to write the full document
539
+ anyway, e.g. to rotate a secret.
540
+ - **A field the document leaves unset is not compared.** The platform may fill
541
+ it (an assistant's slug, a datasource's default timezone) and a write never
542
+ sends it. To clear a value, author it empty (`""`, `[]`). The one exception is
543
+ `icon_url` on an assistant or workflow: omitting it clears an icon set on the
544
+ platform, and `plan` reports the difference first.
545
+ - **A document's `meta.name` must equal the entity's own name** (the spec
546
+ `name`, the workflow's `name`, or the integration's `alias`). References and
547
+ the live lookup go by `meta.name`, while the platform uses the spec name, so
548
+ a difference is refused with `name_mismatch` before anything is written.
549
+ - **Updates reindex only when the source changed.** A code datasource whose
550
+ plan differs only in metadata (description, visibility, schedule) is updated
551
+ with `skip_reindex`. For Git FAQ, Jira, Confluence, Azure DevOps and xWiki
552
+ datasources a changed source (for example `jql`, `cql`, `link`, `branch`)
553
+ is sent with `full_reindex`, because those routes store a new source and
554
+ keep the old index otherwise. A Git FAQ update without a source change
555
+ leaves its source fields out, as the backend rejects them without a full
556
+ reindex. `force=True` re-sends the document but follows the same rule: a
557
+ forced write that only pushes a rotated secret reindexes nothing.
558
+ - **Fields an update cannot change are not compared.** The create-only
559
+ settings (Confluence `include_*` and `keep_*` flags, a code datasource's
560
+ `index_type` and `summarization_model`, a Git FAQ `embedding_model`) and the
561
+ Azure DevOps `organization`/`project` (not stored by the platform) are
562
+ written on create and never reported as a difference. Changing the
563
+ document of a Google datasource is refused (`unsupported_datasource_change`),
564
+ as its route cannot take a new one.
565
+ - **An assistant the platform declines is a failure.** When a tool has no
566
+ integration the platform can use, it answers HTTP 200 with a validation
567
+ result and saves nothing; that is reported as `integration_missing`, in
568
+ bulk create (nothing is recorded as created) and in single apply.
569
+ - **Skill categories are values.** They are the platform's fixed list, sent as
570
+ written and checked before the first write; assistant categories still
571
+ reference Category documents by name.
572
+ - **Rejected calls are scrubbed.** A platform rejection (the SDK raises
573
+ `requests.HTTPError`) becomes a `PlatformRejectionError` holding only the
574
+ status, a scrubbed message and the parsed field errors; the original
575
+ exception, whose request holds the resolved credentials, is not kept.
576
+ Secrets are also replaced in their JSON-escaped, URL-encoded, YAML-quoted
577
+ and base64 forms. The SDK logs request bodies at `DEBUG` level, credentials
578
+ included; the engine raises the `codemie_sdk.utils.http` logger to `INFO`
579
+ while it sends a write.
580
+
581
+ ```python
582
+ from codemie_sdk import CodeMieClient
583
+ from codemie_iac import from_yaml
584
+ from codemie_iac.plan_apply import BulkCreator, SingleEntityPlanner
585
+
586
+ client = CodeMieClient(...) # your usual SDK client
587
+ bundle = from_yaml(open("bundle.yaml").read())
588
+
589
+ # Create everything in the bundle, dependencies first.
590
+ report = BulkCreator(client).create_all(bundle, target="my-project")
591
+ for item in report.created:
592
+ print(item.kind, item.name, item.id) # None for datasources and integrations
593
+ if report.failed: # stops at the first failure
594
+ print(report.failed.error_type, report.failed.reason)
595
+
596
+ # One entity, by id.
597
+ planner = SingleEntityPlanner(client)
598
+ document = next(iter(bundle))
599
+ plan = planner.plan(document, entity_id="<platform id>", target="my-project")
600
+ for d in plan.differences:
601
+ print(d.field, d.document_value, d.live_value)
602
+ if not plan.is_empty:
603
+ result = planner.apply(document, entity_id="<platform id>", target="my-project")
604
+ print(result.id, result.created)
605
+ ```
606
+
607
+ Bulk create is not idempotent: it never looks for an existing entity, so
608
+ running it again after a partial failure creates the first entities a second
609
+ time (the report lists what was created, so rerun only the rest). A timeout or
610
+ connection error on a create is reported as `apply_failed`, but the entity may
611
+ exist; check before retrying. Datasource and integration ids are not returned
612
+ (the backend answers a create with a message only); referenced ones are found
613
+ by name afterwards.
614
+
615
+ `target` is the project the entities live in. Failures raise or report an
616
+ `ApplyError` (`PlatformRejectionError`, `UnresolvedReferenceError`,
617
+ `UnresolvableCredentialError`) that names the entity kind and name.
618
+
619
+ ## Not supported
620
+
621
+ Some things are refused up front, with a clear error, before anything is
622
+ written.
623
+
624
+ **Workflow state references are not resolved by name.** A workflow's
625
+ `states[].workflow_id` is not resolved by name or ordered (its agents'
626
+ `skill_ids` and `datasource_ids` are, see above), and a workflow needs a
627
+ non-empty description. `from_entity` copies the ids and names an entity
628
+ carries; it does not turn platform ids into the names this tool resolves, so
629
+ build documents with names.
630
+
631
+ **A datasource cannot be renamed or moved to another project.** If the
632
+ document's datasource name or project differs from the live datasource you
633
+ point `plan`/`apply` at, you get:
634
+
635
+ ```
636
+ datasource/<name>: renaming or moving a datasource is not supported: document is '<name>' in project '<project>', live is '<live name>' in project '<live project>'
637
+ ```
638
+
639
+ (error type `datasource_identity_mismatch`). Instead, create a new datasource
640
+ with the new name or project, then update the assistants that use the old one
641
+ so they point at the new one.
642
+
643
+ **File datasources cannot be created or updated.** A document carries no file
644
+ content, so there is nothing to upload. You get:
645
+
646
+ ```
647
+ datasource/<name>: datasource type 'knowledge_base_file': file datasources are not supported
648
+ ```
649
+
650
+ (error type `unsupported_datasource_type`). In a bulk run this is caught
651
+ before the first write, so nothing is created.
652
+
653
+ A datasource's `setting_id` is read as the alias of an integration (in the
654
+ bundle or live in the target project) and replaced by its platform id on
655
+ write.
656
+
657
+ **An entity in another project is never overwritten.** Planning or applying an
658
+ update to an entity whose live project differs from the target fails with
659
+ `project_mismatch` (for a datasource it is `datasource_identity_mismatch`, see
660
+ above), and so does a document (assistant, skill, integration, datasource)
661
+ whose own project is not the target, in single apply and in bulk preflight.
662
+
663
+ **The project of a document is optional.** `AssistantSpec.project`,
664
+ `SkillSpec.project`, `IntegrationSpec.project_name` and every datasource's
665
+ `project_name` default to `None`. The engine (`BulkCreator`,
666
+ `SingleEntityPlanner`) fills an omitted one with the target project before
667
+ planning or applying, for the CLI and library callers alike. A project that is
668
+ named and differs from the target is refused (`project_mismatch`).
669
+
670
+ **Required fields mirror the platform.** A code datasource document needs
671
+ `link`, `branch` and `index_type` (the platform's create request requires all
672
+ three), on update as well as create, because the document is the full desired
673
+ state. A skill's `name` must be kebab-case (`^[a-z0-9][a-z0-9-]{1,62}[a-z0-9]$`),
674
+ its `description` 10 to 1000 characters, its `content` at least 100 characters,
675
+ and it takes at most 3 `categories`. A document that breaks these is rejected
676
+ before anything is sent.
677
+
678
+ ## Where things live
679
+
680
+ ```
681
+ src/codemie_iac/
682
+ envelope.py # Document, DocumentMeta, DocumentKind, Bundle
683
+ credentials.py # CredentialRef
684
+ resolver.py # ReferenceResolver
685
+ serializer.py # to_yaml / from_yaml
686
+ schema.py # document_json_schema, validate_document
687
+ specs/ # one Spec class per resource kind
688
+ plan_apply/ # bulk create and single-entity plan/apply (uses codemie_sdk)
689
+ ```
690
+
691
+ ## CLI
692
+
693
+ ```
694
+ codemie-iac [-c/--config codemie.yaml] init [--force]
695
+ codemie-iac [--project NAME] [-c/--config codemie.yaml] [--env-file PATH] plan <file> --id <id> [--json]
696
+ codemie-iac [--project NAME] [-c/--config codemie.yaml] [--env-file PATH] apply <path> [--id <id>] [--json]
697
+ ```
698
+
699
+ Global flags `--project`, `-c/--config` and `--env-file` go BEFORE the
700
+ subcommand; `--json` goes after it.
701
+
702
+ **`init`** writes a `codemie.yaml` template to the `-c/--config` path (default
703
+ `./codemie.yaml`) and needs no login. If the file already exists the command
704
+ fails (exit 4) and leaves it untouched; `--force` replaces it. Every value in
705
+ the template is `${NAME:-}`, so fill the variables from the shell or `.env`, or
706
+ rename them.
707
+
708
+ The `project` of a document (`project_name` for integrations and datasources)
709
+ is optional and defaults to the target project. A different explicit value is
710
+ refused with `project_mismatch`.
711
+
712
+ ### `codemie.yaml`
713
+
714
+ `plan` and `apply` read all connection settings from `./codemie.yaml` (or the
715
+ `-c` path); a missing file is a config error (exit 4). Unknown keys are ignored
716
+ with one warning on stderr naming the key path (never the value). The
717
+ `version`, `imported`, `tool_definitions`, `datasource_defaults` and
718
+ `resources` keys of the Node.js tool and `project.description` are accepted
719
+ and not inspected. `$import` (a modular Node.js config) is not supported: write
720
+ the `project` and `environment` keys inline.
721
+
722
+ | Key | Required | Meaning |
723
+ |---|---|---|
724
+ | `project.name` | yes, unless `--project` is given | target project |
725
+ | `environment.codemie_api_url` | yes | platform API URL |
726
+ | `environment.username`, `environment.password` | local login; remote password grant | username and password |
727
+ | `environment.auth_server_url`, `environment.auth_realm_name` | remote login | Keycloak URL and realm |
728
+ | `environment.client_id` | remote login | Keycloak client; with `client_secret` it is the production path, with `username` + `password` a password grant |
729
+ | `environment.client_secret` | remote client credentials | client secret |
730
+ | `environment.verify_ssl` | no | `true` (default) or `false`; empty means `true`; `false` prints a warning |
731
+
732
+ An empty value counts as missing. String values may reference variables:
733
+ `${NAME}` or `${NAME:-default}`. An unset or empty `${NAME}` without a default
734
+ is a config error (exit 4) naming the variable; write `${NAME:-}` where an
735
+ empty value is fine. This applies to the whole file, including sections the CLI
736
+ does not validate. A `$` not followed by `{` is left as is. Values come from
737
+ the real environment and from `.env`, which only fills in unset names.
738
+
739
+ ```yaml
740
+ project:
741
+ name: ${CODEMIE_PROJECT:-}
742
+ environment:
743
+ codemie_api_url: ${CODEMIE_API_URL:-}
744
+ username: ${CODEMIE_USERNAME:-}
745
+ password: ${CODEMIE_PASSWORD:-}
746
+ ```
747
+
748
+ **Local login.** A `codemie_api_url` containing `localhost`, `127.0.0.1`,
749
+ `0.0.0.0` or `192.168` (case-insensitive, anywhere in the URL, so
750
+ `https://localhost.example.com` counts too; the same rule as the SDK) logs in
751
+ with `username` and `password`. Both are required; no Keycloak settings are
752
+ needed.
753
+
754
+ **Remote login (Keycloak).** Any other URL needs `auth_server_url`,
755
+ `auth_realm_name` and `client_id`, plus one of:
756
+
757
+ - `client_secret`: client credentials, the production path. Use one service
758
+ account per environment and keep its secret in a masked CI variable,
759
+ referenced by name (for example `client_secret: ${CODEMIE_CLIENT_SECRET}`).
760
+ - `username` + `password`: a password grant for the named `client_id`.
761
+
762
+ Setting `client_secret` together with `username` or `password` is a config
763
+ error: the SDK would log in as the user, the service account is a different
764
+ identity, so the CLI does not pick one for you. `username` and `password` without `client_id` are not
765
+ enough for a remote URL. Incomplete settings stop the CLI before it contacts
766
+ the platform, and the error names the missing `environment.*` keys.
767
+
768
+ **Breaking change.** JWT mode (`environment.jwt_token`, `CODEMIE_JWT_TOKEN`),
769
+ the legacy `api:` section and the fixed-name `CODEMIE_*` variables
770
+ (`CODEMIE_API_URL`, `CODEMIE_PROJECT`, `CODEMIE_VERIFY_SSL` and the rest) are
771
+ no longer read. `jwt_token` and `api:` are now unknown keys (a warning); to keep
772
+ using a variable, reference it from `codemie.yaml` as `${NAME}`. A configuration
773
+ error raised while a command runs now exits 4 (it used to exit 2). A Node.js
774
+ `codemie.yaml` that pulls `environment` in with `$import` no longer works; put
775
+ the keys inline.
776
+
777
+ **Trusted input.** `codemie.yaml` in the working directory decides which API
778
+ URL receives the credentials expanded from your shell. Treat it like a
779
+ Makefile: do not run the CLI in a repository you do not trust.
780
+
781
+ The SDK comparison test (`tests/cli/test_sdk_local_rule.py`) checks the local
782
+ URL rule and the login behaviour against the pinned SDK; rerun it on every
783
+ change of the pin.
784
+
785
+ Creating assistant categories needs administrator rights on the platform; this
786
+ has not been verified against the backend yet.
787
+
788
+ `.env`: if `./.env` exists in the current directory it is read (a missing one is
789
+ ignored); `--env-file PATH` reads that file instead (missing or unreadable is a
790
+ config error, exit 4). Lines are `KEY=VALUE`; blank lines, `#` comments and an
791
+ optional `export ` prefix are handled, matching single/double quotes around the
792
+ value are stripped, an inline ` # comment` after a value is dropped, `${}` is not expanded, and lines with an invalid key are
793
+ skipped. Variables already set in the real environment always win; `.env` only
794
+ fills in unset ones (nothing is written to `os.environ`). `${NAME}` references
795
+ in `codemie.yaml` see the merged values, and so do `env:NAME` credential references
796
+ in `plan` and `apply` (so a secret like `JIRA_PROD_API_TOKEN` can live in `.env`;
797
+ `plan` only checks that the name is set, it never reads the value).
798
+
799
+ Exit codes: 0 success / nothing to do, 1 changes pending, 2 apply failed,
800
+ 3 unresolved input, 4 config error, 5 invalid document.
801
+
802
+ ### Examples
803
+
804
+ Example documents live in [`examples`](examples). Each file in
805
+ the groups below is one document, except that `batch/` is a folder meant to
806
+ be applied together.
807
+
808
+ **Single mode: one file, one document.**
809
+
810
+ ```
811
+ codemie-iac --project my-project plan examples/simple/assistant.yaml --id <id>
812
+ codemie-iac --project my-project apply examples/simple/assistant.yaml
813
+ ```
814
+
815
+ **Batch mode: a directory.** `apply <dir>` creates every `*.yaml` / `*.yml`
816
+ file directly in that directory (not recursive), in dependency order, so
817
+ documents may reference each other by name (the `batch/` example:
818
+ integration, datasource, category, assistant).
819
+
820
+ ```
821
+ codemie-iac --project my-project apply examples/batch
822
+ ```
823
+
824
+ **Create:** `apply <file>` without `--id`, or `apply <dir>`.
825
+
826
+ ```
827
+ codemie-iac --project my-project apply examples/simple/skill.yaml
828
+ ```
829
+
830
+ **Update:** `apply <file> --id <id>` updates the existing asset with that
831
+ platform id. `plan <file> --id <id>` shows the changes without applying them
832
+ (exit code 1 when changes are pending); add `--json` for machine-readable
833
+ output.
834
+
835
+ ```
836
+ codemie-iac --project my-project apply examples/simple/skill.yaml --id <id>
837
+ codemie-iac --project my-project plan examples/simple/skill.yaml --id <id>
838
+ codemie-iac --project my-project plan examples/simple/skill.yaml --id <id> --json
839
+ ```
840
+
841
+ Global flags (`--project`, `-c`) go before the subcommand, `--json` after it.
842
+ Credentials in the examples are `env:NAME` references; export those variables
843
+ before applying. IDs inside workflows (`workflow_id`, `datasource_ids`,
844
+ `skill_ids`) are placeholders, or names of skills and datasources that are
845
+ resolved at apply time.
846
+
847
+ **Example files**
848
+
849
+ Simple (one per asset type):
850
+
851
+ - [`simple/assistant.yaml`](examples/simple/assistant.yaml)
852
+ - [`simple/category.yaml`](examples/simple/category.yaml)
853
+ - [`simple/datasource.yaml`](examples/simple/datasource.yaml)
854
+ - [`simple/integration.yaml`](examples/simple/integration.yaml)
855
+ - [`simple/integration_openapi.yaml`](examples/simple/integration_openapi.yaml) (prefixed credential keys)
856
+ - [`simple/skill.yaml`](examples/simple/skill.yaml)
857
+ - [`simple/workflow.yaml`](examples/simple/workflow.yaml)
858
+
859
+ Assistant with one integration:
860
+
861
+ - [`assistant-integrations/assistant_with_datasource.yaml`](examples/assistant-integrations/assistant_with_datasource.yaml)
862
+ - [`assistant-integrations/assistant_with_mcp_server.yaml`](examples/assistant-integrations/assistant_with_mcp_server.yaml)
863
+ - [`assistant-integrations/assistant_with_tool.yaml`](examples/assistant-integrations/assistant_with_tool.yaml)
864
+
865
+ Workflow node types:
866
+
867
+ - [`workflow-nodes/assistant_state.yaml`](examples/workflow-nodes/assistant_state.yaml)
868
+ - [`workflow-nodes/sub_workflow_state.yaml`](examples/workflow-nodes/sub_workflow_state.yaml)
869
+ - [`workflow-nodes/tool_state.yaml`](examples/workflow-nodes/tool_state.yaml)
870
+ - [`workflow-nodes/transform_node.yaml`](examples/workflow-nodes/transform_node.yaml)
871
+
872
+ Workflow routing styles:
873
+
874
+ - [`workflow-routing/condition.yaml`](examples/workflow-routing/condition.yaml)
875
+ - [`workflow-routing/iterator.yaml`](examples/workflow-routing/iterator.yaml)
876
+ - [`workflow-routing/next_state.yaml`](examples/workflow-routing/next_state.yaml)
877
+ - [`workflow-routing/parallel_next_states.yaml`](examples/workflow-routing/parallel_next_states.yaml)
878
+ - [`workflow-routing/switch.yaml`](examples/workflow-routing/switch.yaml)
879
+
880
+ Workflow inline assistants:
881
+
882
+ - [`workflow-assistants/with_datasource_ids.yaml`](examples/workflow-assistants/with_datasource_ids.yaml)
883
+ - [`workflow-assistants/with_skill_ids.yaml`](examples/workflow-assistants/with_skill_ids.yaml)
884
+ - [`workflow-assistants/with_tools.yaml`](examples/workflow-assistants/with_tools.yaml)
885
+
886
+ Batch folder (related documents):
887
+
888
+ - [`batch/01-integration.yaml`](examples/batch/01-integration.yaml)
889
+ - [`batch/02-datasource.yaml`](examples/batch/02-datasource.yaml)
890
+ - [`batch/03-category.yaml`](examples/batch/03-category.yaml)
891
+ - [`batch/04-assistant.yaml`](examples/batch/04-assistant.yaml)
892
+