Response Modes
Response modes determine how data flows from your Trik back to the agent and user. This is the core of TrikHub’s security model.
The Two Modes
| Mode | Agent Sees | User Sees |
|---|---|---|
| Template | Structured agentData + filled template | Same as agent |
| Passthrough | Delivery confirmation only | Full userContent |
Template Mode
Use template mode when you want the agent to understand the result and potentially act on it.
How It Works
- Your Trik returns
agentData(structured, typed) - Gateway validates against
agentDataSchema - Gateway fills in the response template
- Agent receives both the data and the response
Example
Manifest:
{
"responseMode": "template",
"agentDataSchema": {
"type": "object",
"properties": {
"template": { "type": "string", "enum": ["success", "empty"] },
"count": { "type": "integer" },
"topic": { "type": "string", "enum": ["AI", "technology", "science"] }
}
},
"responseTemplates": {
"success": { "text": "I found {{count}} articles about {{topic}}." },
"empty": { "text": "I couldn't find any articles about {{topic}}." }
}
}Trik returns:
{
"agentData": {
"template": "success",
"count": 3,
"topic": "AI"
}
}Agent receives:
I found 3 articles about AI.
agentData: { template: "success", count: 3, topic: "AI" }When to Use Template Mode
- Search results (count, IDs, categories)
- Confirmations (action completed, status)
- Structured data the agent should reason about
- Any operation where the agent needs context to continue
Security Constraints
The agentDataSchema enforces what the agent can see:
- Enums - Limit to known values:
"enum": ["success", "error"] - Integers - Safe counts:
"type": "integer" - IDs - References without content:
"format": "id" - No free-form strings - Prevents injection
Passthrough Mode
Use passthrough mode when content should go directly to the user without the agent seeing it.
How It Works
- Your Trik returns
userContent - Gateway validates against
userContentSchema - Content is delivered directly to the user
- Agent only knows delivery succeeded
Example
Manifest:
{
"responseMode": "passthrough",
"userContentSchema": {
"type": "object",
"properties": {
"contentType": { "type": "string", "enum": ["article"] },
"content": { "type": "string" },
"metadata": {
"type": "object",
"properties": {
"title": { "type": "string" },
"articleId": { "type": "string" }
}
}
},
"required": ["contentType", "content"]
}
}Trik returns:
{
"userContent": {
"contentType": "article",
"content": "# The Future of AI\n\nArtificial intelligence is transforming...",
"metadata": {
"title": "The Future of AI",
"articleId": "art-001"
}
}
}User sees:
# The Future of AI
Artificial intelligence is transforming...Agent sees:
Content delivered to user.
Type: article
Title: The Future of AIWhen to Use Passthrough Mode
- Full article/document content
- User-generated content
- Any free-form text that could contain injection attacks
- Private data the agent shouldn’t process
The Metadata Escape Hatch
Sometimes the agent needs some context about passthrough content. Use metadata for safe, structured info:
{
"userContent": {
"contentType": "article",
"content": "Full article text...",
"metadata": {
"title": "Safe title here",
"articleId": "art-001",
"wordCount": 1500
}
}
}The agent sees the metadata but not the content.
Hybrid Actions
Actions can support both modes with runtime switching. Your Trik decides based on the result:
Success path: Return userContent (passthrough)
Error path: Return agentData with error template
{
"responseMode": "passthrough",
"userContentSchema": { ... },
"agentDataSchema": {
"type": "object",
"properties": {
"template": { "type": "string", "enum": ["not_found", "error"] }
}
},
"responseTemplates": {
"not_found": { "text": "I couldn't find that article." },
"error": { "text": "Something went wrong." }
}
}Choosing the Right Mode
Does the agent need to reason about this content?
├── Yes → Template mode
│ └── Use enums, integers, IDs only
└── No → Passthrough mode
└── Add metadata if agent needs contextNext: Understand the Security Model behind these modes.