BETA RELEASE

🎉 AStack v0.1.1-beta.0 is now available! Try it today with npm install @astack-tech/core

Release notes

AStackA composable framework for building AI applications.

Everything is a component. Build powerful agent workflows with a pure functional programming approach using AStack's composable architecture.

example.ts
1import { Pipeline } from "@astack-tech/core";
2import { Agent } from "@astack-tech/components";
3import { Deepseek } from "@astack-tech/integrations/model-provider";
4import { PromptTemplate } from "@astack-tech/components";
5
6// Create a simple pipeline with components
7const pipeline = new Pipeline();
8
9// Add components to the pipeline
10pipeline.addComponent('template', new PromptTemplate({
11  template: "Answer this question: {{question}}"
12}));
13pipeline.addComponent('model', new Deepseek({
14  apiKey: process.env.DEEPSEEK_API_KEY,
15  model: "deepseek-chat"
16}));
17pipeline.addComponent('agent', new Agent());
18
19// Run the pipeline
20const response = await pipeline.run('template.input', {
21  question: "What is functional programming?"
22});
23
24console.log(response);

Core Features

AStack implements a modern, component-based approach to building AI agents and workflows, with a focus on functional programming principles and composability.

Everything is a Component

All elements inherit from the Component base class, with input and output ports for data flow, enabling both standalone and pipeline execution.

Zero Adaptation Layer

Agents directly accept any model provider component and tools without middleware adapters, creating a cleaner and more intuitive API.

Dual Run Modes

Run components independently with run() or compose them into pipelines with _transform() - same interface, maximum flexibility.

Type-Safe Ports

Components communicate through a port system that ensures type safety and transparent data flow between components.

Modular Package Design

Organized into core abstractions, domain-specific components, and external integrations for maximum code reuse and extensibility.

External Ecosystem Integration

Leverage OpenAI-compatible interfaces to integrate external model providers without requiring specialized SDKs.

Computation Model

AStack implements a sophisticated computation model based on the HLang monadic functional programming paradigm, combining the flexibility of functional programming with the practical advantages of component-based development.

Operator Composition

Key Features

  • Each component is a composable transformation operator
  • Maintains function purity with clear inputs and outputs
  • Ensures type safety and transparent data flow through the port system
operator-composition.ts
1// Component as transformation operator
2const textProcessor = new Pipeline();
3
4// Adding components with proper names
5textProcessor.addComponent('splitter', new TextSplitter());
6textProcessor.addComponent('embedder', new Embedder());
7textProcessor.addComponent('vectorStore', new VectorStore());
8
9// Function-style pipeline execution
10const result = await textProcessor.run('splitter.input', document);
Operator Composition Diagram

Workflow Orchestration

Workflow Orchestration Diagram

Key Features

  • Supports complex workflows with branching and merging
  • Provides dynamic routing and parallel processing

Reactive Data Flow

Reactive Data Flow Diagram

Key Features

  • Implements event-driven asynchronous processing
  • Supports backpressure and hot/cold data streams

Inter-Agent Communication

Key Features

  • Supports complex interactions between agents
  • Maintains context continuity across multiple exchanges
  • Enables multi-agent coordination and tool integration
agent-communication.ts
1// Inter-agent communication example
2const coordinator = new AgentCoordinator();
3
4// Register multiple specialized agents
5coordinator.register([
6  new ResearchAgent({ name: 'researcher' }),
7  new AnalysisAgent({ name: 'analyst' }),
8  new WriterAgent({ name: 'writer' })
9]);
10
11// Start collaboration process
12const report = await coordinator.collaborate({
13  task: "Analyze market trends and generate a report"
14});
Inter-Agent Communication Diagram

Core Featuresof the Monadic Design Pattern

State Encapsulation

Encapsulates state, ensuring data immutability and predictable transformations

Chained Operations

Chain operations seamlessly, simplifying complex workflows and data pipelines

Composable Transformations

Create reusable components that can be composed in different ways to form complex systems

Error Propagation

Control error propagation in a predictable way, enhancing system stability and reliability

Quick Start

Follow these steps to start building component-based AI applications with AStack.

1

Install AStack

Install AStack core and components packages using npm or yarn

terminal
1npm install @astack-tech/core @astack-tech/components
2# yarn
3yarn add @astack-tech/core @astack-tech/components
4# pnpm
5pnpm add @astack-tech/core @astack-tech/components
2

Create Your First Component

Extend the Component base class to create custom components

index.ts
1import { Component } from '@astack-tech/core';
2
3class TextProcessor extends Component {
4  constructor() {
5    super({});
6    // Each component has default 'in' and 'out' ports
7    // We can customize them with Component.Port.I and Component.Port.O
8    Component.Port.I('text').attach(this); // Customize input port
9  }
10
11  // Standalone mode: direct processing
12  run(input