Skip to main content

ShortcutsClient

Lower-level client for shortcut resolution and listing. Accessible via FaosClient.shortcuts.

import { FaosClient } from '@faos/sdk';

const client = new FaosClient({ apiKey: 'sk-...' });
const shortcutsClient = client.shortcuts;

Methods​

resolve(command, context?)​

Resolve a shortcut command to an agent. Returns resolution details including the agent ID, module info, and capabilities.

async resolve(
command: string,
context?: Record<string, unknown>
): Promise<ShortcutResolution>
ParameterTypeDescription
commandstringShortcut command (e.g., "bank credit-analyst")
contextRecord<string, unknown>Optional context hints for resolution

Returns: Promise<ShortcutResolution>

Throws: ShortcutRateLimitError if rate limit is exceeded.

const resolution = await client.shortcuts.resolve('bank credit-analyst');

if (resolution.resolved) {
console.log(`Agent: ${resolution.agent_name}`);
console.log(`Module: ${resolution.module_name}`);
console.log(`Capabilities: ${resolution.capabilities}`);
} else {
console.log(`Suggestions: ${resolution.suggestions}`);
}

list(options?)​

List available shortcuts with optional filtering.

async list(options?: ShortcutListOptions): Promise<ShortcutDefinition[]>
ParameterTypeDescription
optionsShortcutListOptionsOptional filters

Returns: Promise<ShortcutDefinition[]>

Throws: ShortcutRateLimitError if rate limit is exceeded.

// List all shortcuts
const all = await client.shortcuts.list();

// Filter by module
const bankShortcuts = await client.shortcuts.list({ module: 'faos-bank' });

// Search
const results = await client.shortcuts.list({ search: 'credit' });

for (const shortcut of results) {
console.log(`${shortcut.pattern}: ${shortcut.description}`);
console.log(` Type: ${shortcut.type}`);
console.log(` Examples: ${shortcut.examples}`);
}

HttpClient Interface​

The ShortcutsClient accepts any HTTP client implementing the HttpClient interface, allowing custom HTTP implementations:

interface HttpClient {
post<T>(url: string, body: unknown): Promise<T>;
get<T>(url: string): Promise<T>;
}

The SDK provides a default FetchHttpClient that uses the global fetch API.