Custom Executors
Deploy your own executor to run TPMJS tools on your infrastructure with full control over environment, secrets, and data.
What is an Executor?
An executor is a service that runs TPMJS tools. When you use a collection or agent,
TPMJS sends tool execution requests to an executor, which dynamically loads the npm
package and calls the tool's{' '}
execute() function.
By default, TPMJS uses a shared executor. Deploying your own gives you complete control over the execution environment.
Why Deploy Your Own Executor?
Privacy
Keep tool execution data on your own servers. No data passes through TPMJS.
Custom Environment
Inject your own API keys, database connections, and secrets into tool execution.
Full Control
Choose your infrastructure, scale resources, and customize the execution environment.
No Timeouts
Run long-running tools without hitting shared executor time limits.
Choose Your Platform
We provide deployment templates for multiple platforms. Choose the one that fits your needs:
Unsandbox
Always-on container execution with automatic HTTPS. Deploy with one CLI command.
Vercel
Serverless execution with VM-level isolation using Vercel Sandbox. One-click deploy.
You can also build your own executor on any platform that runs Node.js. Just implement the API specification below.
Platform Comparison
| Feature | Unsandbox | Vercel |
|---|---|---|
| Deploy method | CLI command | One-click button |
| Isolation | Container-level | VM-level (Sandbox) |
| Cold starts | None (always-on) | Yes (serverless) |
| Max runtime | Unlimited | 45min (Hobby) / 5hr (Pro) |
| Pricing | Per uptime | Per compute time |
| Custom domains | Yes | Yes |
| Freeze/unfreeze | Yes (save costs) | N/A (serverless) |
Connecting to Your Executor
Once deployed, configure your collections or agents to use your executor:
- Go to your collection or agent settings
- In "Executor Configuration", select "Custom Executor"
-
Enter your executor URL (e.g.,{' '}
https://my-executor.on.unsandbox.com) - Add your API key if authentication is enabled
- Click "Verify Connection" to test
Security: Always set{' '}
EXECUTOR_API_KEY to require
authentication. Without it, anyone can execute tools on your executor.
Executor API Specification
All executors must implement these endpoints. Use this spec if building a custom executor.
{/* POST /execute-tool */}
POST{' '}
/execute-tool
Execute a TPMJS tool. The executor should install the npm package, find the named
export, and call its{' '}
execute(params) function.
Request Body:
Response:
GET /health
Health check endpoint. TPMJS uses this to verify the executor is reachable and working.
Response:
Note: Both{' '}
/api/health and{' '}
/health paths should work
(same for /execute-tool).
Our templates support both.
Executor Cascade
When a tool is executed, TPMJS resolves which executor to use in this order:
- • If an agent has an executor configured, all tools in that agent use it
- • If the agent has no executor but a collection does, tools from that collection use the collection's executor
- • If neither has an executor configured, the TPMJS default executor is used
FAQ
Which platform should I choose?
Unsandbox is recommended for most use cases. It has no cold starts, unlimited runtime, and simple CLI deployment. Use Vercel{' '} if you're already on Vercel or prefer one-click deployment and pay-per-use pricing.
Can I use other platforms?
Yes! Any platform that runs Node.js and exposes HTTP endpoints works. AWS Lambda, Google Cloud Run, Railway, Render, Fly.io—just implement the API specification above.
How do tools get loaded?
The executor runs npm install for
the requested package, then dynamically imports it and calls the tool's{' '}
execute() function. Each
execution uses a fresh temporary directory.
Are environment variables secure?
Yes. Environment variables are stored encrypted by the platform (Vercel/Unsandbox)
and only available during execution. You can also pass per-request environment
variables in the env field of the
execute-tool request.
Need Help?
If you run into issues deploying or configuring your executor, we're here to help.