Custom Executors
Deploy your own executor to run TPMJS tools on your own infrastructure.
New to custom executors? Start with the tutorial
Deploy your own executor in 10 minutes with our step-by-step guide
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 and runs the tool code.
By default, TPMJS uses a shared executor. You can deploy your own for:
Full Control
Run tools on your own infrastructure with complete control over the execution environment.
Privacy
Keep tool execution data on your own servers. No data leaves your infrastructure.
Performance
Deploy in regions closest to your users for lower latency tool execution.
Custom Environment
Inject your own environment variables, secrets, and configuration into tool execution.
Deploy Your Own Executor
The fastest way to get started is to deploy our template to Vercel with one click:
After deployment, you'll get a URL like https://tpmjs-executor.vercel.app
Configuration
Once you have your executor deployed, configure your collections or agents to use it:
- Go to your collection or agent settings
- In the "Executor Configuration" section, select "Custom Executor"
- Enter your executor URL (e.g.,
https://tpmjs-executor.vercel.app) - Optionally add an API key if your executor requires authentication
- Click "Verify Connection" to test the configuration
Security tip: Set the EXECUTOR_API_KEY environment variable in your Vercel project to require authentication for all requests.
Executor API Specification
All executors must implement this API:
POST /execute-tool
Execute a TPMJS tool with the provided parameters.
Request Body:
// POST /execute-tool
{
"packageName": "@tpmjs/hello",
"name": "helloWorld",
"version": "latest",
"params": { "name": "World" },
"env": { "MY_API_KEY": "..." }
}Response:
// Response
{
"success": true,
"output": "Hello, World!",
"executionTimeMs": 123
}GET /health
Check executor health status. Used by TPMJS to verify the executor is reachable.
Response:
// GET /health
{
"status": "ok",
"version": "1.0.0"
}Executor Cascade
Executor configuration follows a cascade resolution 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
Can I use any cloud provider?
Yes! While we provide a Vercel template, you can deploy an executor anywhere that can run Node.js and expose an HTTP endpoint. The executor just needs to implement the API specification above.
What about timeouts?
The default timeout for tool execution is 30 seconds. On Vercel's free tier, you get up to 10 seconds per request. For longer-running tools, consider deploying to a platform with higher timeout limits.
How do tools get loaded?
Tools are dynamically imported from esm.sh, a CDN for npm packages. The executor fetches the package, finds the tool export, and calls its execute() function.
Need Help?
If you run into issues deploying or configuring your executor, we're here to help.