Nexent is an AI agent-based intelligent dialogue system, adopting a frontend-backend separated architecture. It supports multi-tenancy, multi-language, streaming responses, and other enterprise-level features.
nexent/
├── frontend/ # Frontend application (Next.js + TypeScript)
├── backend/ # Backend services (FastAPI + Python)
├── sdk/ # Python SDK
├── docker/ # Docker deployment configuration
├── make/ # Build scripts
├── test/ # Test code
└── assets/ # Static resources
frontend/
├── app/ # Next.js App Router
│ └── [locale]/ # Internationalization routes (zh/en)
│ ├── chat/ # Chat interface
│ │ ├── internal/ # Core chat logic
│ │ ├── layout/ # Chat layout components
│ │ └── streaming/ # Streaming response handling
│ ├── setup/ # System settings pages
│ │ ├── agentSetup/ # Agent configuration
│ │ ├── knowledgeBaseSetup/ # Knowledge base configuration
│ │ └── modelSetup/ # Model configuration
│ └── layout.tsx # Global layout
├── components/ # Reusable UI components
│ ├── providers/ # Context providers
│ └── ui/ # Basic UI component library
├── services/ # API service layer
│ ├── api.ts # API base configuration
│ ├── conversationService.ts # Conversation service
│ ├── agentConfigService.ts # Agent configuration service
│ ├── knowledgeBaseService.ts # Knowledge base service
│ └── modelService.ts # Model service
├── hooks/ # Custom React Hooks
├── lib/ # Utility library
├── types/ # TypeScript type definitions
├── public/ # Static resources
│ └── locales/ # Internationalization files
└── middleware.ts # Next.js middleware
Responsibilities:
- Presentation Layer: User interface and interaction logic
- Service Layer: Encapsulate API calls, handle data transformation
- State Management: Use React Hooks to manage component state
- Internationalization: Support for Chinese and English switching
- Routing Management: Based on Next.js App Router
backend/
├── apps/ # API application layer
│ ├── base_app.py # FastAPI main application
│ ├── agent_app.py # Agent-related APIs
│ ├── conversation_management_app.py # Conversation management APIs
│ ├── file_management_app.py # File management APIs
│ ├── knowledge_app.py # Knowledge base APIs
│ ├── model_managment_app.py # Model management APIs
│ ├── config_sync_app.py # Configuration sync APIs
│ └── voice_app.py # Voice-related APIs
├── services/ # Business service layer
│ ├── agent_service.py # Agent business logic
│ ├── conversation_management_service.py # Conversation management
│ ├── elasticsearch_service.py # Search engine service
│ ├── model_health_service.py # Model health check
│ ├── prompt_service.py # Prompt service
│ └── tenant_config_service.py # Tenant configuration service
├── database/ # Data access layer
│ ├── client.py # Database connection
│ ├── db_models.py # Database models
│ ├── agent_db.py # Agent data operations
│ ├── conversation_db.py # Conversation data operations
│ ├── knowledge_db.py # Knowledge base data operations
│ └── tenant_config_db.py # Tenant configuration data operations
├── agents/ # Agent core logic
│ ├── agent_run_manager.py # Agent run manager
│ ├── create_agent_info.py # Agent info creation
│ └── default_agents/ # Default agent configuration
├── data_process/ # Data processing module
│ ├── app.py # Data processing application
│ ├── config.py # Data processing configuration
│ ├── tasks.py # Data processing tasks
│ ├── worker.py # Data processing worker
│ └── utils.py # Data processing utilities
├── utils/ # Utility classes
│ ├── auth_utils.py # Authentication utilities
│ ├── config_utils.py # Configuration utilities
│ ├── file_management_utils.py # File management utilities
│ ├── logging_utils.py # Logging utilities
│ └── thread_utils.py # Thread utilities
├── consts/ # Constant definitions
│ ├── const.py # System constants
│ └── model.py # Data models
├── prompts/ # Prompt templates
│ ├── knowledge_summary_agent.yaml # Knowledge base summary agent
│ ├── manager_system_prompt_template.yaml # Manager system prompt
│ └── utils/ # Prompt utilities
├── sql/ # SQL scripts
├── assets/ # Backend resource files
├── main_service.py # Main service entry
├── data_process_service.py # Data processing service entry
└── requirements.txt # Python dependencies
Responsibilities:
- Application Layer (apps): API route definitions, request parameter validation, response formatting
- Service Layer (services): Core business logic, data processing, external service calls
- Data Layer (database): Database operations, ORM models, data access interfaces
- Agent Layer (agents): AI agent core logic, tool invocation, inference execution
- Utility Layer (utils): General utility functions, configuration management, logging
sdk/
└── nexent/
├── core/ # Core functionality
│ ├── agents/ # Agent core
│ │ ├── core_agent.py # Base agent class
│ │ ├── nexent_agent.py # Nexent agent implementation
│ │ └── run_agent.py # Agent runner
│ ├── models/ # Model interfaces
│ │ ├── openai_llm.py # OpenAI LLM
│ │ ├── embedding_model.py # Embedding model
│ │ ├── stt_model.py # Speech-to-text
│ │ └── tts_model.py # Text-to-speech
│ ├── tools/ # Tool collection
│ │ ├── knowledge_base_search_tool.py # Knowledge base search
│ │ ├── search_tool.py # General search
│ │ └── summary_tool.py # Summary tool
│ ├── nlp/ # NLP tools
│ └── utils/ # SDK utilities
├── data_process/ # Data processing
│ ├── core.py # Data processing core
│ └── excel_process.py # Excel processing
└── vector_database/ # Vector database
├── elasticsearch_core.py # ES core interface
└── utils.py # Vector database utilities
Responsibilities:
- Core Functionality: Provide core interfaces for AI agents, model invocation, and tool integration
- Data Processing: File processing, data cleansing, format conversion
- Vector Database: Vector storage, similarity search, index management
docker/
├── docker-compose.yml # Development environment configuration
├── docker-compose.prod.yml # Production environment configuration
├── docker-compose.dev.yml # Development environment configuration
├── deploy.sh # Deployment script
├── uninstall.sh # Uninstall script
├── init.sql # Database initialization
└── sql/ # Database migration scripts
Responsibilities:
- Environment Configuration: Development, testing, and production environment setup
- Service Orchestration: Multi-service container orchestration
- Deployment Scripts: Automated deployment and operations
test/
├── backend/ # Backend tests
│ └── services/ # Service layer tests
├── sdk/ # SDK tests
├── run_all_tests.py # Test runner
└── workflow_test.py # Workflow tests
Responsibilities:
- Unit Testing: Module functionality tests
- Integration Testing: Service integration tests
- End-to-End Testing: Complete workflow tests
User input → Frontend validation → API call → Backend routing → Business service → Data access → Database
User message → Agent creation → Tool invocation → Model inference → Streaming response → Result saving
File upload → Temporary storage → Data processing → Vectorization → Knowledge base storage → Index update
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- UI Library: React + Tailwind CSS
- State Management: React Hooks
- Internationalization: react-i18next
- HTTP Client: Fetch API
- Framework: FastAPI
- Language: Python 3.9+
- Database: PostgreSQL + Redis + Elasticsearch
- File Storage: MinIO
- Task Queue: Celery + Ray
- AI Framework: smolagents
- Vector Database: Elasticsearch
- Containerization: Docker + Docker Compose
- Reverse Proxy: Nginx
- Monitoring: Built-in health checks
- Logging: Structured logging
- Node.js 18+
- Python 3.9+
- Docker & Docker Compose
- PostgreSQL 13+
- Redis 6+
- Elasticsearch 7+
- Clone the project
- Configure environment variables
- Start Docker services
- Run database migrations
- Start frontend and backend services
- Follow RESTful API design principles
- Use TypeScript for type-safe development
- Follow Python PEP8 coding standards
- Write unit and integration tests
- Use Git Flow workflow
- Create the tool class in
sdk/nexent/core/tools/ - Configure the tool in
backend/agents/default_agents/ - Update the frontend tool configuration interface
- Implement the model interface in
sdk/nexent/core/models/ - Add the model service in
backend/services/ - Update the model configuration management
- Create the API route in
backend/apps/ - Implement business logic in
backend/services/ - Add data operations in
backend/database/ - Update frontend service calls
A: Upload documents via the file management API. The system will automatically process and store them in Elasticsearch.
A: Add the model configuration in the model management interface, including API keys, endpoints, etc.
A: Modify system prompts, tool configurations, and other parameters via the agent configuration interface.
A: Refer to the SDK documentation to implement custom tools and model interfaces.
- Fork the project
- Create a feature branch
- Commit code changes
- Create a Pull Request
- Wait for code review
This project uses the MIT License. See the LICENSE file for details.