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

Function getAgent

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

Source from the content-addressed store, hash-verified

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

Callers 11

loadSourceAgentFunction · 0.90
handleTestFunction · 0.90
startAgentLoopFunction · 0.90
executeAgentIterationFunction · 0.90
fetchAgentReferenceDataFunction · 0.90
executeJavaScriptFunction · 0.90
withVerifyWarningsFunction · 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