Run settings reference

When running apps or deployments by API, AI Hub supports runtime configs and webhooks. You can also specify a file path to a connected drive to act as your run’s input or output location.

Runtime configs

You can use the runtime_config setting to specify key-value pairs to pass into the run at runtime. These values are propagated to downstream processes and can be referenced in validation functions.

For example, if your validation function’s behavior varies based on time of year, you might use runtime_config to pass in the current date:

1{
2 "current_date": "06/01/2024",
3 ...
4}

Webhook parameters

You can use the webhook_config setting to ensure your application is notified when a run completes. AI Hub POSTs JSON-encoded data of the format below to the webhook endpoint:

$# body
>{
>"status": <string>,
>"msg": <string>,
>"job_id": <string>,
>"input_dir": <string>,
>"output": <string>
>}

The response body contains the following fields:

  • status: "OK" | "ERROR"

  • msg: (optional) Error message. Present only if status is ERROR.

  • job_id: A unique identifier for the run.

  • input_dir: Input directory.

  • output: The full path to the root output folder.

To acknowledge receipt of the event, your endpoint must return a 2xx HTTP status code. All response codes outside this range, including 3xx codes, indicate to AI Hub that you did not receive the event.

If AI Hub does not receive a 2xx HTTP status code, the notification attempt is repeated up to 7 times.

Specifying file paths

When running an app using the v2/apps/runs endpoint, there are two methods to specify the app’s input:

  • Batch: Create a batch using the Batches endpoint, upload files from your local filesystem, then use the batch_id parameter to specify the batch. All files in the batch are processed.

  • Connected drive: Use the input_dir parameter to specify a file path to an input folder in a connected drive. All files in the input folder are processed.

When specifying a file path in a connected drive, the format varies if you have a community or organization account.

  • Community account: /<USER-ID>/my-repo/fs/<DRIVE-NAME>/<FOLDER>/

  • Organization account: /<ORGANIZATION-ID>/<WORKSPACE>/fs/<DRIVE-NAME>/<FOLDER>/

ValueDescription
<USER-ID>Your user ID. You can find this on the Settings > APIs page, under User ID.
<ORGANIZATION-ID>Your organization ID. You can find this on the Settings > APIs page, under Organization ID.
<WORKSPACE>This value reflects the workspace name (shared workspaces) or your user ID (personal workspaces). You can find this value by selecting the workspace in Workspaces, then looking at the workspace query string in the URL.

For example:
- https://aihub.instabase.com/workspaces/create?workspace=New_Workspace
- https://aihub.instabase.com/workspaces/create?workspace=john.doe_gmail.com
<DRIVE-NAME>The drive’s display name. You can see a drive’s display name in by opening the Data Sources panel in a workspace where the drive is connected. For example, the Instabase Drive’s display name is Instabase Drive.
<FOLDER>The exact name of the folder, as displayed in the filesystem.