Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/eliza/runtime-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,26 @@ class RuntimeCache {
}

async set(
agentId: string,
cacheKey: string,
runtime: AgentRuntime,
characterName: string,
actualAgentId: UUID,
): Promise<void> {
// Evict oldest if at capacity
if (this.cache.size >= this.MAX_SIZE) {
await this.evictOldest();
}

const now = Date.now();
this.cache.set(agentId, {
this.cache.set(cacheKey, {
runtime,
lastUsed: now,
createdAt: now,
agentId: agentId as UUID,
agentId: actualAgentId,
characterName,
});
elizaLogger.debug(
`[RuntimeCache] Cached runtime: ${characterName} (${agentId})`,
`[RuntimeCache] Cached runtime: ${characterName} (${actualAgentId}, key=${cacheKey})`,
);
}

Expand Down Expand Up @@ -448,7 +449,7 @@ export class RuntimeFactory {
await this.initializeRuntime(runtime, character, agentId);
await this.waitForMcpServiceIfNeeded(runtime, filteredPlugins);

await runtimeCache.set(cacheKey, runtime, character.name);
await runtimeCache.set(cacheKey, runtime, character.name, agentId);

edgeRuntimeCache
.markRuntimeWarm(agentId as string, {
Expand Down
Loading