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
// GET /api/cron/agent-avatar-backfill
//
// Steady-state drain of the "agent with no avatar" gap.
//
// Several agent-creation paths (minimal auto-provision, external registration,
// swarm treasuries, x402 ring agents) insert agent_identities rows with
// avatar_id = NULL, so their cards on /agents and the marketplace can never
// show a 3D preview. Each tick this cron assigns those agents a cloned public
// avatar from the platform gallery (see api/_lib/agent-avatars.js) — pure DB
// work, no rendering, no new storage bytes — until every agent has a body.
//
// Sibling cron avatar-thumbnail-backfill handles the other half of the
// guarantee (every public avatar has a thumbnail); together they make "every
// agent card has a real preview" an invariant instead of a hope.
//
// Env:
// CRON_SECRET required (Bearer)
// AGENT_AVATAR_BACKFILL_BATCH agents assigned per tick (default 100)
import { json, wrapCron } from '../_lib/http.js';
import { logger } from '../_lib/usage.js';
import { backfillAgentAvatars, agentAvatarCoverage } from '../_lib/agent-avatars.js';
import { requireCron } from '../_lib/cron-auth.js';
export const maxDuration = 120;
const log = logger('agent-avatar-backfill');
const BATCH = Math.max(0, Number(process.env.AGENT_AVATAR_BACKFILL_BATCH || 100));
export default wrapCron(async (req, res) => {
if (req.method !== 'GET') return json(res, 405, { error: 'method_not_allowed' });
if (!requireCron(req, res)) return;
let result = { claimed: 0, assigned: 0, failed: 0 };
if (BATCH > 0) {
try {
result = await backfillAgentAvatars({ limit: BATCH });
if (result.assigned) log.info('agent_avatars_assigned', result);
if (result.failed) log.warn('agent_avatar_assign_failed', result);
} catch (err) {
log.warn('agent_avatar_backfill_failed', { message: err?.message });
return json(res, 200, { ok: false, reason: `backfill_failed: ${err?.message}` });
}
}
const cov = await agentAvatarCoverage().catch(() => null);
return json(res, 200, {
ok: true,
...result,
coverage: cov,
});
}, { maxDurationMs: maxDuration * 1000 });