Skip to content

RuloGB/agentsflow-backend

Repository files navigation

AgentsFlow Studio — Backend

Backend API for AgentsFlow Studio, an LLM agent orchestration platform with multi-agent workflows, MCP integration, and HTTP triggers.

Stack

  • Runtime: Node.js 22 + TypeScript 5
  • API: Fastify 5
  • Orchestration: LangGraph.js + LangChain.js
  • DB: PostgreSQL 16 (Prisma 6)
  • Queue: BullMQ + Redis 7

Requirements

  • Node.js 22+
  • Docker Desktop

Setup

# 1. Install dependencies
npm install

# 2. Configure environment variables
cp .env.example .env
# Edit .env with your API keys

# 3. Start PostgreSQL and Redis
docker compose up -d

# 4. Migrations and seed
npx prisma migrate dev
npm run seed

# 5. Start in development mode
npm run dev

Verify: curl http://localhost:3000/health{ "status": "ok" }

Scripts

Command Description
npm run dev Start server in development mode (hot reload)
npm run build Compile TypeScript
npm run seed Insert test data
npm run migrate Run Prisma migrations
npm test Run tests

Environment variables

See .env.example for the full list.

API

Method Route Description
GET /health Health check
GET/POST /api/agents List / create agents
GET/PUT/DELETE /api/agents/:id Manage agent
GET/POST /api/workflows List / create workflows
GET/PUT/DELETE /api/workflows/:id Manage workflow
POST /api/run/:slug Trigger workflow execution (rate-limited)
GET /api/executions List executions
GET /api/executions/:id Execution detail
GET /api/executions/:id/steps Steps of an execution
POST /api/auth/login Login — returns accessToken and sets refreshToken cookie
POST /api/auth/refresh Rotate/refresh access token using refreshToken cookie
POST /api/auth/logout Revoke refresh token and clear cookie
GET /api/mcp List MCP servers
GET /api/mcp/:id Get MCP server details
POST /api/mcp Create MCP server (admin only)
PUT /api/mcp/:id Update MCP server (admin only)
DELETE /api/mcp/:id Delete MCP server (admin only)
POST /api/mcp/:id/ping Ping MCP server (admin only)
GET /api/settings List app settings (sensitive values masked)
GET /api/settings/:key Get setting by key (masked when sensitive)
PUT /api/settings/:key Create/update setting (admin only)
DELETE /api/settings/:key Delete setting (admin only)
GET /api/stats Dashboard stats (hourly buckets, model usage)

Demo workflow

code-reviewer — two chained LLM agents:

curl -X POST http://localhost:3000/api/run/code-reviewer \
  -H "Content-Type: application/json" \
  -d '{ "code": "function sum(a,b) { return a+b }", "language": "javascript" }'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages