danube
v0.2.0
Published
Official TypeScript SDK for Danube AI - Tool discovery, execution, and integration for AI agents
Downloads
228
Maintainers
Readme
danube
Official TypeScript SDK for Danube AI — tool discovery, execution, and integration for AI agents.
Installation
npm install danubeQuick Start
import { DanubeClient } from 'danube';
const client = new DanubeClient({ apiKey: 'dk_...' });
// Search and execute tools
const tools = await client.tools.search('send email');
const result = await client.tools.execute({
toolName: 'Gmail - Send Email',
parameters: { to: '[email protected]', subject: 'Hello' },
});
// Clean up
client.close();Configuration
const client = new DanubeClient({
apiKey: 'dk_...', // or set DANUBE_API_KEY env var
baseUrl: 'https://...', // or set DANUBE_API_URL env var (default: https://api.danubeai.com)
timeout: 30, // seconds (default: 30)
maxRetries: 3, // retry count for transient errors (default: 3)
});Resources
Tools
// Search tools
const tools = await client.tools.search('weather forecast');
// Search within a service
const tools = await client.tools.search('send', { serviceId: 'service-uuid' });
// Get tool by ID
const tool = await client.tools.get('tool-uuid');
// Execute by ID
const result = await client.tools.execute({
toolId: 'tool-uuid',
parameters: { city: 'London' },
});
// Execute by name (searches automatically)
const result = await client.tools.execute({
toolName: 'Weather - Get Forecast',
parameters: { city: 'London' },
});Services
const services = await client.services.list({ query: 'email' });
const service = await client.services.get('service-uuid');
const { tools, needsConfiguration } = await client.services.getTools('service-uuid');Workflows
const workflows = await client.workflows.list({ query: 'data pipeline' });
const detail = await client.workflows.get('workflow-uuid');
const execution = await client.workflows.execute('workflow-uuid', {
query: 'analyze this data',
});
const status = await client.workflows.getExecution(execution.id);Agent Web (Sites)
const sites = await client.sites.search({ query: 'stripe' });
const site = await client.sites.get('site-uuid');
const stripe = await client.sites.getByDomain('stripe.com');Skills
const skills = await client.skills.search('data analysis');
const skill = await client.skills.get({ skillName: 'My Skill' });Identity
const identity = await client.identity.get();
console.log(identity.profile, identity.contacts);Credentials
await client.credentials.store({
serviceId: 'service-uuid',
credentialType: 'api_key',
credentialValue: 'sk-...',
});Wallet
const balance = await client.wallet.getBalance();
console.log(`$${balance.balanceDollars}`);
const transactions = await client.wallet.getTransactions({ limit: 10 });Agents
// Register an autonomous agent (no auth required)
const registration = await client.agents.register({
name: 'My Agent',
operatorEmail: '[email protected]',
});
console.log(registration.apiKey); // one-time display
// Get agent info (requires API key)
const info = await client.agents.getInfo();
// Fund agent wallet
const fund = await client.agents.fundWallet({
method: 'card_checkout',
amountCents: 1000,
});Error Handling
import {
DanubeClient,
AuthenticationError,
NotFoundError,
RateLimitError,
} from 'danube';
try {
const result = await client.tools.execute({ toolName: 'My Tool' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Invalid API key');
} else if (error instanceof NotFoundError) {
console.error(`Not found: ${error.resource}`);
} else if (error instanceof RateLimitError) {
console.error(`Rate limited, retry after ${error.retryAfter}s`);
}
}Requirements
- Node.js 18+ (uses native
fetch) - Zero runtime dependencies
License
MIT
