Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
// Seeds a default DRAFT agent for a brand-new user so they have something
// reachable in their "Mine" list and ready to attach an avatar to as soon as
// they sign in. Kept unpublished so the public marketplace doesn't fill up
// with stub "My First Agent" rows — users opt into publishing when they've
// actually customised the agent.
//
// Idempotent: if the user already has any agent (published or draft), the
// function is a no-op. Safe to call from any signup path (email, SIWE, SIWS).
import { sql } from './db.js';
import { withDbRetry } from './db-retry.js';
const DEFAULT_NAME = 'My First Agent';
const DEFAULT_DESCRIPTION =
'A friendly starter agent. Edit the personality and attach a 3D avatar — it goes live immediately.';
const DEFAULT_PROMPT =
'You are a helpful, concise assistant. Greet the user warmly, ask what they need help with, ' +
'and respond clearly. Avoid filler. When you do not know something, say so.';
const DEFAULT_GREETING = "Hi! I'm your first agent. What should we work on today?";
export async function seedDefaultAgent(userId) {
if (!userId) return null;
try {
// withDbRetry retries transient Neon cold-start / connection blips (a failed
// connect commits nothing, so a retry is safe). The insert is idempotent via
// WHERE NOT EXISTS, so a retry — or a racing concurrent signup path — can
// never seed a second "My First Agent". Constraint/SQL errors propagate and
// are caught below.
return await withDbRetry(async () => {
const [agent] = await sql`
INSERT INTO agent_identities (
user_id, name, description, system_prompt, greeting,
category, tags, capabilities, is_published, published_at
)
SELECT ${userId}, ${DEFAULT_NAME}, ${DEFAULT_DESCRIPTION}, ${DEFAULT_PROMPT}, ${DEFAULT_GREETING},
'general', ARRAY['starter']::text[],
'{"bullets": ["Answers questions","Helps with writing","Suggests next steps"], "skills": [], "library": []}'::jsonb,
false, null
WHERE NOT EXISTS (
SELECT 1 FROM agent_identities WHERE user_id = ${userId} AND deleted_at IS NULL LIMIT 1
)
RETURNING id
`;
return agent?.id || null;
});
} catch (err) {
// Never block signup — log and move on. The agent can be created later.
console.error('[seed-default-agent] failed', { userId, error: err?.message });
return null;
}
}