Skip to content

Agent processing

Running Agents

There are 2 ways to run an agent via Domino REST API:

POST: /run/agent

This is used to run an agent in real time. The payload expects at least agentName to define which agent to trigger. NOTE: the calling HTTP thread will be tied up until the agent finishes, so this should only be used for short-running agents. This is designed to simulate running an agent using the "?OpenAgent" URL endpoint. Any content from LotusScript print statements will be returned as the HTTP response or, if no print statements are used {"agentResponse":"done"}. In addition, NotesSession.documentContext will get an in-memory document with the following properties:

  • REQUEST_METHOD set to "KEEP". This can be used to identify how the agent was triggered, for contextual processing.
  • CONTENT_TYPE set to "application/json".
  • SERVER_NAME set to "".
  • HTTPS set to "ON".
  • SERVER_PORT set to "443".
  • QUERY_STRING set to "openagent"
  • REQUEST_CONTENT set to any additional content from the payload.

POST: /run/agentWithContext

Caution

Might not be supported on current version.

This is used to run an agent in real time, passing the unid of a document to use as context and the returnMode to use to generate the response for the agent. If returnMode was not specified or does not exist, the default {"agentResponse":"done"} response is returned.

Note

The calling HTTP thread will be tied up until the agent finishes, so this should only be used for short-running agents.

Triggers

Certain triggers like selected documents or programmatic collections like unprocessedDocuments only make sense in Notes Client. Other triggers like "Before Mail Arrives" only make sense in the context of server scheduling. LotusScript UI classes for interacting with the Notes Client will cause an agent to error if you attempt to run it from outside the context of the Notes Client.

For further clarification, a developer can use the /design/agents?dataSource= endpoint to get full information about properties of an agent. The @validForKeep property will confirm whether or not the agent can be used from Domino REST API. This does not (currently) introspect the LotusScript to check for NotesUI classes. It only uses the triggers to identify agents that cannot be called from outside the Notes Client.