SDK Documentation
Integrail Cloud SDK Quick Guide
This guide provides a brief overview of how to use the Integrail.ai Cloud SDK in your TypeScript/JavaScript applications.
Initializing IntegrailCloudApi
IntegrailCloudApi
Import the IntegrailCloudApi
class from the integrail-sdk-cloud
package and initialize it with your API token:
Replace "YOUR_API_TOKEN"
with your actual API token obtained from the Integrail.ai dashboard.
Using agent.execute
agent.execute
You can execute an agent in two ways: streaming or non-streaming.
Streaming Execution
In streaming execution, events are sent from the server and handled by the onEvent
callback. When the execution finishes, onFinish
is called.
Parameters:
agentId
: The ID of the agent you want to execute.accountId
: Your account ID.inputs
: An object containing input parameters for the agent.stream
: Set totrue
to enable streaming of execution events.
Callbacks:
onEvent(event, execution)
: Handles execution updates.onFinish(execution)
: Called when execution is finished.
Non-Streaming Execution
For non-streaming, background execution, omit the onEvent
and onFinish
callbacks. The method returns immediately with an execution ID.
Using agent.executeMultipart
agent.executeMultipart
The executeMultipart
method allows you to upload a file and use it as an agent input in the same request, eliminating the need to upload it separately.
Parameters:
inputs
: Agent input parameters.stream
: Set totrue
for streaming execution.File inputs: An object where keys are parameter names and values are
Blob
objects.
Note: This method simplifies the process of using files as inputs by combining upload and execution into one step.
Notes
Streaming vs. Non-Streaming Execution:
Streaming Execution: Use
stream: true
and provideonEvent
andonFinish
callbacks to receive real-time updates.Non-Streaming Execution: Omit
stream
,onEvent
, andonFinish
to execute in the background and receive an execution ID immediately.
We’d love to hear from you! Reach out to documentation@integrail.ai
Last updated