@autonomize/genesis
v2.12.11
Published
The official TypeScript SDK for Autonomize Genesis API. This SDK provides a simple and intuitive interface to interact with Genesis features like copilots, agents, and more.
Downloads
2,545
Keywords
Readme
Autonomize Genesis (@autonomize/genesis)
The official TypeScript SDK for Autonomize Genesis API. This SDK provides a simple and intuitive interface to interact with Genesis features like copilots, agents, and more.
Installation
Using npm:
npm install @autonomize/genesis
Using yarn:
yarn add @autonomize/genesis
Using pnpm:
pnpm add @autonomize/genesis
Quick Start
import Genesis from '@autonomize/genesis';
// Initialize the SDK with Keycloak authentication
const genesis = new Genesis({
baseURL: 'https://api-genesis.sprint.autonomize.dev/api/v1/',
auth: {
baseUrl: 'https://auth.sprint.autonomize.dev/',
realm: 'autonomize',
clientId: 'your-client-id',
clientSecret: 'your-client-secret'
}
});
// Initialize authentication
await genesis.initialize();
// Initialize and make API calls
async function getAssignedCopilots() {
try {
// Make authenticated API calls
const { data } = await genesis.copilots.getAssignedCopilots(123, {
page: 1,
limit: 10
});
console.log(data); // Copilots assigned to the client
} catch (error) {
console.error('Error:', error.message);
}
}
Development and Testing
To test new features or debug issues locally:
Clone the repository:
git clone https://github.com/autonomize-ai/autonomize-sdk-js.git cd autonomize-sdk-js
Set up the playground:
cd playground cp .env.example .env # Configure your environment variables pnpm install
Run the Genesis playground:
pnpm dev:genesis
This will start a development environment where you can test SDK features without publishing to npm.
Authentication
The SDK uses Keycloak for authentication, supporting both client credentials and password grant flows. For detailed authentication configuration and best practices, please refer to our Authentication Documentation.
Basic authentication setup:
const genesis = new Genesis({
baseURL: 'https://api.example.com',
auth: {
baseUrl: 'https://auth.example.com',
realm: 'your-realm',
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
// Optional configurations
expiresInMins: 10,
grantType: 'client_credentials' // or 'password'
}
});
// Initialize authentication
await genesis.initialize();
API Response Format
All API responses follow this structure:
interface GenesisApiResponse<T> {
status: string;
message: string;
data: T;
error: any;
statusCode: number;
}
Error Handling
The SDK handles errors consistently across all endpoints:
try {
return await genesis.copilots.getAssignedCopilots(someArgs);
} catch (error) {
console.error('Status Code:', error.statusCode);
console.error('Error Message:', error.message);
console.error('Error Details:', error.error);
}
Available Services
Copilots
The genesis.copilots
service allows you to access and manage anything related to copilots:
// Get assigned copilots
const response = await genesis.copilots.getAssignedCopilots({
page: 1,
limit: 10,
search: "Prior Authorization Copilot"
});
More services coming soon!
Development Status
This SDK is under active development. More features and improvements are coming soon.
Requirements
- Node.js >= 18
- TypeScript >= 5.7.2 (if using TypeScript)
- Auth (Keycloak) authentication server
- Valid Auth (Keycloack) client credentials or user credentials
Contributing
We welcome contributions! Please see our contributing guidelines for details.
Security Notes
Please refer to our Authentication Documentation for important security considerations when choosing and implementing authentication flows.
Support
For support, please contact [email protected] or open an issue in our GitHub repository.