How modelengine-group/nexent works
Purpose and entry points
Nexent is a self-hosted, multi-tenant zero-code platform for creating, running, sharing, and evaluating AI agents. It combines an operator UI, Python backend APIs, reusable SDK runtime, and separately deployable processing/runtime/MCP services. Main application composition starts in backend/apps/app_factory.py; service-facing entry modules include backend/runtime_service.py, backend/mcp_service.py, and backend/data_process_service.py. The web UI is a Next.js application rooted at frontend/app/[locale]/layout.tsx and frontend/app/[locale]/page.tsx.
Web control plane
The frontend provides localized operator workflows for chat, agent configuration/versioning, knowledge bases, models, MCP services, skills, memory, evaluation, and tenant administration. Pages call a typed service layer rather than backend internals. Key interaction surfaces: frontend/app/[locale]/newchat/page.tsx, frontend/app/[locale]/agents/page.tsx, and frontend/app/[locale]/knowledges/page.tsx; API boundary clients include frontend/services/api.ts, frontend/services/agentConfigService.ts, and frontend/services/conversationService.ts.
Backend application and domain layer
backend/apps/ is the HTTP/application boundary, with domain-oriented app modules delegating to backend/services/. Central workflows cover agent lifecycle, streamed conversations, agent repositories, evaluation, scheduling, models, MCP, files, and tenant administration. Representative paths are backend/apps/agent_app.py, backend/services/agent_service.py, and backend/services/conversation_management_service.py. Middleware centralizes error translation in backend/middleware/exception_handler.py.
Agent execution runtime
Agent runs are coordinated by backend managers and the SDK’s core-agent stack. The runtime assembles prompts, available skills/tools, memory, knowledge, history, external A2A agents, and guardrails into a bounded context before model/tool execution. Important execution paths: backend/agents/agent_run_manager.py, sdk/nexent/core/agents/nexent_agent.py, and sdk/nexent/core/agents/context/manager.py. Natural-language generation paths for agents and skills are backend/services/nl2agent_service.py and backend/services/nl2skill_service.py.
Extensibility and external integration boundary
Tools can be native SDK tools, LangChain tools, locally managed MCP servers, remote MCP services, or A2A collaborators. MCP management includes container lifecycle concerns; A2A supports client/server adapters and discovery. Core paths: backend/services/mcp_management_service.py, backend/services/a2a_server_service.py, and sdk/nexent/core/agents/a2a_agent_proxy.py. Model-provider adapters isolate vendor-specific integrations in backend/services/providers/base.py, with implementations such as backend/services/providers/dashscope_provider.py.
Knowledge, memory, and asynchronous processing
File/knowledge ingestion is separated into a data-process service, using Ray-oriented workers, document chunking/extraction, storage records, embeddings, and vector retrieval. Paths: backend/data_process/worker.py, backend/data_process/tasks.py, and sdk/nexent/data_process/core.py. Persistent memory has record, retrieval, long-term, and “dreaming”/summarization stages: backend/services/memory_record_service.py, backend/services/memory_retrieval_service.py, and sdk/nexent/memory/dreaming/service.py.
Persistence, infrastructure, and operations
PostgreSQL/Supabase stores identity, RBAC, tenancy, agents, conversations, assets, configurations, and evaluation data via backend/database/client.py and domain repositories such as backend/database/agent_db.py. Deployment provisions PostgreSQL, Redis, MinIO, Elasticsearch, Supabase Auth/Kong, runtime, MCP, web, and data-process components through deploy/docker/compose/docker-compose.yml or Helm chart deploy/k8s/helm/nexent/Chart.yaml. Observability supports OpenTelemetry collector configurations and Grafana/Tempo, with optional Langfuse, LangSmith, Phoenix, or Zipkin exporters under deploy/docker/assets/monitoring/.
Main entry points: nexent_agent.py Core agent · app_factory.py Application composition · client.py PostgreSQL / Supabase data · docker-compose.yml Deployment stack
Components 20
Web control plane
- Localized operator UI · Chat, agents, knowledge, evaluation, and tenant workflows.
frontend/app/[locale]/layout.tsx - Chat, agent, knowledge pages
frontend/app/[locale]/newchat/page.tsx - Typed API clients
frontend/services/api.ts
Backend APIs
- Application composition
backend/apps/app_factory.py - Agent application API
backend/apps/agent_app.py - Exception translation
backend/middleware/exception_handler.py - Agent lifecycle service
backend/services/agent_service.py - Conversation service · Coordinates streamed conversations.
backend/services/conversation_management_service.py
Agent runtime
- Agent run coordinator
backend/agents/agent_run_manager.py - Core agent · Executes bounded agent runs with model and tools.
sdk/nexent/core/agents/nexent_agent.py - Context assembly · Combines prompts, history, skills, memory, knowledge, and guardrails.
sdk/nexent/core/agents/context/manager.py - Model provider adapters
backend/services/providers/base.py - A2A collaborators · Connects discovered external agents.
sdk/nexent/core/agents/a2a_agent_proxy.py
Knowledge and memory
- Data-process service
backend/data_process_service.py - Ingestion workers and tasks · Extracts, chunks, embeds, and records documents.
backend/data_process/worker.py - Document processing core
sdk/nexent/data_process/core.py - Long-term memory dreaming · Summarizes and consolidates persistent memory.
sdk/nexent/memory/dreaming/service.py
Platform services
- MCP management · Manages local containers and remote MCP services.
backend/services/mcp_management_service.py - PostgreSQL / Supabase data · Identity, tenancy, agents, conversations, assets, and evaluation data.
backend/database/client.py - Deployment stack · Provisions application services, data stores, and observability.
deploy/docker/compose/docker-compose.yml
Connections 24
- Localized operator UI → Chat, agent, knowledge pages: renders
- Chat, agent, knowledge pages → Typed API clients: uses
- Typed API clients → Application composition: HTTP API
- Application composition → Agent application API: mounts
- Application composition → Exception translation: applies
- Agent application API → Agent lifecycle service: delegates
- Agent application API → Conversation service: delegates
- Agent lifecycle service → Agent run coordinator: starts runs
- Conversation service → Agent run coordinator: streams runs
- Agent lifecycle service → PostgreSQL / Supabase data: stores agents
- Conversation service → PostgreSQL / Supabase data: stores conversations
- Agent run coordinator → Core agent: coordinates
- Core agent → Context assembly: builds context
- Core agent → Model provider adapters: invokes models
- Core agent → MCP management: uses MCP tools
- Core agent → A2A collaborators: delegates to agents
- Core agent → Long-term memory dreaming: reads and records memory
- Context assembly → Document processing core: retrieves knowledge
- Data-process service → Ingestion workers and tasks: dispatches ingestion
- Ingestion workers and tasks → Document processing core: processes documents
- Ingestion workers and tasks → PostgreSQL / Supabase data: writes records
- Deployment stack → Application composition: deploys backend
- Deployment stack → Data-process service: deploys processor
- Deployment stack → PostgreSQL / Supabase data: provisions