一个开源的 Rust 引擎,用于具备记忆、关系状态和结构化用户洞察的 AI 伴侣。
AI 翻译
An open-source Rust engine for AI companions with memory, relationship state, and structured user insight.
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
An open-source Rust engine for AI companions that feel real: persistent memory, an evolving relationship model, and a decision engine that keeps a persona in character across thousands of turns.
Most AI character apps eventually forget who you are. Their relationships reset to whatever fits in a prompt, and their personalities drift as the conversation grows. eros-engine makes those parts durable: a companion remembers you across sessions, the relationship changes through interaction, and each reply is chosen in character rather than improvised by a generic assistant.查看完整 README ↗An open-source Rust engine for AI companions that feel real: persistent memory, an evolving relationship model, and a decision engine that keeps a persona in character across thousands of turns.
Most AI character apps eventually forget who you are. Their relationships reset to whatever fits in a prompt, and their personalities drift as the conversation grows. eros-engine makes those parts durable: a companion remembers you across sessions, the relationship changes through interaction, and each reply is chosen in character rather than improvised by a generic assistant.
The engine has nine foundations:
[providers]. → API reference · Model config A downstream can also let its end users bring their own chat endpoint and key per turn. → BYOK A downstream can also serve characters the engine never stores: each request carries the character card, sealed under a per-instance key. → BYOCThis is not a generic agent framework. It is the stateful core for products where one persona gets to know the same person over time: companions, journals, coaches, tutors, and character chat.
┌───────────────────────────────────────────────────────────┐
│ /comp/* HTTP routes ← Supabase JWT middleware │
│ │ │
│ ▼ │
│ pipeline orchestrator: load → PDE → handler → chat → post │
│ │ │
│ ┌────────────────────────────────────────────────────┴─┐ │
│ │ post-process, spawned after reply │ │
│ │ • affinity: graded turn + derived endpoints │ │
│ │ • memory: Voyage embed → pgvector upsert │ │
│ │ • insight: facts → ledger → scheduled rebuild │ │
│ └──────────────────────────────────────────────────────┘ │
└───────────────────────────────────────────────────────────┘
Four crates keep domain logic, model access, persistence, and the HTTP service separate. Run eros-engine-server as an API, or embed core + llm + store in your own Rust service. See Architecture for the boundaries and data flow.
The three library crates are on crates.io (core · store · llm):
cargo add eros-engine-core eros-engine-store eros-engine-llm
[dependencies]
eros-engine-core = "2.5"
eros-engine-store = "2.5" # optional: Postgres + pgvector persistence
eros-engine-llm = "2.5" # optional: model and embedding clients
eros-engine-server is not published to crates.io; run it as a Docker image instead.
Multi-architecture images are published to GitHub Container Registry for every v* tag:
docker pull ghcr.io/etherfunlab/eros-engine:2.5.2
# Or follow the latest tagged release
docker pull ghcr.io/etherfunlab/eros-engine:latest
docker run --rm -p 8080:8080 --env-file .env \
ghcr.io/etherfunlab/eros-engine:2.5.2 serve
Bring your own Postgres and .env; the same docker/Dockerfile can be deployed to any container host. See Deploying.
[providers].You need Rust, Postgres 16+ with pgvector, an OpenRouter API key, and one auth source. Voyage powers the default embedding route; embeddings can be routed to other providers instead, and once both embedding reads and writes leave Voyage, VOYAGE_API_KEY is no longer needed.
git clone https://github.com/etherfunlab/eros-engine
cd eros-engine
cp .env.example .env # Set DATABASE_URL, OPENROUTER_API_KEY, VOYAGE_API_KEY, and one auth source
cargo run -p eros-engine-server -- migrate
cargo run -p eros-engine-server -- seed-personas examples/personas
cargo run -p eros-engine-server -- serve
The server listens on 0.0.0.0:8080 by default, with Scalar API docs at /docs. The official Eros Chat web client is closed-source, so bring your own UI or embed the crates in another service.
The main flow is simple: start a persona session, then send turns to the SSE streaming endpoint. Voice runs on its own channel — start the session with channel: "voice" and use the voice turn endpoint, which carries a leaner prompt and a barge-in call; the two channels never write into each other's sessions. A separate enqueue-only endpoint (POST /v2/comp/session/{session_id}/message/async) exists for bot-style callers that cannot hold a stream open; a background worker generates the reply and it lands in history/Realtime instead of a stream frame. The engine also exposes history, session, profile, and affinity routes, group management under /v2/comp/group*, and a route that asks for a life event in the persona's day (POST /v2/comp/session/{session_id}/events). Authentication uses Supabase JWTs by default and can be replaced through AuthValidator. Setting CALLER_SECRET also requires an x-caller-secret header on those routes, so only the deployment's own server can call them, not an end user holding a JWT. The optional /svc/v1/* service routes are admitted by shared secrets instead, in three sub-trees that are each mounted only when their own secret is set: INSIGHTS_EXPORT_SECRET (the profile and memory exports and the erased-user stream), FACTS_EXPORT_SECRET (the fact ledger export) and USER_ERASE_SECRET (user erasure). See the API reference for paths, payloads, and stream frames.
At minimum, configure DATABASE_URL, one authentication source, and OPENROUTER_API_KEY — OpenRouter is the built-in default and its key is always required at boot. [providers] adds OpenAI-compatible endpoints for chat and embeddings, each with its own key; the default Voyage embedding setup requires VOYAGE_API_KEY, unless [tasks.embedding] routes both reads and writes elsewhere.
The complete environment list is in .env.example, operational guidance in Deploying, and routing details in Model config.
This repository is the conversation, memory, and relationship-state core. Matchmaking, the full social product experience, and persona marketplace or provenance logic remain outside the engine. The reusable center is the affinity, memory, and insight pipeline.
The personas in examples/personas/ are adult character-chat examples. They may flirt or express desire as a relationship develops, while refusing disrespectful or boundary-crossing behavior. Replace them before deployment if your product needs a SFW default.
Per-request behavior can also be adjusted through prompt_traits. The engine treats this text as opaque; your frontend or middleware owns its policy.
[providers] and BYOK → Model config · BYOKPartner links may earn eros-engine a referral commission.
Read CONTRIBUTING.md. Contributors accept the CLA through cla-assistant.io on their first PR.
eros-engine is licensed under AGPL-3.0-only. For commercial licensing, contact [email protected].