kaxil commented on code in PR #71461:
URL: https://github.com/apache/airflow/pull/71461#discussion_r3766850308
##########
providers/anthropic/src/airflow/providers/anthropic/hooks/anthropic.py:
##########
@@ -119,6 +120,22 @@ def is_terminal(cls, status: str) -> bool:
#: ``outcome_evaluations[].result`` values that mean the outcome did NOT
succeed.
OUTCOME_FAILURE_RESULTS = frozenset({"failed", "max_iterations_reached",
"interrupted"})
+#: ``session.status_idle`` stop reason emitted when a session stops against
its budget.
+BUDGET_REACHED = "budget_reached"
+
+
+def session_error(message: str, stop_reason: str | None) ->
AnthropicAgentSessionError:
Review Comment:
Applied, along with the five call sites and the test class
(`TestSessionError` -> `TestCreateSessionError`). The verb prefix is clearer --
the old name read as though it *was* an error rather than something that builds
one.
One note in case it changes your view: it is imported by
`operators/agent.py`, so the leading `_` marks it private to the provider
package rather than to the module. There is precedent for that in providers, so
I took your version as written -- happy to drop the `_` if you would rather it
sit alongside `validate_execute_complete_event` and `evaluate_session_state` in
the same file, which are public and cross-imported the same way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]