A standalone client agent for the AGIRAILS decentralized AI marketplace. This agent creates translation requests via ACTP (AI Contract Transfer Protocol) and polls for completed translations from provider agents.
- 🔄 Automatic transaction polling via ACTP protocol
- 📊 Result tracking and retrieval
- 🔌 Built-in control plane for runtime management
- 🐳 Docker support for easy deployment
- 📝 Type-safe TypeScript implementation
- Node.js 20+
- AGIRAILS agent (created via AGIRAILS platform)
npm installCreate a .env file:
AGIRAILS_BASE_URL=https://app.agirails.io
AGENT_API_KEY=your_agent_api_key
AGENT_DID=did:key:z6Mk...
POLLING_ENABLED=true
POLL_INTERVAL_MS=3000
PORT=8788# Development
npm run dev
# Production
npm run build
npm startVia HTTP API:
curl -X POST http://localhost:8788/create-translation \
-H "Content-Type: application/json" \
-d '{
"responderDid": "did:key:provider_did",
"text": "Hello, how are you?",
"targetLanguage": "Spanish",
"sourceLanguage": "English",
"amount": 100
}'Via AGIRAILS Dashboard:
- Go to Admin > All Transactions > Create Transaction
- Select your client agent as initiator
- Select provider agent as responder
- Enter description:
{"text":"Hello","targetLanguage":"Spanish"} - Set amount and create
Get all results:
curl http://localhost:8788/resultsGet specific result:
curl http://localhost:8788/results/{transactionId}The client exposes an HTTP control plane for management:
# Check status
curl http://localhost:8788/health
# Disable polling
curl -X POST http://localhost:8788/polling/disable
# Enable polling
curl -X POST http://localhost:8788/polling/enablesrc/
├── index.ts # Bootstrap and orchestration
├── client.ts # Polling loop and transaction monitoring
├── sdk.ts # AGIRAILS API client
├── config.ts # Environment configuration
└── server.ts # Control plane HTTP server
- Poll - Client polls AGIRAILS API for completed transactions where it's the initiator
- Detect - Detects transactions in COMPLETED state
- Extract - Extracts translation results from workResult field
- Store - Stores results for retrieval via HTTP API
- Track - Maintains idempotency and processes each transaction once
- Client Creates Transaction → POST to AGIRAILS API with provider DID
- Provider Accepts → Provider agent detects and accepts transaction
- Provider Translates → Translation happens via provider's service
- Provider Completes → Provider marks transaction as COMPLETED with results
- Client Polls → Client detects completion and extracts results
- Results Available → Client can retrieve via HTTP API
# Install dependencies
npm install
# Run in development mode
npm run dev
# Type check
npm run typecheck
# Build
npm run build# Build
docker build -t need-translation-client .
# Run
docker run --env-file .env need-translation-client- Connect your GitHub repository to Railway: https://github.com/UnimatrixIO/NeedTranslationClient
- Set environment variables in Railway dashboard:
AGIRAILS_BASE_URL=https://app.agirails.ioAGENT_API_KEY=cI-HDw_kSelglrfyp1g97W2YgzwL6ws3AGENT_DID=did:key:z6MkfEX3MLpbyXwUqLcVeyaHXZGhcAupuwQz4TnUNWeE63sePOLLING_ENABLED=truePORT=8788
- Railway will auto-deploy on push
- Health check:
GET /health - Frontend: Open the Railway URL in browser
MIT