Job.ExecuteJobAsync
Description
The Smart Buddy executes an existing Job with provided job details from the connected AI Command Center and waits for the job to complete its execution.
warning
This API is deprecated. Use ExecuteJobV2Async instead.
Signature [C#]
Task<JobInfo> ExecuteJobAsync(Dictionary<string, object> inputArgs, int processId, int? botId = null, string logLevel = "Information", TimeSpan? timeOut = null);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
inputArgs | Dictionary<string, object> | Required | Specify the Input arguments of the job. |
processId | int | Required | Specify the ProcessId to execute the job. |
botId | int? | Optional; null | Specify the SmartBuddy Id to execute the job. |
logLevel | string | Optional; "Information" | Specify the log level of the job. |
timeOut | TimeSpan? | Optional; null | The timeout information of a job. |
Output
| Property | Description |
|---|---|
| Task<JobInfo> | Returns the job information of a current job. |
Remarks
Use ExecuteJobAsync API to execute the job from the connected AI Command Center.
Example
C#
public async Task ExecuteJob()
{
IControlRoomContext context = LoginControlRoom();
try
{
int processId = 1;
int botId = 1;
string logLevel = "Information";
TimeSpan? timeOut = null;
Dictionary<string, object> inputArgs = new Dictionary<string, object>();
// Add entries whose names and types match the process input arguments.
JobInfo jobInfo = await context.Jobs.ExecuteJobAsync(inputArgs, processId, botId, logLevel, timeOut);
Console.WriteLine("JobId: " + jobInfo.JobId + ", Output: " + jobInfo.Output);
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}
See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.