A collection of reusable processor pieces for AI agents including chat compression, loop detection, session management, message modifiers, and file tools.
This package provides ready-to-use components that extend the @codebolt/agentprocessorframework framework. These pieces can be used across different AI agent implementations to provide common functionality without duplication.
Automatically compresses chat history when it exceeds a threshold to maintain performance.
import { ChatCompressionProcessor } from '@agentProcessorPieces/core';
const compressor = new ChatCompressionProcessor(20); // Compress after 20 messagesDetects and prevents infinite loops in agent conversations.
import { LoopDetectorProcessor } from '@agentProcessorPieces/core';
const loopDetector = new LoopDetectorProcessor(3); // Max 3 loops per promptManages session turn limits and provides session control.
import { SessionTurnProcessor } from '@agentProcessorPieces/core';
const sessionManager = new SessionTurnProcessor(10); // Max 10 turns per sessionDetects URLs in messages and adds context about them.
import { HandleUrlMessageModifier } from '@agentProcessorPieces/core';
const urlModifier = new HandleUrlMessageModifier(true); // Enable Google searchComplete set of file manipulation tools:
- FileReadTool: Read file contents
- FileWriteTool: Write content to files
- FileDeleteTool: Delete files
- FileMoveTool: Move files between locations
- FileCopyTool: Copy files between locations
import {
FileReadTool,
FileWriteTool,
FileDeleteTool
} from '@agentProcessorPieces/core';
const readTool = new FileReadTool();
const writeTool = new FileWriteTool();
const deleteTool = new FileDeleteTool();npm install @agentProcessorPieces/core
# or
pnpm add @agentProcessorPieces/coreimport {
ChatCompressionProcessor,
LoopDetectorProcessor,
SessionTurnProcessor,
HandleUrlMessageModifier,
FileReadTool
} from '@agentProcessorPieces/core';
// Create processors
const compressor = new ChatCompressionProcessor(20);
const loopDetector = new LoopDetectorProcessor(3);
const sessionManager = new SessionTurnProcessor(10);
// Create message modifier
const urlModifier = new HandleUrlMessageModifier(true);
// Create tools
const readTool = new FileReadTool();import { BaseProcessor } from '@codebolt/agentprocessorframework';
import { ChatCompressionProcessor } from '@agentProcessorPieces/core';
// Use in your custom processor
class CustomProcessor extends BaseProcessor {
private compressor = new ChatCompressionProcessor(15);
async *processInput(input) {
// Use the compression processor
for await (const event of this.compressor.processInput(input)) {
if (event.type === 'CompressedMessage') {
// Handle compressed message
yield* this.yieldEvent('CustomProcessed', event.value);
}
}
}
}@codebolt/agentprocessorframework: Core framework interfaces and base classes
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.