Execution patterns for migrated agents

After migrating agents to the compute platform, you can trigger the Execute() method so they can begin working in the following ways:

  • Scheduled intervals - All migrated agents are executed on a regularly scheduled interval. This interval represents the time between the end of one execution and the start of the next execution. The interval is configured on the application.xml file for each agent type in an application. The default value is 60 minutes, which is also the minimum allowable value without a Workload Discovery endpoint. Agents with a Workload Discovery endpoint can have an interval of 1 minute. See Set the agent execution interval.
  • Note: You can't adjust the interval for an agent through the UI. You must be configured in the application.xml file. See Set the agent execution interval.

  • On-demand - Optionally, you can trigger an agent to execute on-demand through a call to the Agent Status Manager API. This process can reduce any delay caused by waiting for the next tick of the scheduled interval, particularly when responding to a user event such as a click. The Agent Status Manager API can be accessed through .NET or REST. See Agent Status Manager (.NET) and Agent Status Manager (REST).

Note: Agents running on the compute platform will experience an average start-up delay of 30 seconds regardless of how the agent is triggered to start processing. Workflows which require an immediate response should instead use the Kepler framework for synchronous processing instead of the agent framework designed for asynchronous background jobs. If you would like help converting your agent to Kepler, contact devex@relativity.com.

Regardless of how an agent is triggered for execution, scaling is respected for agents configured to scale. For configuration and other information, see Scaling guidelines for migrated agents and Agent migration checklist.

This page contains the following information:

The Relativity.HostingBridge.SDK contains this API. For compatibility and package installation instructions, see Download the SDKs and NuGet packages.

Set the agent execution interval

You can modify the application.xml file to set a value for the Agent execution interval. The interval is defined in seconds with the minimum interval defaulting to 60 seconds.

Use these steps to set the execution interval:

  1. Export the application. For more information, see Exporting applications on the RelativityOne Documentation site.
  2. Edit the application.xml file in the exported RAP for each AgentType. DefaultInterval in your application. The following example illustrates an interval set to 10 minutes on an agent with a Workload Discovery endpoint, that is 600 seconds. See Get started with scaling.
  3. Note: Agents without a Workload Discovery endpoint have a minimum interval of 60 minutes.

    <AgentTypes>
        <AgentType>
          <ArtifactId>1052585</ArtifactId>
          <Guid>00000000-0000-0000-0000-000000000000</Guid>
          <AgentTypeName>Agent Type Name</AgentTypeName>
          <FullNameSpace>Agents.AgentNamespace</FullNameSpace>
          <DefaultInterval>600</DefaultInterval>
          <DefaultLogging>1</DefaultLogging>
          <MinInstanceEnvironment>0</MinInstanceEnvironment>
          <MaxInstanceEnvironment>0</MaxInstanceEnvironment>
          <MinInstanceServer>0</MinInstanceServer>
          <MaxInstanceServer>0</MaxInstanceServer>
          <MinInstanceResourcePool>0</MinInstanceResourcePool>
          <MaxInstanceResourcePool>0</MaxInstanceResourcePool>
        </AgentType>
      </AgentTypes>

Agent Status Manager (.NET)

Use the StartAgentAsync() method to execute a migrated agent. Pass this method the GUID for the agent that you want to execute.

This method is available on the IAgentStatusManagerService interface in the RelativityHostingBridge.Interfaces.HostingBridgeManager.<VersionNumber>.AgentStatusManager namespace.

Note: The <VersionNumber> variable in the namespace indicates the version number of the API. The version number uses the format uppercase V and an integer version number, such as V1 or V2 in .NET.

using (var agentStatusManager = _serviceFactory.CreateProxy<IAgentStatusManagerService>())
{
    await agentStatusManager.StartAgentAsync(_AGENT_GUID);
}

Agent Status Manager (REST)

To execute a migrated agent, send a POST request with a URL in the following format:

<host>/Relativity.REST/api/relativity-hosting-bridge/{versionNumber}/agents/{Agent GUID}/agent-jobs

Set the path parameters as follows:

  • {versionNumber} to the version of the API, such as v1.
  • {Agent GUID} to the GUID for the agent that you want to execute.

The body of the request is empty.

When the agent is successfully executed, the response contains the status code of 200.