A production-grade Go framework for text and voice AI assistants — with interruptible multi-agent workflows, real-time orchestration, hierarchical memory/RAG, queue-backed execution, multi-tenancy, and Stripe-based monetization.
What DigiTwin is for
Most “AI chatbot” and agent systems are built on low-code flow editors or Python scripts: state is fragile, flows are not reusable, deployments are ad-hoc, and long-running or interruptible workflows are not supported.
DigiTwin is a backend framework for teams that need reliable, stateful, configurable, and scalable AI assistants running in real production environments. It unifies Telegram and voice interfaces, multi-agent workflows, hierarchical memory, background jobs, and billing into a coherent runtime.
- Organizations, bots, workflows, agents, personas, chats, memory banks modeled as catalogs in Postgres
- Versioned JSONB settings define prompts, LLMs, voice modes, quotas and behavior
- Runtime picks up configuration changes automatically — no redeploys needed
- Multiple organizations and bots run on a shared infrastructure with isolated policies
- Agents are modular components (router, tool-using agent, summarizer, validator, sales dialog, etc.)
- Workflows define agent ordering, transitions and conditions
- Personas encode assistant behavior and constraints
- Deterministic, concurrency-safe execution designed for large parallel workloads
- Normalized pipeline:
Telegram → Processor → Workflow → Agents → Memory → Reply - Persistent models for users, chats, bots, states
- Multi-step dialogs, guided flows, controlled transitions
- Telegram-based admin console: unified view of all conversations for monitoring and manual actions
- Voice integrations:
- OpenAI Realtime for low-latency voice I/O
- SIP outbound calling via worker pipelines
- Same workflow/agent abstractions across text and voice
- Three memory layers:
- organization ROM (shared knowledge)
- persona long-term memory
- chat RAM (session state)
- Embeddings generated by local lightweight models or remote LLMs
- Background memory manager updates vectors continuously
- Simple store/search APIs enable RAG and personalization without embedding-coupled business logic
- New messages arriving mid-workflow cancel the in-flight LLM step
- Conversation state is updated and workflow restarts with the latest context
- Assistant reacts to current intent, not outdated intermediate messages
- Critical for responsive chat UX and real-time voice interactions
- All heavy processing executed by a persistent, queue-backed worker system
- Durable asynchronous tasks with scheduling, retries, backoff
- Worker pools configurable per task type
- Safe restarts: tasks resume automatically
- Idempotency where needed; failures are observable, not silent
- Suitable for long-running production workloads rather than stateless LLM wrappers
- Stripe for payments, subscriptions, usage quotas
- Structured logging, Sentry, Loki labels, health endpoints
- Environment-based secret management compatible with any secret store
- Docker-based environments for local and production deployment
- Postgres as the primary data store (tenants, configuration, state, queues, memory)
- Extend behavior by configuring new organizations/bots/workflows, not rewriting backend code
- Architecture Overview — core components and data model
- Agentic Loop — multi-agent orchestration
- Memory & RAG — memory layers and retrieval
- Voice Architecture — realtime and SIP voice pipeline
- Examples — real assistants built on DigiTwin
For collaboration or enterprise integration: [email protected]
Maintainer: Konstantin Trunin — https://www.linkedin.com/in/ktrunin