Menu

Example Applications

Relevant source files

This document showcases practical implementations that demonstrate AStack's capabilities across different domains. Each example application illustrates specific architectural patterns and integration approaches, from simple text processing pipelines to complex multi-component research automation systems.

The examples demonstrate core AStack features including component composition, pipeline orchestration, agent-tool integration, and streaming data flows. Each implementation is located in the examples/ directory and represents a complete, runnable application.

Example Applications Overview

AStack includes five primary example applications that demonstrate different aspects of the framework's capabilities:

ExampleLocationPrimary ComponentsDomain
Text Processing Pipelineexamples/text-splitter/TextSplitter, PipelineDocument processing
Research Automation Pipelineexamples/simple-deep-research/ContentAnalyzer, ReportEnhancer, WebDriverComponentInformation research
Chat Server Applicationserve-astack/StreamingAgent, ToolInvokerConversational AI
Browser Automation Pipelineexamples/simple-browser-use/PlanningAgent, BrowserAgentWeb automation
Agent with Tools Integrationexamples/agent-with-tools/Agent, createToolFile operations

AStack Examples Component Architecture

Sources: examples/text-splitter/index.ts1-80 examples/simple-deep-research/index.ts1-149 examples/simple-deep-research/content-analyzer.ts1-621 examples/simple-deep-research/report-enhancer.ts1-235

Text Processing Pipeline

The text splitter example demonstrates basic pipeline usage with the TextSplitter component for document chunking and processing. This example shows how to use AStack components both in pipeline mode and standalone mode.

TextSplitter Implementation

The example in examples/text-splitter/index.ts creates a TextSplitter component with configuration parameters and demonstrates two execution modes:

The TextSplitter is configured with chunkSize: 100, overlap: 20, and separator: /\n\s*\n/ for paragraph-based splitting. The pipeline demonstrates the addComponent and run methods for orchestration.

Sources: examples/text-splitter/index.ts47-79

Pipeline vs Standalone Execution

ModeCode PatternUsage
Pipelinepipeline.run<string[]>('textSplitter.text', sampleText)Orchestrated execution with port routing
StandalonetextSplitter.run(sampleText)Direct component execution

The example shows both execution patterns: examples/text-splitter/index.ts66-75 demonstrating how components can operate independently or within pipelines.

Sources: examples/text-splitter/index.ts1-80

Research Automation Pipeline

The simple-deep-research example demonstrates complex multi-component pipeline orchestration for automated research, including web scraping, content analysis, and AI-enhanced report generation.

Research Pipeline Architecture

Sources: examples/simple-deep-research/index.ts40-65

ContentAnalyzer Component

The ContentAnalyzer extends the base Component class and implements complex filtering logic for search results and content organization:

MethodPurposeInput/Output
filterRelevantResultsFilter search results by relevanceSearchResultItem[]string[]
organizeContentCreate structured reportMap<string, string>ResearchReport
generateReportGenerate final research reportMultiple inputs → ResearchReport

The component defines multiple input/output ports: searchResults, pageContents, topic (inputs) and relevantUrls, report, ready (outputs). The _transform method coordinates data flow between these ports.

Sources: examples/simple-deep-research/content-analyzer.ts83-104 examples/simple-deep-research/content-analyzer.ts465-618

ReportEnhancer with LLM Integration

The ReportEnhancer component demonstrates AI integration for content enhancement:

The component creates structured prompts for the LLM and parses JSON responses to enhance the original research report with AI-generated insights.

Sources: examples/simple-deep-research/report-enhancer.ts61-123 examples/simple-deep-research/report-enhancer.ts131-183

Chat Server Application

The serve-astack application demonstrates a full-stack implementation with Fastify backend and React frontend, showcasing streaming AI responses and intent classification.

StreamingAgent Architecture

ComponentPurposeIntegration
StreamingMathAgentMathematical operationsCalculator tool + Deepseek model
StreamingTextAgentText analysisText statistics tool + Deepseek model
Intent ClassificationRoute user requestsAI-based intent detection
Streaming ProtocolReal-time responsesAI SDK compatible streaming

The server implements intent-based routing where user messages are classified and routed to appropriate specialized agents for processing.

Sources: Based on the architecture patterns from other examples and the mention of serve-astack in the overview.

Browser Automation Pipeline

The browser automation example demonstrates natural language-driven web interaction using Playwright integration with planning agents and state management.

Browser Automation Components

The PlanningAgent analyzes user intent and creates step-by-step execution plans, while the BrowserAgent executes these plans through Playwright automation. The BrowserStateComponent manages DOM state and context tracking.

Sources: Based on the architecture patterns described in the overview and the component naming conventions from other examples.

Agent with Tools Integration

This example demonstrates the zero-adaptation layer design where Agent components directly integrate with tools created via createTool without intermediate adapters.

Tool Integration Pattern

The createTool function creates standardized tool interfaces that integrate seamlessly with Agent instances. Tools are defined with schemas and implementation functions, enabling the agent to perform complex multi-step operations.

Sources: Based on the tool integration patterns from the pipeline examples and the createTool function mentioned in the framework overview.

Development Workflow Integration

The examples demonstrate how AStack integrates into typical development workflows, from simple component usage to complex application architecture.

Component Development Lifecycle

StageCode EntityFile LocationPurpose
Component Creationclass CustomComponent extends ComponentCustom implementationsDefine reusable logic units
Tool DefinitioncreateTool(name, description, implementation)examples/*/tools/Create agent-callable functions
Model Integrationnew Deepseek({ apiKey, model })Provider configurationsConnect to LLM services
Pipeline Assemblypipeline.addComponent(), pipeline.connect()Main application filesOrchestrate data flow
Executioncomponent.run() or pipeline.run()Entry pointsExecute standalone or pipeline mode

Configuration and Environment Setup

Examples demonstrate consistent patterns for configuration management and environment setup across different application types.

Sources: README.md145-148 website/components/UseCases.tsx1-175

Integration Examples

The examples showcase various integration patterns with external services, demonstrating AStack's extensibility and interoperability.

Model Provider Integration

ProviderClassConfigurationUsage Pattern
DeepseekDeepseek{ apiKey, model }Direct instantiation in Agent constructor
OpenAI CompatibleGeneric provider interfaceStandard OpenAI formatZero-adaptation integration

Tool System Integration

The tool system demonstrates how external capabilities are integrated into the AStack ecosystem through the createTool function and standardized tool interfaces.

External Service Integration

Examples show integration with various external services:

  • File system operations via Node.js APIs
  • Web scraping through browser automation
  • HTTP requests for API communications
  • Database operations (demonstrated in research pipeline)

Sources: README.md230-260 README.md152-177 website/components/UseCases.tsx6-91