vanguard-framework
v0.0.3
Published
Agentic AI framework
Downloads
29
Readme
Vanguard Framework
Vanguard Framework is a TypeScript library designed to provide a flexible, extensible foundation for building agentic AI systems and orchestrators. It abstracts common patterns for agent management, LLM (Large Language Model) integration, command execution, and AWS Bedrock connectivity, enabling rapid development of advanced AI-driven applications.
Features
- Agent Abstraction: Define, register, and manage multiple agents with custom logic.
- LLM Integration: Easily connect to AWS Bedrock and other LLM providers.
- Command Pattern: Encapsulate operations as commands for flexible scheduling and execution.
- Extensible Architecture: Build your own agents, adapters, and workflows.
- TypeScript-first: Strong typing and modern developer experience.
Project Structure
src/
agent.ts # Agent controller and registry
bedrock-llm-client-adapter.ts # AWS Bedrock LLM adapter
bedrock.ts # Bedrock client utilities
command.ts # Command pattern base
llm-invoker.ts # LLM invocation logic
llm-response-adapter.ts # LLM response normalization
builders/ # Builders for memory, messages, etc.
utils/ # Utility functions (AWS credentials, response parsing)Getting Started
Prerequisites
- Node.js (v18+ recommended)
- TypeScript (4.x or later)
- AWS credentials (for Bedrock integration, if used)
Installation
Add the framework to your project (from your monorepo or npm if published):
npm install <path-to-vanguard-framework>
# or if published
npm install vanguard-frameworkBasic Usage
1. Create and Configure an Agent Controller
import { AgentController, DefaultAgent, EmailAgent } from 'vanguard-framework';
const config = {
defaultMemory: [<AI system memory>]
};
const agentController = new AgentController(config);
// Register agents
agentController.registerAgent('default', new DefaultAgent());
agentController.registerAgent('email', new EmailAgent());
// Register always running agents
agentController.registerAlwaysRunAgent('analytic', new AnalyticAgent())
// Process input
await agentController.processInput('Send onboarding email to new users');2. Implement Custom Agents
Extend the Agent interface to add your own logic:
class MyCustomAgent implements Agent {
async executeTask(task: AgentTask): Promise<void> {
// Custom logic here
}
}3. Chaining Agent Tasks
You can use ChainCommand supports chaining several tasks.
export const agentCmd = new command.ChainCommand<agent.AgentTask, unknown>()
.addTask(async (task: agent.AgentTask | undefined) => {
console.log('Do task 1');
})
.addTask(async (taskWithParams: unknown) => {
console.log('Do task 2');
})4. Use with AWS Bedrock
The framework provides adapters and utilities for invoking LLMs via AWS Bedrock. Ensure your AWS credentials are set up in your environment.
Advanced Topics
- Command Pattern: Encapsulate operations as commands for scheduling and concurrency control.
- Adapters: Integrate with other LLM providers by implementing adapter interfaces.
- Builders: Use provided builders for constructing memory and message objects for LLMs.
Development & Contribution
- Clone the monorepo and install dependencies:
git clone <your-repo-url> cd vanguard npm install - Build the framework:
cd packages/vanguard-framework npm run build - Run tests:
npm test
Pull requests and issues are welcome! Please open an issue to discuss your ideas or report bugs.
License
MIT
