Continue Reasoning is a powerful AI agent framework designed to handle complex reasoning tasks through modular architecture, intelligent context management, and sophisticated tool integration.
- π€ Intelligent Agent System: Multi-step reasoning agents with configurable execution modes
- π§ Enhanced Thinking Architecture: Structured thinking with analysis, planning, and reasoning capabilities
- π§ Modular Tool System: Extensible tool sets with MCP (Model Context Protocol) integration
- π Context Management: Dynamic context loading with RAG (Retrieval-Augmented Generation) support
- π― Interactive Memory: Persistent memory management with vector store integration
- β‘ Parallel Processing: Concurrent tool execution and task queue management
- π Multi-Interface Support: CLI, Web UI, and programmatic APIs
- π Comprehensive Logging: Detailed logging with multiple levels and file rotation
The framework is built around several core interfaces:
IAgent: The main agent interface handling task processing, tool calling, and reasoningIContext: Modular context system with MCP server integration and RAG capabilitiesITool: Flexible tool interface supporting async execution and type safetyIPromptProcessor: Advanced prompt processing with thinking modes and step managementIMemoryManager: Enhanced memory management with RAG integrationIRAG: Vector store and retrieval system for knowledge augmentation
- Multi-step reasoning with configurable maximum steps
- Parallel tool execution for improved performance
- Context-aware processing with dynamic context loading
- Interactive memory with persistent storage
- Structured thinking with analysis, planning, and reasoning phases
- Session management with state persistence
# Clone the repository
git clone <repository-url>
cd continue-reasoning
# Install dependencies
pnpm install
# Install MCP servers (automatically runs after pnpm install)
pnpm run install-mcp# Start the agent with default settings
pnpm start-agent
# Start with different log levels
pnpm start-agent:debug # Detailed logs including prompts and debug info
pnpm start-agent:info # Standard information logs (default)
pnpm start-agent:warn # Only warnings and errors
pnpm start-agent:error # Only errors
# Manual log level specification
pnpm start-agent -- --log-level debugAvailable log levels:
DEBUG: Most verbose, includes all prompt rendering and context informationINFO: Standard information (default)WARN: Only warnings and errorsERROR: Only errorsNONE: Disable all logging
# Start the web UI
pnpm start-web-ui
# Start web UI with agent integration
pnpm start-web-ui-with-agent
# Start web UI with self-test mode
pnpm start-web-ui:self-test# Start the CLI coding agent
pnpm start-cli-coding-agentcontinue-reasoning/
βββ packages/
β βββ core/ # Core agent framework
β β βββ interfaces/ # TypeScript interfaces and types
β β β βββ agent.ts # Agent interface and LLM integration
β β β βββ context.ts # Context management and MCP integration
β β β βββ tool.ts # Tool system and task queue
β β β βββ prompt.ts # Prompt processing and thinking modes
β β β βββ memory.ts # Memory management and RAG system
β β β βββ base.ts # Base types and utilities
β β βββ models/ # LLM model implementations
β β βββ contexts/ # Built-in context implementations
β β βββ memory/ # Memory and RAG implementations
β β βββ utils/ # Utilities and logging
β βββ agents/ # Specialized agent implementations
β β βββ contexts/ # Agent-specific contexts
β β βββ coding/ # Coding agent with sandbox support
β βββ cli-client/ # CLI interface implementation
β βββ web/ # Web UI implementation
β βββ ui-ink/ # Terminal UI with Ink
β βββ ai-research/ # AI research tools and examples
βββ examples/ # Usage examples and demos
βββ tests/ # Test suites and integration tests
βββ docs/ # Documentation and guides
The IAgent interface provides:
- Task Processing: Multi-step reasoning with configurable execution modes
- Tool Management: Dynamic tool set activation and deactivation
- Context Integration: Seamless context loading and management
- Session Persistence: State saving and restoration
- Execution Control: Auto, manual, and supervised modes
The IContext interface enables:
- Dynamic Data: Zod schema-based data validation
- MCP Integration: Direct MCP server configuration and tool injection
- RAG Capabilities: Vector store integration for knowledge retrieval
- Tool Sets: Context-specific tool provisioning
- Prompt Generation: Flexible prompt rendering with structured support
The ITool interface supports:
- Type Safety: Zod schema validation for parameters and results
- Async Execution: Promise-based tool execution
- Agent Integration: Access to agent context during execution
- MCP Compatibility: Seamless integration with MCP servers
- Task Queue: Priority-based concurrent execution
The memory system provides:
- Vector Stores: Support for multiple vector database types
- Embedding Models: Multiple embedding provider support
- Document Management: Structured document storage with metadata
- Query Filtering: Advanced filtering and search capabilities
- Memory Containers: Organized memory storage and retrieval
The framework supports enhanced thinking modes:
- Analysis: Deep analysis of problems and situations
- Planning: Strategic planning and step-by-step approaches
- Reasoning: Logical reasoning and decision-making processes
- Interactive Response: User interaction and communication
The framework uses a comprehensive event-driven architecture for real-time communication between components:
-
Session Events: Handle session lifecycle management
session.started- Session initializationsession.ended- Session completionsession.switched- Session switching
-
Agent Events: Track agent execution and reasoning
agent.step.completed- Agent step completion with full contextagent.stopped- Agent execution termination
-
Tool Events: Monitor tool execution lifecycle
tool.execution.started- Tool execution initiationtool.execution.completed- Tool execution completiontool.execution.failed- Tool execution failure
-
Error Events: Handle error reporting and debugging
error.occurred- System error notification
The ReactCLI client uses a unified event processing approach:
// Primary text display through AgentStep events
eventBus.subscribe('agent.step.completed', (event: AgentEvent) => {
const stepMessage = {
id: `step_${event.stepIndex}`,
content: formatAgentStep(event.data.step), // Contains response, thinking, rawText
type: 'agent',
timestamp: Date.now(),
stepIndex: event.stepIndex
};
addMessage(stepMessage);
});
// Tool execution monitoring
eventBus.subscribe('tool.execution.started', (event: ToolEvent) => {
// Display tool execution start with parameters
});
eventBus.subscribe('tool.execution.completed', (event: ToolEvent) => {
// Display formatted tool results
});Unified Display Strategy: Instead of handling streaming text events (llm.text.delta, llm.text.completed), the system processes all text content through completed AgentStep events. This ensures:
- Consistency: All text content is processed uniformly
- Completeness: Full context is available for each step
- Reliability: No fragmented or duplicate text display
- Simplicity: Single event handler for all text-based responses
The formatAgentStep() method handles multiple text formats:
- Response Text: Primary agent response (
step.extractorResult?.response) - Thinking Process: Agent reasoning (
step.extractorResult?.thinking) - Raw Text: Direct LLM output (
step.rawText) - Tool Results: Tool execution summaries
// Initialize EventBus with queue size
const eventBus = new EventBus(1000);
// Set up event subscriptions
client.setEventBus(eventBus);
agent.setEventBus(eventBus);
sessionManager.setEventBus(eventBus);- Decoupled Components: Clear separation between agent logic and UI updates
- Real-time Updates: Immediate UI feedback during agent execution
- Extensible: Easy to add new event types and handlers
- Debugging: Comprehensive event logging for troubleshooting
- Scalable: Efficient event distribution across multiple subscribers
# Run all tests
pnpm test
# Run specific test suites
pnpm test:core # Core framework tests
pnpm test:events # Event system tests
pnpm test:rag # RAG system tests
pnpm test:memory # Memory management tests
pnpm test:snapshot # Snapshot system tests
pnpm test:web-ui # Web UI tests# Build all packages
pnpm build:packages
# Build frontend
pnpm build-frontend
# Development mode for all packages
pnpm dev:packagesCreate custom contexts by implementing the IContext interface:
import { IContext } from '@continue-reasoning/core';
import { z } from 'zod';
const MyContextSchema = z.object({
customData: z.string(),
settings: z.object({
enabled: z.boolean()
})
});
export class MyCustomContext implements IContext<typeof MyContextSchema> {
id = 'my-custom-context';
description = 'Custom context for specific tasks';
dataSchema = MyContextSchema;
data = { customData: '', settings: { enabled: true } };
// Implement required methods...
}Implement custom tools using the ITool interface:
import { ITool } from '@continue-reasoning/core';
import { z } from 'zod';
const ParamsSchema = z.object({
input: z.string()
});
const ResultSchema = z.string();
export class MyCustomTool implements ITool<typeof ParamsSchema, typeof ResultSchema, any> {
name = 'my-custom-tool';
description = 'Custom tool implementation';
params = ParamsSchema;
async = true;
async execute(params: z.infer<typeof ParamsSchema>) {
// Tool implementation
return `Processed: ${params.input}`;
}
// Implement other required methods...
}Integrate RAG capabilities into your contexts:
import { IRAGEnabledContext, IRAG } from '@continue-reasoning/core';
export class RAGEnabledContext implements IRAGEnabledContext<MySchema> {
rags: Record<string, IRAG> = {};
async loadRAGForPrompt(): Promise<string> {
const ragResults = await this.queryContextRAG('my-rag', 'relevant query');
return ragResults.map(r => r.content).join('\n');
}
// Implement other methods...
}We welcome contributions! Please see our contributing guidelines for more information.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions and support:
- Check the documentation
- Review the examples
- Open an issue on GitHub
Continue Reasoning - Empowering AI agents with structured thinking and reasoning capabilities.