Architecture at a glance
Authentication
| Surface | Auth |
|---|---|
| MCP | OAuth-based MCP server authorization. Your agent obtains an MCP connection token through Deal Brain’s auth flow; tokens are scoped to a single Deal Brain user and their organization. |
Template keys
Every template has a stable key — the string your agent uses to refer to it. Three conventions:| Convention | Example | Used for |
|---|---|---|
| System keys | daily-brief, meeting-debrief, draft-follow-up | Deal Brain-shipped presets. Stable across releases. |
| Org/User templates with system keys | daily-brief (at Org or User scope) | Overrides for a system preset. |
| Custom keys | user-templates/<slug>, drafts/<slug> | Templates authored by your team or customer. Prefix conventions help group them in list_templates. |
The render contract
A call togenerate_template does six things:
- Resolves the template by key, applying User > Org > System precedence for the calling user.
- Verifies status is
Active. Draft templates return an error. - Binds context — opportunity ID, identity (user/org), and any additional variables you pass.
- Substitutes data variables with their resolved values; preserves missing values as empty strings.
- Emits the rendered body — markdown with
datavariables filled in andinstructionvariables flagged as model directives. - Returns the system prompt + rendered body in two text blocks, with cache hints for the model.
Tracing
Every Canvas render emits a Langfuse trace with these metadata fields:| Field | Value |
|---|---|
triggerType | mcp for agent calls, cron for scheduled internal jobs |
triggerName | The tool name, e.g. generate_template |
workflowName | The bounded-workflow name, e.g. generate-meeting-brief-pipeline |
organizationId | The calling user’s org |
opportunityId | The bound opportunity, if any |
templateKey, templateScope, templateStatus | Set on render-time metadata |
Next steps
MCP tool contract
The full
generate_template and list_templates reference — input schemas, output shapes, error modes, and integration patterns.
