astack-tech/astack
astack-tech/astack has 36 GitHub stars and 4 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-09 02:13 UTC. Last push 2026-11-07.
🤖 A composable framework for building AI applications.
Measured star growth
- in 24h
- 0
- in 7 days
- Update delayed
- in 15 days
- Update delayed
- in 1 month
- Update delayed
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
OriginalAStack
Website · Docs · Examples · Changelog · Contributing
English · 简体中文
Public beta. APIs can change between beta releases. Each release is described in the package changelogs.
AStack is a TypeScript framework for AI applications. It has one rule: everything is a component. Models, tools, agents and your own logic are components. A pipeline connects their ports into a graph, and data flows along the connections.
import { Pipeline } from '@astack-tech/core';
// Trim and Uppercase are two small components; see examples/pipeline.
const pipeline = new Pipeline();
pipeline.addComponent('trim', new Trim());
pipeline.addComponent('upper', new Uppercase());
pipeline.connect('trim.out', 'upper.in');
await pipeline.run('trim.in', ' hello '); // 'HELLO'
The computation model
| Idea | What it is | API |
|---|---|---|
| Component | A unit of work with named input and output ports | class X extends Component |
| Port | A channel. Output ports connect to input ports. | $i('in').receive(), $o('out').send() |
| Pipeline | A graph of components that runs data from a trigger port to an endpoint | addComponent, connect, run |
A component never calls another component. It reads its input ports and writes its output ports, and the pipeline decides where data goes. Each component stays small and testable, and you can rewire a graph without editing the components in it.
Every component works in two modes: call run(input) like a function, or add it to a pipeline, where the runtime calls _transform($i, $o). Agents, multi-step workflows and routing are patterns built from these ideas, not separate subsystems.
The runtime is HLang, a flow-based programming runtime built on RxJS. Each connection is an observable stream.
How AStack compares
AStack's computation model is original. PocketFlow reached a similar idea independently: a small core in which the graph is the framework. PocketFlow is written in Python and makes a 100-line core its defining goal. AStack does not optimize for line count; it optimizes for typed, reactive data flow in TypeScript. Haystack inspired AStack's API shape. AStack does not use Haystack code.
| AStack | PocketFlow | Haystack | |
|---|---|---|---|
| Language | TypeScript | Python | Python |
| Unit of work | Component with named ports | Node with prep, exec and post |
Component with typed sockets |
| How data moves | Along each connection, from an output port to an input port | Through a shared store that nodes read and write | Along connections between sockets |
| Branching | A component sends to the output port it chooses | post returns an action; the flow follows that labeled edge |
Router components |
| Execution | Reactive streams; concurrent runs of a route resolve in order | A flow runs nodes one after another; async and parallel variants exist | A pipeline run loop |
| Design goal | A typed, reactive data-flow model | A minimal core of about 100 lines | A full framework for search and RAG |
The main difference from PocketFlow is where state lives. PocketFlow nodes share one store. In AStack each connection carries the data for that step, so every input and output is visible in the graph. Details: Introduction.
Install
Requires Node.js 20 or later.
npm install @astack-tech/core@beta @astack-tech/components@beta
# Model providers and tools
npm install @astack-tech/integrations@beta @astack-tech/tools@beta
An agent in a few lines
import { Agent } from '@astack-tech/components';
import { ModelProvider } from '@astack-tech/integrations';
import { createTool } from '@astack-tech/tools';
const multiply = createTool(
'multiply',
'Multiply two numbers.',
args => Number(args['a']) * Number(args['b'])
);
// Any model works: see the table below.
const model = new ModelProvider.Deepseek({ apiKey: process.env['DEEPSEEK_API_KEY'] ?? '' });
const agent = new Agent({ model, tools: [multiply] });
const { message, toolCalls } = await agent.run('What is 37 times 43?');
Any model
An agent depends on one interface, chatCompletion(messages), not on a vendor. OpenAICompatible calls any API that speaks the OpenAI chat completions protocol, and Deepseek is a preset of it.
| Model | Provider |
|---|---|
| OpenAI | new ModelProvider.OpenAICompatible({ apiKey, model: 'gpt-4o-mini' }) |
| DeepSeek | new ModelProvider.Deepseek({ apiKey }) |
| Qwen, Moonshot and other OpenAI-compatible APIs | new ModelProvider.OpenAICompatible({ apiKey, baseURL, model }) |
| Local models through Ollama or vLLM | new ModelProvider.OpenAICompatible({ apiKey: 'ollama', baseURL: 'http://localhost:11434/v1', model: 'llama3.1' }) |
| Any other API | An object with chatCompletion(messages): see custom-model |
The examples use DeepSeek so they run as written; change the line that creates the model to use another one. Details: Model providers.
Examples
Each example is one short file that shows one idea. Read them in order; the code is also rendered on astack.tech/examples.
| # | Example | Shows | API key |
|---|---|---|---|
| 1 | component | Define a component and run it as a function | No |
| 2 | pipeline | Connect components and infer the endpoint | No |
| 3 | routing | Branch through named output ports | No |
| 4 | text-splitter | Split documents with a built-in component | No |
| 5 | tools | Create tools and run tool calls | No |
| 6 | chat | Call a model directly and in a pipeline | Yes |
| 7 | workflow | Chain outline, draft and edit steps | Yes |
| 8 | agent | Let a model call a tool | Yes |
| 9 | custom-model | Drive an agent with your own model | No |
| 10 | streaming-agent | Stream text and tool events | Yes |
| 11 | rlm-agent | Question a codebase too large for one prompt | Yes |
| 12 | http-server | Serve a streaming agent over Server-Sent Events | Yes |
pnpm install && pnpm build
pnpm --filter @astack-examples/pipeline start
Packages
| Package | Contents |
|---|---|
@astack-tech/core |
Component, Pipeline, Port |
@astack-tech/components |
Agent, StreamingAgent, RLMAgent, TextSplitter, ToolInvoker |
@astack-tech/tools |
createTool, tool sets, component tools, MCP tools |
@astack-tech/integrations |
Model providers: OpenAICompatible for any OpenAI-compatible API, and the Deepseek preset |
Each package README lists its full API.
Documentation
| Page | Topic |
|---|---|
| Introduction | The computation model and the comparison above |
| Getting started | Install, first component, first pipeline |
| Components, Pipelines, Routing | The core model |
| Tools, Model providers | Building blocks for agents |
| Agents, Streaming, RLM | Agent patterns |
| API reference | Every export of every package, generated from the source and its TSDoc comments |
Development
pnpm install
pnpm verify # format, lint, types, tests, package checks, build
The rules for contributors and AI coding agents are in AGENTS.md: code is the single source of truth, every change starts with a failing test, and every gate runs at its strictest setting with zero warnings. Open pull requests against dev. See CONTRIBUTING.md and SECURITY.md.
License
MIT. Thanks to the HLang project for the runtime, to Haystack for the API inspiration, and to everyone who has contributed.
Explore related projects
affaan-m/ECC
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
300,167 starsNousResearch/hermes-agent
The agent that grows with you
262,037 starsmultica-ai/andrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
231,308 starsfirecrawl/firecrawl
Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
199,847 stars