UNPKG

@agentdao/core

Version:

Core functionality, skills, and ready-made UI components for AgentDAO - Web3 subscriptions, content generation, social media, help support, live chat, RSS fetching, web search, and agent pricing integration

27 lines (26 loc) 906 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentBridgeClient = void 0; /** * AgentBridgeClient for interacting with the AgentDAO API. * @param baseUrl - The base URL of the AgentDAO API * @param token - The AgentDAO API key (required) */ class AgentBridgeClient { constructor(baseUrl, token) { this.baseUrl = baseUrl; this.token = token; if (!token) { throw new Error('AgentDAO API key is required. Please provide your API key as the second argument.'); } } async getAgent(agentId) { const res = await fetch(`${this.baseUrl}/api/agentbridge/agents/${agentId}`, { headers: { Authorization: `Bearer ${this.token}` }, }); if (!res.ok) throw new Error('Failed to fetch agent'); return res.json(); } } exports.AgentBridgeClient = AgentBridgeClient;