Public beta AStack is under active development. Build with us.Release notes
OPEN SOURCE · TYPESCRIPT · MIT

Build AI agents
with components.

The composable framework for AI applications. Connect components with typed ports and Observable streams. Use HLang's monadic FBP model.

npm install @astack-tech/core@beta
research.pipeline01 — COMPONENT GRAPH
Components connected through ports.
Execution preview Local illustration · no API calls
  1. input.in Receive research prompt
  2. agent.tools Connect model and tools · search → collect → write
  3. agent.out Ready to compose
Framework foundationsTypeScript nativeObservable streamsMonadic compositionMIT licensed

COMPONENTS, PORTS, AND PIPELINES

Everything is a component.

Connect them through ports. AStack uses HLang's monadic composition model.

Monadic component system

The Component class extends HLang’s TransformNode and uses its monadic composition laws. Agents and tools use the same component interface. Pipelines connect them.

class Agent extends Component
Input portComponentOutput port

Data flow paradigm

Flow-Based Programming treats LLMs as stateless generators. Define the data dependencies between components. The runtime sends data through their ports.

input → transform → output

Dual execution modes

Independent execution with run() or reactive pipeline mode with _transform(). The same component works in both.

run(data) / _transform($i, $o)

Type-safe port system

Port.I() and Port.O() define input and output ports. TypeScript describes the data contracts. The HLang runtime connects the ports.

Port.I('in') → Port.O('out')

Modular design

Core, components, integrations, and tools as separate packages. Choose the pieces your application needs.

@astack-tech/{core,components,…}

Easy integration

Use OpenAI-compatible model interfaces. Connect your model provider and business logic through the component contract.

model.chatCompletion(messages)
Explore the architecture

THE COMPUTATION MODEL

One model. Four ways to build.

The computation model uses HLang's monadic composition rules. Use the same components for workflows, reactive streams, and agent communication.

Monadic component base

Built on HLang’s TransformNode with monadic composition laws. Clear input/output contracts keep individual transformations reusable.

Input portComponentOutput port
  • Operator composition
  • Standalone: run(data)
  • Reactive: _transform($i, $o)
Read the technical guide
component.ts
import { Component, type Port } from '@astack-tech/core';

class Uppercase extends Component {
  constructor() { super({}); }

  run(data: string): string {
    return data.toUpperCase();
  }

  _transform($i: Port, $o: Port): void {
    $i('in').receive<string>((data) => {
      $o('out').send(this.run(data));
    });
  }
}

const result = new Uppercase().run('hello');

Monadic laws

HLang defines the monadic composition laws that AStack components use.

Direct connections

Port-to-port data flow without intermediate adaptation layers.

Reactive streams

Observable-based processing with backpressure and flow-control patterns for real-time applications.

QUICK START

From install
to first agent.

Install the packages. Create an agent with a model provider. Run the agent from your terminal.

Node.js 18+ · npm, pnpm, or Yarn

Read Documentation View Examples

1Install AStack

npm install @astack-tech/core@beta @astack-tech/components@beta @astack-tech/integrations@beta

2Create your first agent

agent.ts
import { Agent } from '@astack-tech/components';
import { Deepseek } from '@astack-tech/integrations/model-provider';

const apiKey = process.env.DEEPSEEK_API_KEY;
if (!apiKey) throw new Error('Set DEEPSEEK_API_KEY');

const agent = new Agent({
  model: new Deepseek({ apiKey, model: 'deepseek-chat' }),
  systemPrompt: 'Explain ideas clearly and precisely.',
  maxIterations: 10,
});

const result = await agent.run('Explain flow-based programming');
console.log(result.message);

3Run your agent

Set DEEPSEEK_API_KEY in your shell, then run your TypeScript file. Keep API keys on the server.

npx tsx agent.ts
Next: connect your own tools

DESIGN DECISIONS

Independent by design.

Built in TypeScript, AStack has its own implementation and architecture. Its API style takes inspiration from Haystack's API style.

Architectural differences described in the original AStack overview
Design choiceAStackTraditional approach
Data flow paradigmFlow-Based Programming with monadic compositionControl flow loops
Dual run modesrun() + _transform()Single mode
Type-safe portsTypeScript contracts and HLang port systemRuntime checks
LanguageTypeScriptPython

This is an architectural contrast, not a benchmark or a claim about every framework. Ecosystems evolve; choose the implementation that fits your application.

AStack uses a shared component interface for agents, tools, and models. Connect their ports to define how data moves through your application.