How devgoswami04/enterprise-ai-operating-system works
Enterprise AI Operating System is a multi-tenant AI workspace for cited knowledge retrieval, agent-assisted chat, durable organizational memory, and approval-gated workflows. A typical chat request is authenticated and assessed, retrieves workspace evidence, generates and evaluates a response, then records run and evaluation data. Document ingestion, tool governance, security, and observability are additional product capabilities. A persistence facade selects in-memory mock storage or PostgreSQL/pgvector; optional Redis/BullMQ moves workflow execution to a worker. Evidence is limited to the README, source index, and excerpts provided; unsampled implementation details are not assumed.
Main entry points: store.ts Persistence facade · orchestrator.ts Agent orchestrator · engine.ts Workflow engine · route.ts Chat endpoint
Components 27
Workspace and API
- Workspace UI
src/app/(workspace)/app - Chat endpoint
src/app/api/chat/route.ts - Documents endpoint
src/app/api/documents/route.ts - Search endpoint
src/app/api/search/route.ts - Memory endpoint
src/app/api/memory/route.ts - Workflow endpoint
src/app/api/workflows/[id]/runs/route.ts - Run event stream
src/app/api/runs/[id]/events/route.ts
AI and Knowledge
- Agent orchestrator
src/lib/ai/orchestrator.ts - Agent state machine
src/modules/agents/state-machine.ts - Model providers
src/lib/ai/providers.ts - Knowledge retrieval
src/modules/retrieval/service.ts - Document service
src/modules/documents/service.ts - Text chunking
src/lib/ai/chunking.ts - Durable memory
src/modules/memory/service.ts
Workflow Operations
- Workflow service
src/modules/workflows/service.ts - Workflow engine
src/lib/workflows/engine.ts - Workflow queue
src/modules/workflows/queue.ts - Background worker
src/worker.ts - Tool execution
src/modules/tools/service.ts
Security and Observability
- Session auth
src/lib/auth.ts - Security controls
src/lib/security/controls.ts - Role access
src/lib/security/rbac.ts - Metrics
src/modules/observability/metrics.ts
Persistence
- Persistence facade
src/lib/data/store.ts - Mock store
src/lib/data/memory-store.ts - Postgres repositories
src/lib/db/repositories
Other components
- Team user
Connections 32
- Team user → Workspace UI: uses
README.md - Workspace UI → Chat endpoint: requests chat
README.md - Chat endpoint → Session auth: authenticates
src/app/api/chat/route.ts - Chat endpoint → Agent orchestrator: orchestrates
src/app/api/chat/route.ts - Chat endpoint → Security controls: rate limits
src/app/api/chat/route.ts - Agent orchestrator → Agent state machine: runs graph
src/lib/ai/orchestrator.ts - Agent orchestrator → Model providers: generates with
src/lib/ai/orchestrator.ts - Agent orchestrator → Security controls: assesses input
src/lib/ai/orchestrator.ts - Agent orchestrator → Persistence facade: records and searches
src/lib/ai/orchestrator.ts - Agent orchestrator → Knowledge retrieval: retrieves evidence
- Documents endpoint → Session auth: authenticates
src/app/api/documents/route.ts - Documents endpoint → Role access: checks role
src/app/api/documents/route.ts - Documents endpoint → Document service: ingests documents
src/app/api/documents/route.ts - Document service → Persistence facade: persists documents
src/modules/documents/service.ts - Document service → Text chunking: uses chunking
- Search endpoint → Knowledge retrieval: searches
src/app/api/search/route.ts - Knowledge retrieval → Persistence facade: searches knowledge
src/modules/retrieval/service.ts - Memory endpoint → Durable memory: recalls or writes
src/app/api/memory/route.ts - Durable memory → Persistence facade: reads and writes
src/modules/memory/service.ts - Workflow endpoint → Workflow service: starts runs
src/app/api/workflows/[id]/runs/route.ts - Workflow service → Workflow queue: enqueues optionally
src/modules/workflows/service.ts - Run event stream → Workflow engine: streams execution
src/app/api/runs/[id]/events/route.ts - Workflow engine → Persistence facade: persists run state
src/lib/workflows/engine.ts - Workflow engine → Durable memory: writes outcomes
src/lib/workflows/engine.ts - Background worker → Workflow queue: processes jobs
src/worker.ts - Background worker → Workflow engine: executes runs
src/worker.ts - Workflow engine → Tool execution: creates gated calls
- Tool execution → Security controls: assesses payload
src/modules/tools/service.ts - Tool execution → Persistence facade: resolves tool call
src/modules/tools/service.ts - Persistence facade → Mock store: uses in mock mode
src/lib/data/store.ts - Persistence facade → Postgres repositories: routes in production
src/lib/data/store.ts - Workspace UI → Metrics: views observability
README.md