Develop serverless edge functions with PubNub Functions 2.0
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.79x
Baseline
Agent success rate without this tile
52%
{
"context": "Evaluates whether the agent writes a PubNub Before Publish function following the specific structure required by the Functions 2.0 runtime: export pattern, module loading, async style, error handling, and message lifecycle methods. Tests knowledge of Functions-specific constraints that differ from standard Node.js.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Default async export",
"description": "Function uses 'export default async (request) =>' as the entry point, not a named export or regular function declaration",
"max_score": 20
},
{
"name": "Require for modules",
"description": "Built-in modules (kvstore, xhr, vault, etc.) are loaded with require() inside the function body, not with ES6 import statements at the top of the file",
"max_score": 15
},
{
"name": "Async/await style",
"description": "All asynchronous operations use await, not .then()/.catch() promise chains",
"max_score": 15
},
{
"name": "Try/catch wrapper",
"description": "The entire function body is wrapped in a try/catch block with console.error in the catch clause",
"max_score": 15
},
{
"name": "Returns request.ok/abort",
"description": "The function returns request.ok() to allow the message or request.abort() to block it; both paths have explicit return statements",
"max_score": 15
},
{
"name": "Modifies request.message",
"description": "Message enrichment/transformation is done by mutating or replacing properties on request.message, not by returning a new message object",
"max_score": 10
},
{
"name": "Channels as array",
"description": "Channel name is accessed via request.channels[0] (array), not request.channel (string property)",
"max_score": 10
}
]
}