activepieces/activepieces

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

21,788 stars TypeScript 10 components

12 hidden assumptions · 7-stage pipeline · 10 components

Like any codebase, this repository makes assumptions it never checks — most are routine. The ones worth your attention are below.

Orchestrates AI workflows and agent automation through extensible pieces and MCPs

Data flows through distinct pipelines: workflow execution (API→Worker→Engine→Pieces), AI agent interactions (Agent→Tools→LLM→Execution), piece development (CLI→Build→Publish→Registry), and real-time UI updates (Builder→API→Database→WebSocket). Each pipeline maintains strict data contracts and error boundaries.

Under the hood, the system uses 4 feedback loops, 5 data pools, 5 control points to manage its runtime behavior.

A 10-component repository. 10197 files analyzed. Data flows through 7 distinct pipeline stages.

Hidden Assumptions

Most of what this code assumes is routine. These 3 are the ones most likely to cause trouble here. The rest are minor; they're under "Show everything".

Worth your attention first

Wrong operation handlers execute with mismatched data, causing runtime errors deep in execution flow or producing corrupt results without clear error messages

Worth your attention first

If AgentPieceTool objects have malformed or missing metadata fields, pieceLoader throws unclear errors during LLM tool construction, causing agent workflows to fail with confusing stack traces

Worth your attention first

Invalid model names pass validation but cause API failures during agent execution, with errors surfacing only when LLM calls are made, not during configuration

Show everything (9 more)
Temporal

oauth2Handler assumes OAuth2 tokens stored in AppConnection remain valid throughout piece execution, but doesn't account for token expiration during long-running workflows

If this fails: Multi-step workflows that take longer than OAuth token lifetime (typically 1 hour) will fail mid-execution when pieces attempt to authenticate, requiring manual re-authentication

packages/server/api/src/app/app-connection/app-connection-service/oauth2/index.ts:oauth2Handler
Resource

buildPiece assumes sufficient disk space exists for npm pack operation and TypeScript compilation outputs, never checking available disk space before starting build process

If this fails: Large piece compilation fails with 'ENOSPC' errors when disk space is exhausted, leaving partially built artifacts and corrupted build directories that require manual cleanup

packages/cli/src/lib/utils/piece-utils.ts:buildPiece
Scale

dataSelectorUtils.traverseStep assumes step output data structures are reasonably sized for frontend rendering, with no limits on nesting depth or object size

If this fails: Workflows with large JSON outputs (megabytes) or deeply nested structures (100+ levels) cause browser memory exhaustion and UI freezing during data selector tree construction

packages/web/src/app/builder/data-selector/utils.ts:dataSelectorUtils.traverseStep
Environment

Worker startup assumes API and socket URLs from getApiUrl() and getSocketUrl() are immediately reachable, but doesn't implement retry logic for connection failures during initialization

If this fails: Workers fail to start in environments with slow network initialization or temporary DNS issues, requiring manual restarts rather than automatic recovery

packages/server/worker/src/lib/main.ts:main
Contract

Embed SDK assumes parent window implements message handlers for all ActivepiecesClientEventName events, but doesn't validate the parent's readiness to receive events before posting messages

If this fails: Iframe-to-parent communication fails silently when parent application hasn't initialized message listeners, causing authentication flows and navigation events to be lost

packages/ee/embed-sdk/src/index.ts:ActivepiecesClientEventName
Ordering

Component assumes flowVersion.state and flow.publishedVersionId are always consistent with database state, but doesn't handle race conditions where flow state changes between renders

If this fails: UI shows incorrect flow status when rapid state changes occur (e.g., concurrent publish operations), displaying draft flows as published or vice versa until next page refresh

packages/web/src/app/builder/builder-header/flow-status/index.tsx:BuilderFlowStatusSection
Shape

E2E test fixture assumes authentication always succeeds with provided credentials and doesn't handle cases where auth server is unavailable or credentials are invalid

If this fails: All E2E tests fail with unclear 'page not ready' errors when authentication service is down, making it impossible to distinguish between test failures and infrastructure issues

packages/tests-e2e/fixtures/index.ts:page fixture
Domain

aiProviders registry assumes each provider name maps to exactly one implementation strategy, with no support for provider versioning or fallback providers when primary provider fails

If this fails: When a specific AI provider (e.g., OpenAI) experiences outages, all agent workflows using that provider fail completely rather than falling back to alternative providers with compatible models

packages/server/api/src/app/ai/providers/index.ts:aiProviders
Temporal

getDataSelectorStructure assumes step output sample data remains static while building data selector tree, but outputSampleData can change asynchronously as users modify workflow steps

If this fails: Data selector shows outdated or inconsistent variable references when users rapidly modify workflow steps, leading to invalid data mappings that cause runtime errors during flow execution

packages/web/src/app/builder/data-selector/index.tsx:getDataSelectorStructure

Open the standalone hidden-assumptions report for activepieces →

How Data Flows Through the System

Data flows through distinct pipelines: workflow execution (API→Worker→Engine→Pieces), AI agent interactions (Agent→Tools→LLM→Execution), piece development (CLI→Build→Publish→Registry), and real-time UI updates (Builder→API→Database→WebSocket). Each pipeline maintains strict data contracts and error boundaries.

  1. Workflow Creation — User designs flow in web builder, defining triggers and actions through drag-and-drop interface. FlowVersion objects are created with step definitions, validation occurs client-side, and draft versions are persisted to database [UserInput → FlowVersion]
  2. Flow Publication — Draft FlowVersion is validated server-side, piece metadata is verified, connections are checked, and version state transitions from DRAFT to LOCKED with publishedVersionId updated on parent Flow [FlowVersion → FlowVersion]
  3. Execution Trigger — Flow execution initiated by webhook, schedule, or manual trigger. FlowRun record created with RUNNING status, execution context prepared, and job queued for worker processing [TriggerPayload → FlowRun]
  4. Worker Processing — Background worker dequeues job, loads FlowVersion definition, initializes execution context with project data and connections, then dispatches to execution engine [FlowRun → ExecutionContext]
  5. Step Execution — Engine processes each step sequentially, loads piece modules dynamically, resolves input properties from previous step outputs, executes piece action with sandboxed context, and captures ExecutionOutput [ExecutionContext → ExecutionOutput]
  6. AI Agent Processing — When agent piece executes, tools are constructed from available pieces, LLM generates tool calls based on prompt, each tool call resolves to piece execution, and structured output is extracted from agent result [AgentPrompt → AgentResult]
  7. Result Aggregation — All step ExecutionOutputs are collected into execution journal, FlowRun status updated to SUCCESS or FAILED, duration calculated, and logs persisted to file storage [ExecutionOutput → FlowRun]

Data Models

The data structures that flow between stages — the contracts that hold the system together.

FlowVersion packages/shared/src/lib/automation/flows/flow-version.ts
Object with id: string, flowId: string, displayName: string, trigger: Trigger, valid: boolean, state: FlowVersionState (DRAFT|LOCKED), updatedBy: string, created: string, updated: string
Created when flows are modified, locked when published, referenced during execution to determine which version to run
FlowRun packages/shared/src/lib/automation/flow-run/flow-run.ts
Object with id: FlowRunId, projectId: string, flowVersionId: string, status: FlowRunStatus, startTime: string, finishTime?: string, logsFileId?: string, tasks?: number, tags?: string[]
Created when flow execution starts, updated with status changes, archived when complete with execution logs
ExecutionOutput packages/shared/src/lib/automation/flow-run/execution/execution-output.ts
Object with stepName: string, status: StepOutputStatus, input?: unknown, output?: unknown, errorMessage?: string, duration?: number
Generated during each workflow step execution, aggregated into execution journal, persisted for debugging and flow testing
AppConnection packages/shared/src/lib/automation/app-connection/app-connection.ts
Object with id: string, name: string, pieceName: string, type: AppConnectionType, value: AppConnectionValue (OAuth2|BasicAuth|SecretText|CustomAuth), projectId: string
Created during connection setup, refreshed for OAuth tokens, referenced during piece execution for authentication
AgentProviderModel packages/shared/src/lib/automation/agents/index.ts
Object with provider: AIProviderName (OPENAI|ANTHROPIC|GOOGLE|etc), model: string
Configured during agent setup, resolved to specific AI provider during execution, used to route requests to correct LLM
PieceMetadata packages/shared/src/lib/automation/pieces/piece-metadata.ts
Object with name: string, version: string, displayName: string, description: string, auth?: PieceAuth, actions: Record<string, Action>, triggers: Record<string, Trigger>
Extracted during piece compilation, cached in registry, served to frontend for flow building and validated during execution
EngineOperation packages/shared/src/lib/automation/engine/index.ts
Union type of ExecuteFlowOperation | ExtractPieceMetadataOperation | ExecuteTriggerOperation | ExecuteValidateAuthOperation with type discriminator and operation-specific payload
Created by API or worker, sent to execution engine, processed based on operation type, results returned to caller

System Behavior

How the system operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

Piece Registry (registry)
Over 600 compiled piece packages containing action/trigger definitions, each exposing metadata and executable code for workflow integration
Flow Database (database)
Persistent storage for flow definitions, versions, runs, connections, and project data with relational integrity and audit trails
Execution Journal (state-store)
In-memory collection of step execution results during workflow run, later serialized to logs for debugging and audit purposes
Job Queue (queue)
Background job queue managing workflow executions, webhook deliveries, and scheduled tasks with retry logic and priority handling
Connection Store (database)
Encrypted storage for OAuth tokens, API keys, and authentication credentials used by pieces during execution

Feedback Loops

Delays

Control Points

Technology Stack

TypeScript (runtime)
Primary language providing type safety across piece development, API contracts, and execution engine
React (framework)
Frontend framework powering visual flow builder with drag-and-drop interfaces and real-time updates
Fastify (framework)
High-performance Node.js API server handling REST endpoints, authentication, and WebSocket connections
PostgreSQL (database)
Primary database storing flow definitions, execution history, user accounts, and encrypted connection credentials
Redis/Bull (infra)
Background job queue managing workflow execution, webhook delivery, and scheduled tasks with retry logic
AI SDK (library)
Unified interface for multiple LLM providers (OpenAI, Anthropic, Google) enabling agent tool execution
Turbo (build)
Monorepo build orchestration managing 600+ piece packages with incremental builds and caching
Playwright (testing)
End-to-end testing framework validating workflow execution and UI interactions across browser environments

Key Components

Package Structure

shared (shared)
Core data models, types, and utilities shared across all services including flow definitions, authentication models, and execution state management
cli (tooling)
Command-line tool for creating, building, and publishing pieces with hot-reload development support
engine (app)
Execution engine that runs workflow steps, validates piece metadata, and executes AI agent tools in sandboxed environments
web (app)
React-based visual flow builder with drag-and-drop interface for creating workflows and configuring AI agents
api (app)
FastifyJS REST API server providing workflow management, authentication, and AI provider integration endpoints
server-utils (shared)
Shared utilities for file system operations, cryptography, database migrations, and system monitoring
worker (app)
Background job processor that executes workflows, handles webhooks, and manages queue-based task scheduling
ee-embed-sdk (library)
Embeddable SDK allowing third parties to integrate Activepieces flow builder into their applications
pieces-framework (library)
TypeScript framework for building reusable workflow pieces with type-safe property definitions and execution contexts
pieces-common (shared)
Shared utilities and helpers used across multiple pieces for common operations like HTTP requests and data transformation

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Repository Repositories

Frequently Asked Questions

What is activepieces used for?

Orchestrates AI workflows and agent automation through extensible pieces and MCPs activepieces/activepieces is a 10-component repository written in TypeScript. Data flows through 7 distinct pipeline stages. The codebase contains 10197 files.

How is activepieces architected?

activepieces is organized into 5 architecture layers: Frontend Layer, API Layer, Execution Layer, Worker Layer, and 1 more. Data flows through 7 distinct pipeline stages. This layered structure keeps concerns separated and modules independent.

How does data flow through activepieces?

Data moves through 7 stages: Workflow Creation → Flow Publication → Execution Trigger → Worker Processing → Step Execution → .... Data flows through distinct pipelines: workflow execution (API→Worker→Engine→Pieces), AI agent interactions (Agent→Tools→LLM→Execution), piece development (CLI→Build→Publish→Registry), and real-time UI updates (Builder→API→Database→WebSocket). Each pipeline maintains strict data contracts and error boundaries. This pipeline design reflects a complex multi-stage processing system.

What technologies does activepieces use?

The core stack includes TypeScript (Primary language providing type safety across piece development, API contracts, and execution engine), React (Frontend framework powering visual flow builder with drag-and-drop interfaces and real-time updates), Fastify (High-performance Node.js API server handling REST endpoints, authentication, and WebSocket connections), PostgreSQL (Primary database storing flow definitions, execution history, user accounts, and encrypted connection credentials), Redis/Bull (Background job queue managing workflow execution, webhook delivery, and scheduled tasks with retry logic), AI SDK (Unified interface for multiple LLM providers (OpenAI, Anthropic, Google) enabling agent tool execution), and 2 more. A focused set of dependencies that keeps the build manageable.

What system dynamics does activepieces have?

activepieces exhibits 5 data pools (Piece Registry, Flow Database), 4 feedback loops, 5 control points, 4 delays. The feedback loops handle refresh-loop and development-loop. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does activepieces use?

5 design patterns detected: Plugin Architecture, Multi-Role Components, Event-Driven Communication, Execution Isolation, State Machine Workflows.

Analyzed on April 20, 2026 by CodeSea. Written by .