Skip to main content

SDK Overview

FAOS provides official SDKs for Python and TypeScript/JavaScript, enabling programmatic access to the FAOS platform from your applications.

Installation​

Python​

pip install faos

Requirements: Python 3.10+

TypeScript / JavaScript​

npm install @faos/sdk
# or
yarn add @faos/sdk

Requirements: Node.js 18+

Quick Example​

Python​

from faos import FaosClient

async def main():
client = FaosClient(api_key="sk-...")

# Invoke an agent via shortcut
response = await client.shortcut("bank credit-analyst")
print(response.content)

# Stream a response
async for chunk in client.shortcut_stream("health patient-intake"):
print(chunk, end="")

await client.close()

TypeScript​

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

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

// Invoke an agent via shortcut
const response = await client.shortcut('bank credit-analyst');
console.log(response.content);

// Stream a response
for await (const chunk of client.shortcutStream('health patient-intake')) {
process.stdout.write(chunk);
}

Key Concepts​

Shortcuts​

Shortcuts are the primary way to invoke agents. A shortcut command like "bank credit-analyst" resolves to the appropriate agent in the Banking module.

<module> <agent>
  • Module: Industry vertical (e.g., bank, health, mfg)
  • Agent: Specialist within that module (e.g., credit-analyst, patient-intake)

Agent Response​

Every agent invocation returns an AgentResponse containing:

FieldTypeDescription
contentstringThe agent's response text
agent_idstringID of the agent that responded
metadataobjectAdditional response metadata

Error Handling​

Both SDKs provide typed error classes:

ErrorWhen
ShortcutNotFoundErrorShortcut command cannot be resolved
ShortcutRateLimitErrorAPI rate limit exceeded
FaosErrorBase error for all SDK errors

SDK Architecture​

FaosClient
β”œβ”€β”€ shortcut(command) β†’ AgentResponse
β”œβ”€β”€ shortcut_stream(command) β†’ AsyncIterator<string>
└── shortcuts β†’ ShortcutsClient
β”œβ”€β”€ resolve(command) β†’ ShortcutResolution
└── list(options?) β†’ ShortcutDefinition[]

Next Steps​