Playground - Server
This example shows how to use Triks from Python (or any language) via the HTTP server.
The architecture: Python Agent ↔ HTTP ↔ Trik Server (Node.js)
Clone the repository
git clone https://github.com/molefas/trikhub.git
cd trikhubSetup
You’ll need two terminals — one for the server, one for the agent.
Terminal 1: Start the server
# Install and build (from repo root)
pnpm install
pnpm build
# Start the trik server
cd examples/server-playground/server
./start.shYou should see:
{"level":30,"msg":"Server listening at http://0.0.0.0:3002"}Terminal 2: Run the Python agent
cd examples/server-playground/agent
# Configure environment
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run the agent
python cli.pyTry it out
You: search for articles about AI
Assistant: I found 3 articles about AI.
You: list them
[Displays article list]
You: show me the healthcare one
[Displays full article]What’s happening
- The Python agent fetches available tools from
GET /api/v1/tools - When calling a Trik, it posts to
POST /api/v1/execute - For passthrough content, it fetches from
GET /api/v1/content/:ref - The same template/passthrough security model applies — the agent only sees safe structured data
API reference
| Endpoint | Description |
|---|---|
GET /api/v1/tools | List available Trik actions |
POST /api/v1/execute | Execute a Trik action |
GET /api/v1/content/:ref | Fetch passthrough content |
GET /docs | Swagger UI documentation |
For a simpler TypeScript-only setup, see the Local Playground.