enterprise_ai.runtime.continuation
Source: sdks/python/src/enterprise_ai/runtime/continuation.py. Back to the Python SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Model TurnContext
What the rules look at. Filled by :class:~enterprise_ai.runtime.runner.AgentRunner.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
final_text | str | no | Text of the last answer of the model. |
finish_reason | str | None | no | finish_reason of the last answer, such as stop or length. |
user_text | str | no | Text of the last user message. |
tools_available | bool | no | The model was offered at least one tool. |
tool_calls_total | int | no | Tool calls made in the turn so far. |
tool_calls_since_user | int | no | Tool calls made since the last user message. |
mutated | bool | no | A tool that is neither a check nor read only ran while a verification tool is available. |
verified_after_mutation | bool | no | A verification tool succeeded after the last change (default True). |
verify_failed | bool | no | The last verification tool call failed. |
no_progress_rounds | int | no | Number of consecutive tool rounds repeating the same calls. |
read_only_rounds | int | no | Number of consecutive tool rounds that only called read only tools. |
budget_low | bool | no | True when at most 2 steps remain in the step budget. |
require_delivery | bool | no | The turn must use at least one tool before answering (delivery rule). |
audit_mode | bool | no | Audit turn: the exploration rule waits 8 read only rounds instead of 4. |
nudges | dict[str, int] | no | Number of times each rule fired in the turn, by rule code. |
Model ContinuationRule
One continuation rule: code, stage, cap max_nudges and its prompt.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
code | str | yes | Code of the control, 1 to 64 characters: a catalogue code such as EAI-GOV-01, or a custom one. Unique in the tenant. |
max_nudges | int | yes | Maximum number of times the rule may fire in one turn. |
predicate | Callable[[TurnContext], bool] | yes | Function (TurnContext) -> bool that tells whether the turn must go on. |
prompt | str | yes | Message appended as a user message when the rule fires. |
stage | str | no | When the rule is evaluated: final (answer without tool calls, default) or round (after each tool round). |
ContinuationRule.applies
applies(ctx: TurnContext) -> bool
True when the predicate holds and the cap is not reached.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
ctx | TurnContext | yes | Context of the call: cancellation and deadline. |
Returns: bool. True when the rule fired fewer than max_nudges times in the turn and its predicate holds on the context.
Functions
is_go_ahead
is_go_ahead(text: str | None) -> bool
True for a short approval such as ok, go ahead, vas-y or continue.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | None | yes | User message; None or empty gives False. |
Returns: bool. True when the whole text, 40 characters at most, is an English or French approval.
lists_remaining_work
lists_remaining_work(text: str | None) -> bool
True when an answer lists work still to do (English and French phrases).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | None | yes | Answer of the model; None or empty gives False. |
Returns: bool. True when the text contains a phrase such as next steps, remaining work, il reste or reste à faire.
announces_action
announces_action(text: str | None) -> bool
True when an answer announces an action (I will, je vais).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
text | str | None | yes | Answer of the model; None or empty gives False. |
Returns: bool. True when the text contains an English or French announcement such as I will, let me or je vais.
default_rules
default_rules() -> list[ContinuationRule]
The Navin rules in evaluation order.
This element takes no parameter.
Returns: list[ContinuationRule]. A ContinuationRule: One continuation rule: code, stage, cap max_nudges and its prompt.
first_applicable
first_applicable(rules: list[ContinuationRule], ctx: TurnContext, stage: str) -> ContinuationRule | None
First rule of stage that applies, or None.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
rules | list[ContinuationRule] | yes | Rules in evaluation order. | |
ctx | TurnContext | yes | Context of the call: cancellation and deadline. | |
stage | str | yes | Stage to evaluate: final or round. |
Returns: ContinuationRule \| None. A ContinuationRule: One continuation rule: code, stage, cap max_nudges and its prompt.