DRAFT: fixes & comments on agent document proposal#214
DRAFT: fixes & comments on agent document proposal#214tinaengel-mx wants to merge 3 commits intomendixlabs:mainfrom
Conversation
AI Code ReviewWhat Looks GoodThe PR updates the agent document proposal with several valuable improvements:
RecommendationApprove - This PR improves the accuracy and clarity of a proposal document based on observed agent document behavior. Since it only updates documentation (no code or MDL syntax changes), most checklist items don't apply, and the documentation updates are appropriate and helpful for future implementation work. The "DRAFT" status is correctly maintained as this is still a proposal under discussion. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
|
|
||
| Output: | ||
|
|
||
| | Qualified Name | Module | Name | UsageType | Entity | Variables | |
There was a problem hiding this comment.
I don't think entity & variables are super relevant for an overview
| CustomBlobDocuments$CustomBlobDocument: | ||
| $ID: bytes | ||
| $Type: "CustomBlobDocuments$CustomBlobDocument" | ||
| Name: string | ||
| Contents: string (JSON payload — schema depends on CustomDocumentType) | ||
| CustomDocumentType: "agenteditor.agent" | ||
| | "agenteditor.model" | ||
| | "agenteditor.knowledgebase" | ||
| | "agenteditor.consumedMCPService" | ||
| Documentation: string | ||
| Excluded: bool | ||
| ExportLevel: "Hidden" | ||
| Metadata: | ||
| $ID: bytes | ||
| $Type: "CustomBlobDocuments$CustomBlobDocumentMetadata" | ||
| CreatedByExtension: "extension/agent-editor" | ||
| ReadableTypeName: "Agent" | "Model" | "Knowledge base" | "Consumed MCP service" | ||
| ``` |
There was a problem hiding this comment.
afaik customblobdocuments only have these properties exposed
$ID: "",
name: "",
excluded: false,
documentType: agentDocumentTypeId, //i.e. agenteditor.agent
contents: createNewAgent(), //json
There was a problem hiding this comment.
I can only speak for the extensions-api, what's readable from a dump-mpr might be different
AI Code ReviewCritical Issues
Moderate Issues
What Looks Good
RecommendationRequest changes to add version gating plan per checklist. Once version compatibility items are addressed in the proposal, the PR can proceed. No code changes are needed in this documentation-only PR, but the proposal must include the missing version awareness elements before implementation begins. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
see my comment at the top. afaik not all of these properties are exposed for custom blob documents
Correction to my earlier reviewOn re-reading, I was too quick to treat Tina's edits as corrections to the BSON. The original proposal was written by inspecting a real project's BSON; I should have verified before accepting changes that contradict it. Checked the shipping parser:
So the field name in the actual BSON is Stepping back, the edits in this PR are three different kinds of change that need different handling:
My original "what's valuable" list conflated (2) and (3). Only (3) is unambiguously valuable without more evidence. Net recommendation: revert the |
| agent_document: | ||
| min_version: "11.9.0" | ||
| mdl: "CREATE AGENT Module.Name (...) { TOOL ... { ... } ... }" | ||
| notes: "Requires AgentEditorCommons marketplace module" |
There was a problem hiding this comment.
AgentEditorCommons itself has many dependencies; see https://docs.mendix.com/appstore/modules/genai/genai-for-mx/agent-editor/#dependencies
|
|
||
| | MDL Statement | Java Action | Purpose | | ||
| |---------------|-------------|---------| | ||
| | `CALL AGENT WITH HISTORY $agent REQUEST $req [CONTEXT $obj] INTO $Response` | `AgentCommons.Agent_Call_WithHistory` | Call a conversational agent with chat history | | ||
| | `CALL AGENT WITHOUT HISTORY $agent [CONTEXT $obj] [REQUEST $req] [FILES $fc] INTO $Response` | `AgentCommons.Agent_Call_WithoutHistory` | Call a single-call (Task) agent | | ||
| | `NEW CHAT FOR AGENT $agent ACTION MICROFLOW <mf> [CONTEXT $obj] [MODEL $dm] INTO $ChatContext` | `AgentCommons.ChatContext_Create_ForAgent` | Create a ChatContext wired to an agent | |
There was a problem hiding this comment.
These are actions that require an agent object (not agent document) as input. In the toolbox in the agent editor section, there is now also a call agent acitvity, which is the preferred way when using the agent editor. It is called: AgentEditorCommons.Agent_CallDocument_WithoutHistory
A with history operation will be added soon as well.
| ```sql | ||
| ALTER AGENT MyModule."SentimentAnalyzer" { | ||
| SET SystemPrompt = 'New prompt with {{Variable}}.'; | ||
| SET Variables = ("FeedbackText": EntityAttribute, "NewVar": String); |
There was a problem hiding this comment.
it's probably best to let the extension handle the variable calculation. We can trigger that on chnage and on opening of the agent tab
| -- The Encryption module is a prerequisite; its setup is outside MDL. | ||
|
|
||
| -- 2. Register ASU_AgentEditor as an after-startup microflow | ||
| ALTER SETTINGS MODEL AfterStartupMicroflow = AgentEditorCommons.ASU_AgentEditor; |
There was a problem hiding this comment.
of add to existing after startup logic
|
|
||
| 1. **Studio Pro design time** — the developer creates agent documents (and model documents) in Studio Pro. Tools, knowledge bases, and MCP servers are **attached to the agent in the agent document itself** (not added at runtime). | ||
| 2. **Model key** — a Mendix Cloud GenAI Portal key is stored in a String constant on the model document. At runtime, `ASU_AgentEditor` (registered as after-startup microflow) reads the key and auto-creates the corresponding `GenAICommons.DeployedModel`. | ||
| 3. **Call Agent activity** — in a microflow, a single **"Call Agent With History"** or **"Call Agent Without History"** toolbox action does everything: resolve the agent's in-use version, select its deployed model, replace variable placeholders from the context object, wire in tools/knowledge bases/MCP servers declared on the agent, and call the LLM. |
There was a problem hiding this comment.
of course this is still possible, because all objects (including agents) will be created in the ASU, but it will be easier to just use the native agent editor call agent activities that require and Agent docment as input. This will remove the need to do a database retrieve of the agent object before passing it to the agent commons call agent actions
There was a problem hiding this comment.
only valid values will we Task or Chat; Chat will likely be introduced in v1.1.0
| TOOL LookupCustomer { | ||
| Microflow: Support.Tool_LookupCustomer, | ||
| Description: 'Look up a customer by their email address', | ||
| Access: VisibleForUser |
There was a problem hiding this comment.
only available at runtime, will be added to extension later
| The `Access` property maps to `GenAICommons.ENUM_UserAccessApproval`: | ||
| - `HiddenForUser` — tool executes silently | ||
| - `VisibleForUser` — tool call is shown in the chat UI but executes automatically | ||
| - `UserConfirmationRequired` — tool call is shown and user must approve before execution | ||
|
|
There was a problem hiding this comment.
only available at runtime, will be added to extension later
…bjects created in the ASU
AI Code ReviewWe are reviewing a pull request that updates a proposal document for agent document support in MDL. We are to review against the checklist. However, note that the PR does not contain any code changes, only a proposal document. Let's break down the checklist:
However, note that the checklist also includes a section for "Documentation" in the PR/Commit Review Checklist: But note: this PR is updating a proposal document, not the actual documentation or skills. Therefore, we should check if the proposal document is correct and complete, but note that the actual implementation Since the PR is only updating a proposal, we focus on the content of the proposal. Let's look at the changes in the proposal document: We see several changes:
Given the above, we notice a few potential issues:
However, note that the proposal document is just a proposal. The actual implementation may change. Since the PR is only updating a proposal document, and we are not implementing the feature in this PR, we do not block on the proposal being perfect. But we should note the typo in the Knowledge Base example and suggest a fix. Also, note that the proposal document is very long and we have only checked the parts that changed. Let's check for any other inconsistencies:
Given the above, we have: Moderate Issue: However, note that the CREATE example uses: So the JSON example should use the same constant. Alternatively, the constant could be named anything, but the example should be consistent. We also note that in the Knowledge Base struct, the KeyConstant field is of type *ConstantRef, which points to a String constant. Therefore, we recommend changing the example in the JSON schema for Knowledge Base to use "Agents.KBKey". Additionally, we see that in the CREATE KNOWLEDGE BASE example, they use: and then in the JSON output shape example for Knowledge Base, they have: This is inconsistent. The qualifiedName in the JSON should be "Agents.KBKey". So we flag this as a moderate issue because it's a documentation error in the proposal. We also note that the same issue might appear in the Model example? Let's check: In the Model section, the JSON example for Model does not show the key constant. It only shows: So no issue there. In the ConsumedMCPService section, the JSON example now includes endpoint and authenticationMicroflow, and they use: This is consistent with the CREATE example. Therefore, only the Knowledge Base example has the typo. We also note that in the Knowledge Base section, the text says: There's a typo: "refrence" -> "reference". We can fix that too. However, note that the PR is already submitted. We are reviewing and can request changes. Let's summarize: Moderate Issues: We also note that the proposal document is very long and we might have missed other typos, but we are only required to review the changed parts. However, note that the PR only shows the changed lines. We see that the line with the typo in the KNOWLEDGE BASE JSON example was changed? So the PR introduced the typo? Originally, it was "Agents.LLMKey" (which was for the LLM key constant). Then they changed it to "Agents.KnowledbaseKey" (which is meant to be for the knowledge base key constant) but misspelled. They should have used "Agents.KBKey" (as in the CREATE example) or "Agents.KnowledgeBaseKey". Since the CREATE example uses "Agents.KBKey", we suggest using that. Also, the text change: We see two issues in the added line: We can suggest: However, note that the PR also changed the example below to use "Agents.KBKey". So we have two issues in the same hunk. We'll flag both. Additionally, we note that in the CONSUMED MCP SERVICE section, the text says: was changed to: and then the example was changed to use KBKey. This section is actually for the KNOWLEDGE BASE, not CONSUMED MCP Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
|
|
||
| 1. **CustomBlobDocument extensibility** *(answered)*: Mendix uses `CustomBlobDocument` as a general extension pattern. Four `CustomDocumentType` values observed so far: `agenteditor.agent`, `agenteditor.model`, `agenteditor.knowledgebase`, `agenteditor.consumedMCPService`. The parser dispatches by `CustomDocumentType` rather than hardcoding agent-specific logic. Future types (other extensions, other agent-editor documents) plug in naturally. | ||
|
|
||
| 2. **Contents JSON schema for tools/KB/MCP** *(answered for MCP tools and KB tools, still open for microflow tools)*: The `Agents.Agent007` document in the test3 project gave us the schema for MCP-type tools and knowledge base tools (see BSON Structure section). **Still open**: the JSON shape for a microflow-type tool — none observed yet. Expected: `toolType: "Microflow"` plus a `microflow: { qualifiedName, microflowId }` reference, but the exact key names and nesting need a real sample. Implementation should capture one before finalizing the microflow-tool writer. |
There was a problem hiding this comment.
let me know if there are still open questions regarding microflow tools. I added a lot of info above
|
|
||
| 3. **Separate document types for Model, Knowledge Base, and MCP Service** *(answered)*: Confirmed. Phase 4 of the implementation plan covers `CREATE MODEL`, `CREATE KNOWLEDGE BASE`, `CREATE CONSUMED MCP SERVICE` with schemas matching the observed BSON. | ||
|
|
||
| 4. **`CALL AGENT` activity BSON format**: The proposed `CALL AGENT WITH HISTORY` / `CALL AGENT WITHOUT HISTORY` / `NEW CHAT FOR AGENT` MDL statements need to map to a Studio Pro microflow activity. Is this a dedicated activity type in BSON, or does Studio Pro render a generic `JavaActionCallAction` (pointing at `AgentCommons.Agent_Call_WithHistory`) as "Call Agent"? If it's the latter, MDL can emit a standard Java action call; if the former, we need to identify the new activity BSON `$Type`. **Action:** inspect a Studio Pro microflow that uses "Call Agent" to resolve. |
There was a problem hiding this comment.
as decribed earlier, we have an will continue to introdcue decided toolbox actions in AgentEditorCommons module that accept an agent document as input param. This will simplify microflows containing call agent acitivites even though the "old" from AgentCommons actions will still work
|
|
||
| 4. **`CALL AGENT` activity BSON format**: The proposed `CALL AGENT WITH HISTORY` / `CALL AGENT WITHOUT HISTORY` / `NEW CHAT FOR AGENT` MDL statements need to map to a Studio Pro microflow activity. Is this a dedicated activity type in BSON, or does Studio Pro render a generic `JavaActionCallAction` (pointing at `AgentCommons.Agent_Call_WithHistory`) as "Call Agent"? If it's the latter, MDL can emit a standard Java action call; if the former, we need to identify the new activity BSON `$Type`. **Action:** inspect a Studio Pro microflow that uses "Call Agent" to resolve. | ||
|
|
||
| 5. **ASU_AgentEditor behavior**: `AgentEditorCommons.ASU_AgentEditor` is the after-startup microflow that syncs agent documents to runtime `AgentCommons.Agent` entities. Does `CREATE AGENT` via MDL need to trigger this sync, or does it happen automatically on next app startup? What happens if MDL creates an agent and the app is already running? |
There was a problem hiding this comment.
currently we require a restart of the app after every change to be able to use the testing playground and male sure that agent object in the database are in sync with agent documents
|
|
||
| 5. **ASU_AgentEditor behavior**: `AgentEditorCommons.ASU_AgentEditor` is the after-startup microflow that syncs agent documents to runtime `AgentCommons.Agent` entities. Does `CREATE AGENT` via MDL need to trigger this sync, or does it happen automatically on next app startup? What happens if MDL creates an agent and the app is already running? | ||
|
|
||
| 6. **Module placement** *(partially answered)*: The new documents in test3 live in a user-created `Agents` module (not in `AgentEditorCommons`), confirming that users **can** place agent-editor documents in their own modules. The older 4 agents in `AgentEditorCommons` appear to be samples shipped with the marketplace module. |
There was a problem hiding this comment.
correct we ship samples (template agents) but agents can be created in any module
|
|
||
| 6. **Module placement** *(partially answered)*: The new documents in test3 live in a user-created `Agents` module (not in `AgentEditorCommons`), confirming that users **can** place agent-editor documents in their own modules. The older 4 agents in `AgentEditorCommons` appear to be samples shipped with the marketplace module. | ||
|
|
||
| 7. **Cross-document UUID stability**: Agent documents reference model/KB/MCP documents by both `qualifiedName` AND `documentId` (UUID). When MDL creates a document, the generated UUID must be stable so that subsequent `CREATE AGENT` statements can correctly fill the `documentId` field. If an `ALTER` or re-create changes the UUID, all referring agents break. The writer must either (a) preserve existing UUIDs on update or (b) allow the agent's `documentId` field to be left empty and resolved at app-startup time by qualified name. |
There was a problem hiding this comment.
we can handle renames of referenced documents from the extension, however we are not yet able to recover references when a document is deleted and recreated with the same name. This will result in a consistency error and the user needs to reselect the referenced document (model, constant, microflow, KB, MCP)
|
|
||
| 7. **Cross-document UUID stability**: Agent documents reference model/KB/MCP documents by both `qualifiedName` AND `documentId` (UUID). When MDL creates a document, the generated UUID must be stable so that subsequent `CREATE AGENT` statements can correctly fill the `documentId` field. If an `ALTER` or re-create changes the UUID, all referring agents break. The writer must either (a) preserve existing UUIDs on update or (b) allow the agent's `documentId` field to be left empty and resolved at app-startup time by qualified name. | ||
|
|
||
| 8. **Portal-populated fields on Model/KB**: Fields like `displayName`, `keyId`, `keyName`, `environment`, `resourceName`, `modelName`, `modelDisplayName` are populated by Studio Pro after the user clicks "Test Key". Should MDL `CREATE MODEL` write them as empty strings (letting Studio Pro fill them on next open), preserve them if provided by `DESCRIBE` round-trip, or outright reject user-supplied values? Current proposal: accept-and-round-trip but document them as read-only. |
There was a problem hiding this comment.
not correct. Keys are impoted right after selection of a constant. We also listen to changes to the constant values or the runtime configs. Additionally users can trigger a call to the resource by pressing the test key button, this might update the model name and ID if that was chnages in the portal in the meantime
No description provided.