Skip to content

Commit 24756d6

Browse files
akoclaude
andcommitted
docs: clarify design-time vs call-time in CREATE AGENT syntax
Adds a "What Goes Where: Design-Time vs. Call-Time" subsection before the syntax rationale table, explaining that everything in CREATE AGENT is stored in the agent document — the top-level (...) properties are not invocation parameters. Maps the three layers to their REST CLIENT analogs: - Document-level static config (BaseUrl / UsageType) - Input contract (Parameters / Variables) - Attached resources (OPERATION blocks / TOOL+KB+MCP blocks) - Runtime invocation (SEND REST REQUEST / CALL AGENT) Makes explicit that Variables is the input-schema analog of REST CLIENT's Parameters, and that actual values flow in via the CONTEXT object at the CALL AGENT site. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1b75a54 commit 24756d6

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

docs/11-proposals/PROPOSAL_agent_document_support.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,46 @@ CREATE AGENT MyModule."ResearchAssistant" (
173173
DROP AGENT MyModule."SentimentAnalyzer"
174174
```
175175

176+
### What Goes Where: Design-Time vs. Call-Time
177+
178+
Everything inside `CREATE AGENT` — including the properties in the top-level `(...)` — is **design-time configuration that is stored in the agent document**. None of it is an invocation parameter. Runtime inputs are supplied at the `CALL AGENT` site.
179+
180+
The layering follows the same pattern as `CREATE REST CLIENT`:
181+
182+
| Layer | REST CLIENT | AGENT |
183+
|---|---|---|
184+
| **Document-level static config** (stored in document) | `BaseUrl`, `Authentication` | `UsageType`, `Description`, `Entity`, `SystemPrompt`, `UserPrompt` |
185+
| **Input contract** (what the caller must bring at call time) | `Parameters: ($id: String)` on each operation | `Variables: ("Topic": String, ...)` on the agent |
186+
| **Attached resources** (body blocks) | `OPERATION` blocks | `TOOL` / `KNOWLEDGE BASE` / `MCP SERVICE` blocks |
187+
| **Runtime invocation** (values supplied at call site) | `SEND REST REQUEST Mod.Api.GetItems (id = $x)` | `CALL AGENT WITH HISTORY $agent REQUEST $req CONTEXT $obj` |
188+
189+
In other words:
190+
191+
- `UsageType`, `Entity`, `SystemPrompt`, `UserPrompt` are the same kind of property as `BaseUrl` on a REST client — baked into the document, changed by editing the document.
192+
- `Variables: (...)` is the same kind of property as `Parameters: (...)` on a REST operation — it declares the **schema** of what the caller must supply, not the values. Actual values arrive at runtime: for `EntityAttribute` variables, they're read from matching attributes on the `CONTEXT` object; for free-form variables (future extension), they'd be passed directly.
193+
- `TOOL`, `KNOWLEDGE BASE`, `MCP SERVICE` blocks describe **capabilities the agent carries with it** — the LLM can invoke them autonomously at runtime, but they aren't something the caller passes in.
194+
195+
Example — all of this is stored in the agent document:
196+
197+
```sql
198+
CREATE AGENT Reviews."SentimentAnalyzer" (
199+
UsageType: Task, -- design-time mode
200+
Entity: Reviews.ProductReview, -- context entity contract
201+
Variables: ("ProductName": EntityAttribute, -- input contract
202+
"ReviewText": EntityAttribute),
203+
SystemPrompt: 'Analyze the review for {{ProductName}}.', -- prompt template
204+
UserPrompt: '{{ReviewText}}' -- prompt template
205+
);
206+
```
207+
208+
And this is the runtime call — the only place values flow in:
209+
210+
```sql
211+
CALL AGENT WITHOUT HISTORY $Agent CONTEXT $Review INTO $Response;
212+
-- $Review is a Reviews.ProductReview instance;
213+
-- its ProductName and ReviewText attributes satisfy the Variables contract.
214+
```
215+
176216
### Syntax Design Rationale
177217

178218
| Decision | Rationale |
@@ -183,7 +223,7 @@ DROP AGENT MyModule."SentimentAnalyzer"
183223
| `TOOL <Name> { Microflow: ..., Description: ..., Access: ... }` | `Microflow`, `Description`, `Access` are regular properties (not positional), same as REST CLIENT operation properties |
184224
| `KNOWLEDGE BASE <QualifiedName>` (module-qualified) | The name references an external KB document (peer `CustomBlobDocument`), not a free-form identifier |
185225
| `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')` |
226+
| `Variables: (...)` is the input-schema analog of REST CLIENT's `Parameters: (...)` | Declares what the caller must supply; values flow in via the `CONTEXT` object at the `CALL AGENT` site. Inline form matches REST CLIENT's `Parameters: ($id: String)` |
187227
| `Access: VisibleForUser` as enum literal | Maps to `GenAICommons.ENUM_UserAccessApproval` values: `HiddenForUser`, `VisibleForUser`, `UserConfirmationRequired` |
188228
| Body omitted when there are no tools/KB/MCP | Same concession REST CLIENT makes implicitly — empty bodies are awkward; drop them |
189229
| Prompts as string literals | Consistent with other MDL string properties; `{{var}}` placeholders are just text |

0 commit comments

Comments
 (0)