AI Task
The AI task sends one prompt to a language model, without tools, from a BPMN service task — for example to classify a customer’s message or to extract data from a document’s text. It runs as an external task worker next to the engine, in the connectors bundle image or in your own Spring Boot application, so the model call happens outside the engine transaction, with the external task’s retries, locks and incidents.
Unlike the AI agent, the task drives no ad-hoc sub-process, offers the model no tools and keeps no conversation: every execution starts from its prompts.
Configure a Task
The element is an external service task (or send task) with the topic org.eximeebpms.agenticai:aiagent:1. The element template AI Task (below) sets this up and offers a form for every input. Without a template:
<bpmn:serviceTask id="classify" name="Classify message"
camunda:type="external" camunda:topic="org.eximeebpms.agenticai:aiagent:1">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="provider.ref">default</camunda:inputParameter>
<camunda:inputParameter name="systemPrompt">Classify the customer's message as billing or delivery.</camunda:inputParameter>
<camunda:inputParameter name="userPrompt">${customerMessage}</camunda:inputParameter>
<camunda:inputParameter name="response.format">json</camunda:inputParameter>
<camunda:inputParameter name="response.schema">{"type": "object", "properties": {"category": {"enum": ["billing", "delivery"]}}, "required": ["category"]}</camunda:inputParameter>
<camunda:outputParameter name="classification">${execution.getVariableLocalTyped('agent')}</camunda:outputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
</bpmn:serviceTask>
An input parameter whose name contains dots sets a field of a nested input: response.format sets format inside response. A blank input counts as not set, so an empty template field keeps the default.
Inputs
| Input | Description | Default |
|---|---|---|
provider | The model provider: provider.ref names a provider of the worker's configuration (eximeebpms.connectors.aiagent.providers.<name>), the recommended way; or the provider is set on the element with provider.type (openai or anthropic), provider.model, provider.apiKey as a secret placeholder such as {{secrets.OPENAI_API_KEY}}, and optionally provider.endpoint (https only), provider.api, provider.temperature, provider.maxTokens, provider.timeout and provider.options. The same providers as the AI agent's. Required. | |
systemPrompt | The instructions, e.g. the categories to choose from. Expressions such as ${...} are allowed. | none |
userPrompt | The text to work on, e.g. ${customerMessage}. Required. | |
response.format | text or json. | text |
response.schema | For json: the JSON Schema the answer must match, as a JSON object. | none |
response.includeAssistantMessage | Adds the model's message to the result as responseMessage. | false |
limits.maxModelCalls | Model calls one execution may make: the first, and one per correction of an empty answer or one that is not the JSON asked for. | The worker's default-task-max-model-calls, 3 |
audit.contentLevel | metadata keeps the prompts and the answer out of this task's audit even when the worker records content; it cannot raise the worker's level. | as configured |
retries | Executions before an incident. | 3 |
retryBackoff | ISO-8601 duration between attempts. | PT30S |
Secret placeholders are resolved only in provider.apiKey. In the prompts a placeholder stays text: it is never replaced by a secret and sent to the model.
Result
The task completes with the local variable agent:
{ "responseJson": { "category": "delivery" } }
With response.format = text it holds responseText instead, the model’s answer as text; with response.includeAssistantMessage also responseMessage.
Map it out with ${execution.getVariableLocalTyped('agent')}, as the element template does. The result is stored as JSON this way, readable by clients in any language; a plain ${agent} would be stored as a serialized Java object. The expression reads only the task’s own agent: ${agent} or getVariableTyped would also find a variable agent of the process, e.g. the result of another AI task mapped out under the default name.
To map a single field, check first that the task has set agent:
<camunda:outputParameter name="category">${execution.hasVariableLocal('agent') ? agent.responseJson.category : null}</camunda:outputParameter>
This gives null when there is no answer, and also when the answer has no such field, e.g. with response.format = text.
JSON Answers
With response.format = json the answer must be JSON; a JSON value inside a Markdown code block is accepted too, and text after the block is ignored. Text after JSON outside a code block, or a second JSON value, makes the answer not JSON. Without response.schema the answer must not be null, as the process could not tell it from no answer; with response.schema it must match the schema. The schema is passed to the OpenAI Responses API natively; for the other providers it is added to the system prompt.
An answer that is not JSON, or does not match the schema, is sent back to the model with the problem, and the model answers again within the same execution. With response.format = text the same happens to an empty answer. When limits.maxModelCalls is reached without a usable answer, the task raises an incident. Raise the limit and retry the incident to continue.
Errors and Retries
- A rate limit, a server error of the provider, a timeout or a connection failure fails the task. It is retried with
retriesandretryBackoff, then raises an incident. - Invalid inputs, rejected credentials, a refusal or filtered content, an answer cut off at the provider’s token limit (raise
provider.maxTokens), prompts too long for the model, a denied destination and themaxModelCallslimit raise an incident at once, without retries.
Incident messages never contain the prompts or the answer.
Audit and Metrics
The task uses the AI agent’s audit and model metrics: with the audit enabled, every execution is recorded like a turn of an agent, with its model calls and token counts; an answered task ends with the status COMPLETED. See Observability and Model Usage. The task’s token usage is not reported to the engine’s history, which records it only for the turns of an AI agent.
Element Template
The artifact org.eximeebpms.connectors:eximeebpms-connectors-element-templates contains the template AI Task (org.eximeebpms.connectors.AiTask) for Camunda Modeler in Camunda 7 mode, in its element-templates/ folder. Copy it into the Modeler’s element templates directory. It applies to service and send tasks, offers a form for every input, and maps the result to a process variable of your choice (default agent).
The Camunda 7 template format has no conditional fields: all provider fields are shown; with a provider reference leave the others empty.
Worker Configuration
The task runs wherever the AI agent runs and shares its configuration under eximeebpms.connectors.aiagent:
eximeebpms:
connectors:
aiagent:
providers:
default:
type: openai # or anthropic
model: <model name>
# api-key: keep it out of this file, set EXIMEEBPMS_CONNECTORS_AIAGENT_PROVIDERS_DEFAULT_APIKEY
default-task-max-model-calls: 3
default-task-max-model-calls is the limit for tasks that set no limits.maxModelCalls; it must be at least 1, or the worker does not start. The element template leaves the field empty, so this default applies. Provider endpoints are reached as the REST connector’s destinations are: through its network policy, proxy and trust settings (see REST Connector), so a model server on an internal address needs an allow entry.
