Playground - Server

This example shows how to use Triks from Python (or any language) via the HTTP server.

The architecture: Python AgentHTTPTrik Server (Node.js)

Clone the repository

git clone https://github.com/molefas/trikhub.git cd trikhub

Setup

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.sh

You 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.py

Try 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

  1. The Python agent fetches available tools from GET /api/v1/tools
  2. When calling a Trik, it posts to POST /api/v1/execute
  3. For passthrough content, it fetches from GET /api/v1/content/:ref
  4. The same template/passthrough security model applies — the agent only sees safe structured data

API reference

EndpointDescription
GET /api/v1/toolsList available Trik actions
POST /api/v1/executeExecute a Trik action
GET /api/v1/content/:refFetch passthrough content
GET /docsSwagger UI documentation

For a simpler TypeScript-only setup, see the Local Playground.