Creating Triks

Build and publish your own secure AI triks in TypeScript or Python.

TLDR;

  • Triks need to have a specific structure and a few files, as any package;
  • Triks need to be pushed in a public Github repo with a version tag;
  • trik publish can be run locally on the project root and it will try to publish the package to the Registry. Usually this will give you engouh information on what is missing;
  • A good place to start is by looking at existing Triks. Check this Python Trik  and/or this Typescript Trik ;

The Builder Journey

  1. Project Structure - What files you need
  2. Writing the Manifest - Define actions and schemas
  3. Building the Graph - Implement the logic
  4. Testing Locally - Validate before publishing
  5. Publishing - Push to the registry

Quick Start

The fastest way to create a new trik is with the CLI scaffolding tool:

# Install the CLI (if you haven't already) npm install -g @trikhub/cli # Create a TypeScript trik trik init ts # Or create a Python trik trik init py

This will guide you through an interactive wizard and generate all the boilerplate files you need.

Manual Setup

Alternatively, create the files manually:

mkdir my-trik && cd my-trik

Create manifest.json:

{ "id": "@yourname/my-trik", "name": "My First Trik", "version": "1.0.0", "actions": { "hello": { "description": "Say hello", "responseMode": "template", "inputSchema": { "type": "object", "properties": { "name": { "type": "string" } } }, "agentDataSchema": { "type": "object", "properties": { "template": { "type": "string", "enum": ["success"] } } }, "responseTemplates": { "success": { "text": "Hello from my first trik!" } } } }, "entry": { "module": "./graph.js", "export": "default", "runtime": "node" } }

Create the graph implementation:

graph.ts:

async function invoke({ action, input }) { return { responseMode: 'template', agentData: { template: 'success' } } } export default { invoke }

Unpublishing

To permanently remove a trik from the registry:

trik unpublish @yourname/my-trik

This will remove the trik and all its versions from the registry. Users who have already installed it will still have their local copy, but no new installations will be possible.


Next: Learn about Project Structure.