# argil

> JavaScript SDK for Argil's API

Latest version **0.1.2** (published 2023-09-15) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install argil
pnpm add argil
yarn add argil
bun add argil
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2023-09-15 |
| First published | 2023-07-17 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 70.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Brivael Le Pogam |
| Maintainers | briva |
| Keywords | AI, automations, workflows, argil, argilai |

## Links

- npm: https://www.npmjs.com/package/argil
- Repository: https://github.com/argildotai/argil-sdk-javascript
- Homepage: https://github.com/argildotai/argil-sdk-javascript#readme
- Issues: https://github.com/argildotai/argil-sdk-javascript/issues
- npm.io page: https://npm.io/package/argil

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.4.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2023-09-15
- 0.1.1 — 2023-09-15
- 0.1.0 — 2023-08-23
- 0.0.13 — 2023-08-01
- 0.0.12 — 2023-07-19
- 0.0.11 — 2023-07-19
- 0.0.10 — 2023-07-19
- 0.0.9 — 2023-07-19
- 0.0.7 — 2023-07-19
- 0.0.6 — 2023-07-17
- 0.0.5 — 2023-07-17
- 0.0.4 — 2023-07-17
- 0.0.3 — 2023-07-17
- 0.0.2 — 2023-07-17
- 0.0.1 — 2023-07-17

## README

# Argil JavaScript SDK

Welcome to the Argil JavaScript SDK. This library provides a simple and intuitive interface to interact with Argil's API, allowing you to leverage the power of AI-driven workflows and automations in your JavaScript applications.

For the full Argil documentation, please visit https://docs.argil.ai.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [API Reference](#api-reference)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
- [Acknowledgements](#acknowledgements)
- [Contact](#contact)

## Installation

This library is distributed on `npm`. In order to add it as a dependency, run the following command:

```bash
npm install argil --save
```

or if you prefer using `yarn`:

```bash
yarn add argil
```

## Usage

Here is a quick example of how to use the Argil JavaScript SDK:

1. Import from argil and SDK instanciation

You can either provide the ARGIL_API_KEY environment variable and instantiate the SDK without passing any parameters:

```javascript
import { ArgilSdk } from 'argil';

const sdk = new ArgilSdk();
```

Or pass the configuration parameters to the constructor:

```javascript
import { ArgilSdk, ArgilSdkGlobalConfigParams } from 'argil';

const config: ArgilSdkGlobalConfigParams = {
  apiKey: 'your-api-key', // optional, can be provided with an environment variable named ARGIL_API_KEY
  apiUrl: 'https://api.argil.ai', // optional, default is 'https://api.argil.ai'
  synchronous: false, // optional, default is false. Defines if the workflows should run synchronously or not.
  defaultSyncTimeout: 60000, // optional, default is 60000 milliseconds for synchronous requests
  defaultAsyncTimeout: 2000, // optional, default is 2000 milliseconds for asynchronous requests
};

const sdk = new ArgilSdk(config);
```

2. Use the SDK client to call Argil's API routes

```javascript
// Run a workflow
const run = await sdk.workflows.run(
  'workflow-id',
  {
    "input_field_name1": $input_value1,
    "input_field_name2": $input_value2
    // Input fields depends on the workflow you run, please look at our full documentation.
  },
  { // An optional runtime config object to set options for this specific run.
    timeout: 5000, // optional, can override the default timeout for this specific request
    synchronous: true // optional, can override the default synchronous flag for this specific request
  }
);

// Get a workflow run
const workflowRun = await sdk.workflowRuns.get(run.id);

// Get all workflow runs
const workflowRuns = await sdk.workflowRuns.list();
```

## API Reference

The Argil JavaScript SDK provides the following classes:

- `ArgilSdk`: The main class that provides access to the different services.
- `Workflows`: A class for interacting with the Workflows service of the Argil API.
- `WorkflowRuns`: A class for interacting with the WorkflowRuns service of the Argil API.
- `ArgilSdkGlobalConfig`: A class for managing the global configuration for the SDK.
- `ArgilSdkRuntimeConfig`: A class for managing the runtime configuration for the SDK.
- `ArgilError`: A custom error class for providing more detailed and specific error messages.

For more detailed information, please refer to the source code and inline comments.

## Contributing

We welcome contributions from the community.

## License

This project is licensed under the GPL-3.0-or-later license. For more information, see the [LICENSE.md](LICENSE.md) file.

## Support

If you encounter any problems or have any questions, please open an issue on our [GitHub repository](https://github.com/argildotai/argil-sdk-javascript/issues).

## Acknowledgements

This project uses the following open-source packages:

- [axios](https://github.com/axios/axios): Promise based HTTP client for the browser and node.js

## Contact

For any inquiries, please contact us at briva@argil.ai.

---
_Source: https://npm.io/package/argil · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
