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

Function getAgent

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

Source from the content-addressed store, hash-verified

193
194// Get a single agent by ID
195export async function getAgent(agentId: string): Promise<CompleteAgent | null> {
196 const db = await openDB();
197
198 // Get the agent metadata
199 const agentMetadata = await new Promise<any>((resolve, reject) => {
200 const tx = db.transaction(AGENT_STORE, 'readonly');
201 const store = tx.objectStore(AGENT_STORE);
202 const request = store.get(agentId);
203
204 request.onsuccess = () => resolve(request.result || null);
205 request.onerror = () => reject(request.error);
206 });
207
208 if (!agentMetadata) {
209 return null;
210 }
211
212 // Get the agent config
213 const config = await getAgentConfig(agentId);
214
215 // Combine into a CompleteAgent
216 return {
217 ...agentMetadata,
218 ...(config || {
219 model_name: '',
220 system_prompt: '',
221 loop_interval_seconds: 1.0
222 })
223 };
224}
225
226// Get agent configuration (for internal use)
227async function getAgentConfig(agentId: string): Promise<{

Callers 8

loadSourceAgentFunction · 0.90
startAgentLoopFunction · 0.90
executeAgentIterationFunction · 0.90
fetchAgentReferenceDataFunction · 0.90
registry.tsFile · 0.90
exportAgentToFileFunction · 0.85
downloadAgentFunction · 0.85

Calls 2

openDBFunction · 0.85
getAgentConfigFunction · 0.85

Tested by

no test coverage detected