Using Triks
TrikHub provides a runtime for integrating triks into your AI agents.
A recap on Triks?
Triks are self-contained, composable AI skill packages that bring complete solutions to your agents — not just raw API tools.
The core idea: Instead of exposing dozens of micro-tools that your agent needs to orchestrate (wasting tokens and risking errors), a Trik packages an entire workflow into a single, focused capability. Your main agent delegates to triks when needed, and each trik handles its task autonomously.
Two Modes of Integration
Triks operate in one of two modes, declared in their manifest:
Conversational mode — The trik runs as an independent agent. Your main agent hands off the conversation, the trik handles multi-turn interactions autonomously, and when done, it transfers back with a structured summary.
User: "Find me some AI articles"
Main Agent: [calls talk_to_article_search with context]
-> Trik Agent takes over the conversation
-> Trik searches, refines, presents results
-> Trik transfers back with a session summary
Main Agent: [resumes with context from the summary]Tool mode — The trik’s tools appear directly on your main agent as native tools. No handoff, no conversation — just function calls with structured input and output.
User: "What's the weather in London?"
Main Agent: [calls getWeather({ city: "London" })]
-> Gateway executes the tool, validates I/O, returns formatted result
Main Agent: "The weather in London is 12C and cloudy."How It Works
Your Agent —> Gateway —> Trik
- Your agent receives a user message
- The Gateway checks if there is an active handoff session
- If an active handoff exists, the message goes directly to the trik agent
- If no handoff is active, the message goes to your main agent with handoff tools available
- Your main agent can call
talk_to_<trik>to start a handoff, or call exposed tools directly - All trik output is validated and sanitized before reaching your agent
Handoff Tools
For each conversational trik loaded by the gateway, a handoff tool is generated:
| Trik ID | Handoff Tool Name |
|---|---|
@demo/article-search | talk_to_demo_article_search |
@acme/code-reviewer | talk_to_acme_code_reviewer |
The main agent calls these tools when it determines the user’s request matches a trik’s domain. The gateway then manages the full handoff lifecycle — including session tracking, turn limits, and transfer-back.
Exposed Tools
For each tool-mode trik, the gateway exposes the trik’s tools directly on the main agent:
| Trik Tool | Exposed As |
|---|---|
getWeather (from @acme/weather) | getWeather |
getForecast (from @acme/weather) | getForecast |
These tools execute through the gateway, which validates input against inputSchema, validates output against outputSchema, and returns a formatted string via the outputTemplate.
Cross-Environment Support
The TypeScript gateway can execute triks written in either language:
- TypeScript triks run in-process via dynamic import
- Python triks run via a worker subprocess protocol
This means you can use any trik regardless of what language your agent is written in.
Continue to Quickstart to get a working example running in minutes.