You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: align CREATE AGENT syntax with CREATE REST CLIENT
Reshapes the CREATE AGENT syntax to match the established REST CLIENT
pattern: top-level (Key: Value) config plus a {...} body with singular
TOOL, KNOWLEDGE BASE, and MCP SERVICE blocks, each with their own
(Key: Value) properties.
Changes:
- Moved Variables into inline config property (matches REST CLIENT's
Parameters: ($id: String) style)
- Replaced TOOLS (...) / KNOWLEDGE BASES (...) / MCP SERVICES (...)
separate clauses with TOOL / KNOWLEDGE BASE / MCP SERVICE blocks
inside a {...} body
- Tool/KB/MCP properties (Microflow, Description, Access, Collection,
MaxResults, MinSimilarity) use the regular Key: Value form instead
of positional keywords
- Body is omitted when there are no tools/KB/MCP
- ALTER AGENT revised to use SET/INSERT/DROP operations inside a {...}
body, matching ALTER PAGE
- Updated all seven examples and the DESCRIBE AGENT sample output
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SystemPrompt: 'Translate the given text into {{Description}}.',
109
110
UserPrompt: 'What is a multi-agent AI system?...'
110
-
)
111
-
VARIABLES (
112
-
"Description" ENTITY ATTRIBUTE
113
111
);
114
112
/
115
113
```
116
114
117
115
### CREATE AGENT
118
116
119
-
Simple task agent:
117
+
The syntax follows the same shape as `CREATE REST CLIENT`: top-level configuration in `(...)` followed by a `{...}` body containing one block per attached resource (`TOOL`, `KNOWLEDGE BASE`, `MCP SERVICE`). Simple agents with no resources omit the body entirely.
118
+
119
+
**Simple task agent (no body needed):**
120
120
121
121
```sql
122
122
CREATE AGENT MyModule."SentimentAnalyzer" (
123
123
UsageType: Task,
124
124
Entity: MyModule.FeedbackItem,
125
+
Variables: ("FeedbackText": EntityAttribute),
125
126
SystemPrompt: 'Analyze the sentiment of {{FeedbackText}}. Classify as positive, negative, or neutral.',
126
127
UserPrompt: '{{FeedbackText}}'
127
-
)
128
-
VARIABLES (
129
-
"FeedbackText" ENTITY ATTRIBUTE
130
128
);
131
129
```
132
130
133
-
Agent with tools, knowledge bases, and MCP services:
131
+
**Agent with tools, knowledge bases, and MCP services:**
134
132
135
133
```sql
136
134
CREATE AGENT MyModule."ResearchAssistant" (
137
135
UsageType: Conversational,
138
136
Description: 'Research assistant with tools and knowledge base',
139
-
SystemPrompt: 'You are a research assistant.',
137
+
Variables: ("Topic": String),
138
+
SystemPrompt: 'You are a research assistant helping research {{Topic}}.',
140
139
UserPrompt: 'What are the latest trends in renewable energy?'
@@ -173,13 +178,14 @@ DROP AGENT MyModule."SentimentAnalyzer"
173
178
| Decision | Rationale |
174
179
|----------|-----------|
175
180
|`AGENT` as document type keyword | Matches `Metadata.ReadableTypeName = "Agent"` and Mendix UI terminology |
176
-
|`UsageType: Task` in properties | Follows standard `(Key: value)` property pattern used by all MDL commands |
177
-
|`VARIABLES`, `TOOLS`, `KNOWLEDGE BASES`, `MCP SERVICES` as separate clauses | Each is structurally distinct; clauses keep the property block readable and mirror the Agent Editor UI's tabbed sections |
178
-
|`ENTITY ATTRIBUTE` modifier on variables | Distinguishes entity-bound variables (auto-replaced from context object attributes) from free-form template variables |
179
-
|`ACCESS` modifier on tools/MCP | Maps to `GenAICommons.ENUM_UserAccessApproval` (`HiddenForUser` / `VisibleForUser` / `UserConfirmationRequired`) |
180
-
| Tools reference microflows by qualified name | Matches the Agent Editor behavior: the microflow signature becomes the tool JSON schema |
181
-
| Knowledge bases reference KB documents (future Phase 4 addition) | KB documents are a separate `CustomBlobDocument` type that also needs MDL support |
182
-
| MCP services reference ConsumedMCPService documents (Phase 4) | Same pattern as KB — a separate document type for MCP server configs |
181
+
| Top-level `(Key: Value)` config + `{...}` body with singular blocks | Mirrors `CREATE REST CLIENT ... (...) { OPERATION Name {...} }` exactly — same shape, same mental model |
182
+
|`TOOL`, `KNOWLEDGE BASE`, `MCP SERVICE` as singular block types | Matches the `OPERATION` singular used in REST CLIENT; each block defines one resource |
183
+
|`TOOL <Name> { Microflow: ..., Description: ..., Access: ... }`|`Microflow`, `Description`, `Access` are regular properties (not positional), same as REST CLIENT operation properties |
184
+
|`KNOWLEDGE BASE <QualifiedName>` (module-qualified) | The name references an external KB document (peer `CustomBlobDocument`), not a free-form identifier |
185
+
|`MCP SERVICE <QualifiedName>` (module-qualified) | Same rationale — references a ConsumedMCPService document |
186
+
|`Variables: ("Name": EntityAttribute, ...)` inline | Variables are 1–2 properties each; inline matches how REST CLIENT handles `Parameters: ($id: String)` and `Headers: ('Accept' = 'application/json')`|
187
+
|`Access: VisibleForUser` as enum literal | Maps to `GenAICommons.ENUM_UserAccessApproval` values: `HiddenForUser`, `VisibleForUser`, `UserConfirmationRequired`|
188
+
| Body omitted when there are no tools/KB/MCP | Same concession REST CLIENT makes implicitly — empty bodies are awkward; drop them |
183
189
| Prompts as string literals | Consistent with other MDL string properties; `{{var}}` placeholders are just text |
184
190
185
191
> **Note on tool storage:** In the 4 observed agents in the test3 project, the `tools`, `knowledgebaseTools`, and MCP arrays in the `Contents` JSON are empty — all the sample agents are simple `Task` agents without tools. According to the [Agent Editor documentation](https://docs.mendix.com/appstore/modules/genai/genai-for-mx/agent-editor/), tools and knowledge bases ARE configured on the agent in the editor (not at runtime), so the `Contents` JSON schema supports them. Implementation will need to verify the exact JSON shape with an agent that has tools attached — a known gap flagged in the Open Questions section.
@@ -295,7 +301,7 @@ In `sdk/mpr/writer_agent.go`:
295
301
#### 2.3 Validation
296
302
297
303
- Entity reference must exist (if specified)
298
-
- Variables marked `ENTITY ATTRIBUTE` must correspond to attributes on the referenced entity
304
+
- Variables marked `EntityAttribute` must correspond to attributes on the referenced entity
299
305
- `UsageType` must be a known value (`Task` or `Conversational`)
300
306
- Variable names used in `{{...}}` in prompts should match declared variables (warning, not error)
@@ -1580,7 +1611,7 @@ The combination of `CREATE AGENT` (document definition), tool microflows (busine
1580
1611
1581
1612
2.**Contents JSON schema for tools/KB/MCP**: All 4 observed agents in the test3 project have empty `tools`, `knowledgebaseTools`, and MCP arrays. Per the [Agent Editor docs](https://docs.mendix.com/appstore/modules/genai/genai-for-mx/agent-editor/), tools ARE attached to the agent document in the editor — we need to observe the exact JSON shape (keys, nesting, how microflow references are serialized) with a non-empty example before finalizing the writer. Request: user creates an agent with one tool and one KB in Studio Pro so we can capture the BSON.
1582
1613
1583
-
3.**Separate document types for Model, Knowledge Base, and MCP Service**: The Agent Editor treats these as peer document types. To fully support the `TOOLS (...)`, `KNOWLEDGE BASES (...)`, and `MCP SERVICES (...)` clauses, the implementation must also support:
1614
+
3.**Separate document types for Model, Knowledge Base, and MCP Service**: The Agent Editor treats these as peer document types. To fully support the `TOOL`, `KNOWLEDGE BASE`, and `MCP SERVICE` blocks inside an agent body, the implementation must also support:
1584
1615
-`CREATE MODEL` (document with model key constant reference)
1585
1616
-`CREATE KNOWLEDGE BASE` (document with KB resource key reference)
1586
1617
-`CREATE CONSUMED MCP SERVICE` (document with endpoint, protocol, credentials microflow)
0 commit comments