Skip to main content
Version: Current

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​

ParameterTypeRequired / defaultDescription
inputArgsDictionary<string, object>RequiredSpecify the Input arguments of the job.
processIdintRequiredSpecify the ProcessId to execute the job.
botIdint?Optional; nullSpecify the SmartBuddy Id to execute the job.
logLevelstringOptional; "Information"Specify the log level of the job.
timeOutTimeSpan?Optional; nullThe timeout information of a job.

Output​

PropertyDescription
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.