MCPcopy Create free account
hub / github.com/Roy3838/Observer / exportAgentToFile

Function exportAgentToFile

app/src/utils/agent_database.ts:543–566  ·  view source on GitHub ↗
(agentId: string)

Source from the content-addressed store, hash-verified

541 * @returns A promise that resolves to a Blob containing the agent data
542 */
543export async function exportAgentToFile(agentId: string): Promise<Blob> {
544 const agent = await getAgent(agentId);
545 if (!agent) throw new Error(`Agent ${agentId} not found`);
546
547 const code = await getAgentCode(agentId);
548 if (code === null) throw new Error(`Code for agent ${agentId} not found`);
549
550 const memory = await getAgentMemory(agentId);
551
552 const exportData: AgentExport = {
553 id: agent.id,
554 name: agent.name,
555 description: agent.description,
556 model_name: agent.model_name,
557 system_prompt: agent.system_prompt,
558 loop_interval_seconds: agent.loop_interval_seconds,
559 only_on_significant_change: agent.only_on_significant_change,
560 code,
561 memory
562 };
563
564 const yamlStr = yaml.dump(exportData);
565 return new Blob([yamlStr], { type: 'application/x-yaml' });
566}
567
568export async function downloadAgent(agentId: string): Promise<void> {
569 try {

Callers

nothing calls this directly

Calls 3

getAgentFunction · 0.85
getAgentCodeFunction · 0.85
getAgentMemoryFunction · 0.85

Tested by

no test coverage detected