Skip to main content
Version: Current

ProcessInstances.UpdateAgentDataAsync

Description​

Updates the agent data for a specified process instance in the connected AI Command Center.

This API allows runtime modification of agent variables for an active process instance. Agent Data is shared across all workflows within the same process instance.


Signature [C#]​

Task UpdateAgentDataAsync(AgentData agentData);

Parameters​

Input​

PropertyDescription
agentDataContains the Process Instance ID and the agent variables to update.

Remarks​

  • ProcessInstanceId identifies the process instance.
  • Data contains field keys and values to submit. Values must match the types defined in the agent.
  • The operation executes asynchronously.
  • Use the API to update values while the agent is running. Runtime updates do not change the agent's field definitions.

Use this API to update runtime agent data for a process instance programmatically.


Example​

This example assumes a text Field named CustomerName has been created under Agent Data. Its designer reference is agentData.CustomerName; the Data dictionary uses the field key CustomerName.

C#
public async Task UpdateAgentData()
{
IControlRoomContext context = LoginControlRoom();
try
{
Dictionary<string, object> data = new Dictionary<string, object>()
{
{
"CustomerName",
"Acme Corp"
}
};
AgentData agentData = new AgentData()
{
ProcessInstanceId = "e42a93f5d53245d788909fd655b41cfe",
Data = data
};
await context.ProcessInstances.UpdateAgentDataAsync(agentData);
System.Console.WriteLine("Process instance agent data has been updated successfully.");
}
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.