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
│ │ ├── registry.go # Register(), ValidateConfig() with oneOf support
@@ -234,7 +234,8 @@ log:
234
234
- **A2A protocol**: Agents/flows with `A2A.Enabled` get JSON-RPC endpoints via `a2a-go` + ADK `adka2a`. Agent cards auto-generated with capabilities and skills. SSE streaming for responses
235
235
- **Dual-perspective conversation recording**: Middleware chains recorder twice: "admin" perspective (all events, before FlowResponseFilter) and "user" perspective (filtered, after). Each conversation has a `ParentID` linking the pair
236
236
- **Store dual-copy pattern**: Store maintains `rawData` (unexpanded, with `${VAR}` refs) and `data` (env-expanded). API responses use raw data, runtime uses expanded. Secret values injected as env vars before expansion
237
-
- **Session middleware**: `SessionEnsure` prevents overwriting existing sessions (protects ContextGuard summaries). `SessionStateSeed` injects empty outputKey values so flow agents don't fail on template vars
- **InstructionProvider pattern**: Agents use `InstructionProvider` instead of static `Instruction` strings to bypass ADK's built-in `{variable}` substitution (which conflicts with curly braces in prompts, JSON examples, scripts, etc). Magec resolves its own `{{agent.output:key}}` pattern from session state inside the provider. Plain `{text}` in prompts is never touched
238
239
- **Flow wrapAgent pattern**: Same agent can appear in multiple flow steps — `wrapAgent()` creates uniquely-named delegate agents to satisfy ADK's single-parent constraint
Copy file name to clipboardExpand all lines: website/content/docs/agents.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,14 +48,14 @@ If you leave the system prompt empty, Magec uses a default prompt that makes the
48
48
49
49
### Output Key
50
50
51
-
The **output key** is used when the agent participates in a [flow](/docs/flows/). It saves the agent's output under a named key in the flow's shared state. Other agents in the same flow can then reference that output using `{key_name}` in their own prompts.
51
+
The **output key** is used when the agent participates in a [flow](/docs/flows/). It saves the agent's output under a named key in the flow's shared state. Other agents in the same flow can then reference that output using `{{agent.output:key_name}}` in their own prompts.
52
52
53
-
For example, if a "researcher" agent has `outputKey: research_results`, a later "writer" agent can include `{research_results}` in its prompt to access what the researcher found.
53
+
For example, if a "researcher" agent has `outputKey: research_results`, a later "writer" agent can include `{{agent.output:research_results}}` in its prompt to access what the researcher found.
54
54
55
55
| Field | Description |
56
56
|-------|-------------|
57
57
|`systemPrompt`| The full instruction text. Supports multi-line, markdown, examples, and any formatting you want. |
58
-
|`outputKey`| Named key for flow data passing. Other agents in the same flow can reference it with `{key_name}`. |
58
+
|`outputKey`| Named key for flow data passing. Other agents in the same flow can reference it with `{{agent.output:key_name}}`. |
Copy file name to clipboardExpand all lines: website/content/docs/flows.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,9 +71,11 @@ Each step receives the accumulated output of all previous steps as context. The
71
71
72
72
1. Give an agent an `outputKey` in its [configuration](/docs/agents/) (e.g., `research_results`)
73
73
2. The agent's output is saved under that key in the flow's shared state
74
-
3. Later agents can reference it with `{research_results}` in their system prompt
74
+
3. Later agents can reference it with `{{agent.output:research_results}}` in their system prompt
75
75
4. Magec replaces the placeholder with the actual output at runtime
76
76
77
+
> **Note:** Magec uses `{{agent.output:variable}}` instead of `{variable}` for state references. This avoids conflicts with curly braces in your prompts, JSON examples, or any other content that uses `{` and `}`.
78
+
77
79
This lets you build precise data pipelines. A "researcher" outputs structured findings, a "writer" references those findings in its prompt, a "reviewer" references both. Each agent sees exactly the context it needs.
78
80
79
81
In parallel steps, all branches receive the same input. Their outputs are concatenated and passed to whatever comes next.
Copy file name to clipboardExpand all lines: website/public/docs/agents/index.html
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -214,8 +214,8 @@ <h3 id="output-key">
214
214
Output Key
215
215
<aclass="heading-anchor" href="#output-key" aria-label="Link to this section">#</a>
216
216
</h3>
217
-
<p>The <strong>output key</strong> is used when the agent participates in a <ahref="/docs/flows/">flow</a>. It saves the agent’s output under a named key in the flow’s shared state. Other agents in the same flow can then reference that output using <code>{key_name}</code> in their own prompts.</p>
218
-
<p>For example, if a “researcher” agent has <code>outputKey: research_results</code>, a later “writer” agent can include <code>{research_results}</code> in its prompt to access what the researcher found.</p>
217
+
<p>The <strong>output key</strong> is used when the agent participates in a <ahref="/docs/flows/">flow</a>. It saves the agent’s output under a named key in the flow’s shared state. Other agents in the same flow can then reference that output using <code>{{agent.output:key_name}}</code> in their own prompts.</p>
218
+
<p>For example, if a “researcher” agent has <code>outputKey: research_results</code>, a later “writer” agent can include <code>{{agent.output:research_results}}</code> in its prompt to access what the researcher found.</p>
219
219
<table>
220
220
<thead>
221
221
<tr>
@@ -230,7 +230,7 @@ <h3 id="output-key">
230
230
</tr>
231
231
<tr>
232
232
<td><code>outputKey</code></td>
233
-
<td>Named key for flow data passing. Other agents in the same flow can reference it with <code>{key_name}</code>.</td>
233
+
<td>Named key for flow data passing. Other agents in the same flow can reference it with <code>{{agent.output:key_name}}</code>.</td>
234
234
</tr>
235
235
</tbody>
236
236
</table>
@@ -305,11 +305,11 @@ <h2 id="skills">
305
305
<p>While the <strong>system prompt</strong> defines who the agent is, skills define <strong>what it knows</strong>. An agent with a “Return Policy” skill and a “Product Catalog” skill becomes a capable customer support representative without you having to cram everything into one massive prompt.</p>
306
306
<p>Skills are especially powerful when shared across agents. Update a product catalog skill once, and every agent that uses it sees the change.</p>
307
307
<p>For a deeper comparison of when to use skills vs. creating specialized agents, see <ahref="/docs/skills-vs-agents/">Skills vs. Agents</a>.</p>
308
-
<h2id="context-guard-hahahugoshortcode9s4hbhb">
308
+
<h2id="context-guard-hahahugoshortcode66s4hbhb">
309
309
Context Guard
310
310
<spanclass="docs-badge">Experimental</span>
311
311
312
-
<aclass="heading-anchor" href="#context-guard-hahahugoshortcode9s4hbhb" aria-label="Link to this section">#</a>
312
+
<aclass="heading-anchor" href="#context-guard-hahahugoshortcode66s4hbhb" aria-label="Link to this section">#</a>
313
313
</h2>
314
314
<p>Long conversations eventually hit the model’s token limit and fail. Context Guard watches the conversation size and automatically summarizes older messages before that happens. Recent messages stay untouched.</p>
315
315
<p>You set it up per-agent inside the <strong>LLM</strong> section. Two strategies:</p>
<li>Give an agent an <code>outputKey</code> in its <ahref="/docs/agents/">configuration</a> (e.g., <code>research_results</code>)</li>
240
240
<li>The agent’s output is saved under that key in the flow’s shared state</li>
241
-
<li>Later agents can reference it with <code>{research_results}</code> in their system prompt</li>
241
+
<li>Later agents can reference it with <code>{{agent.output:research_results}}</code> in their system prompt</li>
242
242
<li>Magec replaces the placeholder with the actual output at runtime</li>
243
243
</ol>
244
+
<blockquote>
245
+
<p><strong>Note:</strong> Magec uses <code>{{agent.output:variable}}</code> instead of <code>{variable}</code> for state references. This avoids conflicts with curly braces in your prompts, JSON examples, or any other content that uses <code>{</code> and <code>}</code>.</p></blockquote>
244
246
<p>This lets you build precise data pipelines. A “researcher” outputs structured findings, a “writer” references those findings in its prompt, a “reviewer” references both. Each agent sees exactly the context it needs.</p>
245
247
<p>In parallel steps, all branches receive the same input. Their outputs are concatenated and passed to whatever comes next.</p>
0 commit comments