Lee-W commented on code in PR #71464:
URL: https://github.com/apache/airflow/pull/71464#discussion_r3764655002


##########
providers/anthropic/docs/operators/anthropic.rst:
##########
@@ -282,6 +282,60 @@ task's real outcome is preserved and a warning is logged.
     session records instead. This is the same scenario as the retry warning 
above, so
     ``retries=0`` keeps both problems away.
 
+Configuring the agent
+"""""""""""""""""""""
+
+Agent-level settings are not operator arguments: they belong to the agent, 
which is created
+once and referenced by ID on every run.
+:meth:`~airflow.providers.anthropic.hooks.anthropic.AnthropicHook.create_agent`
 forwards
+keyword arguments to the API unchanged, so these need no provider support.
+
+**Pinning the inference region.** Pass ``model`` as a config object instead of 
a bare id to
+confine inference to one region:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="us-only-analyst",
+        model={"id": "claude-opus-4-8", "inference_geo": "us"},
+    )
+
+The accepted values are ``"us"`` and ``"global"``; anything else is rejected 
with
+``400 inference_geo: must be one of ["global" "us"]``. When ``inference_geo`` 
is unset,
+requests fall through to the workspace's ``default_inference_geo``. On an 
update, ``model``
+is whole-object replacement, so omitting ``inference_geo`` clears it rather 
than preserving
+it.
+
+In a ``multiagent`` configuration the coordinator's pin and every roster 
member's must all
+be set to the same value, or all be unset -- a mismatch is rejected. Following 
both this and
+the roster example below on one agent is the easy way to trip that.
+
+**Adding an advisor.** A coordinator agent can consult a second model mid-turn 
by adding an
+``advisor`` entry to its ``multiagent`` roster:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="coordinator",
+        model="claude-opus-4-8",

Review Comment:
   ```suggestion
           model="claude-opus-5",
   ```



##########
providers/anthropic/docs/operators/anthropic.rst:
##########
@@ -282,6 +282,60 @@ task's real outcome is preserved and a warning is logged.
     session records instead. This is the same scenario as the retry warning 
above, so
     ``retries=0`` keeps both problems away.
 
+Configuring the agent
+"""""""""""""""""""""
+
+Agent-level settings are not operator arguments: they belong to the agent, 
which is created
+once and referenced by ID on every run.
+:meth:`~airflow.providers.anthropic.hooks.anthropic.AnthropicHook.create_agent`
 forwards
+keyword arguments to the API unchanged, so these need no provider support.
+
+**Pinning the inference region.** Pass ``model`` as a config object instead of 
a bare id to
+confine inference to one region:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="us-only-analyst",
+        model={"id": "claude-opus-4-8", "inference_geo": "us"},
+    )
+
+The accepted values are ``"us"`` and ``"global"``; anything else is rejected 
with
+``400 inference_geo: must be one of ["global" "us"]``. When ``inference_geo`` 
is unset,

Review Comment:
   I thought we're doing additional logic check here. But looks like the worst 
case is doc drift. or should we reference to the doc that list down what's 
supported?



##########
providers/anthropic/src/airflow/providers/anthropic/hooks/anthropic.py:
##########
@@ -575,16 +576,21 @@ def wait_for_batch(
     # (these helpers, the ``ant`` CLI, or a setup script) and store the IDs. 
The
     # operator references those IDs; it never creates an agent per run.
 
-    def create_agent(self, name: str, model: str | None = None, **kwargs: Any) 
-> BetaManagedAgentsAgent:
+    def create_agent(
+        self, name: str, model: str | dict[str, Any] | None = None, **kwargs: 
Any
+    ) -> BetaManagedAgentsAgent:
         """
         Create a (reusable, versioned) Managed Agents agent. One-time setup.
 
         ``model`` defaults to :attr:`default_model` (the connection's 
``extra['model']``
-        or :data:`DEFAULT_MODEL`).
+        or :data:`DEFAULT_MODEL`). Pass a mapping instead of a bare id to set 
the model
+        config, e.g. ``{"id": "claude-opus-4-8", "inference_geo": "us"}``.

Review Comment:
   ```suggestion
           config, e.g. ``{"id": "claude-opus-5", "inference_geo": "us"}``.
   ```



##########
providers/anthropic/docs/operators/anthropic.rst:
##########
@@ -282,6 +282,60 @@ task's real outcome is preserved and a warning is logged.
     session records instead. This is the same scenario as the retry warning 
above, so
     ``retries=0`` keeps both problems away.
 
+Configuring the agent
+"""""""""""""""""""""
+
+Agent-level settings are not operator arguments: they belong to the agent, 
which is created
+once and referenced by ID on every run.
+:meth:`~airflow.providers.anthropic.hooks.anthropic.AnthropicHook.create_agent`
 forwards
+keyword arguments to the API unchanged, so these need no provider support.
+
+**Pinning the inference region.** Pass ``model`` as a config object instead of 
a bare id to
+confine inference to one region:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="us-only-analyst",
+        model={"id": "claude-opus-4-8", "inference_geo": "us"},
+    )
+
+The accepted values are ``"us"`` and ``"global"``; anything else is rejected 
with
+``400 inference_geo: must be one of ["global" "us"]``. When ``inference_geo`` 
is unset,

Review Comment:
   if we're doing this, does that mean we'll manually update the list when the 
upstream/sdk add more support?



##########
providers/anthropic/docs/operators/anthropic.rst:
##########
@@ -282,6 +282,60 @@ task's real outcome is preserved and a warning is logged.
     session records instead. This is the same scenario as the retry warning 
above, so
     ``retries=0`` keeps both problems away.
 
+Configuring the agent
+"""""""""""""""""""""
+
+Agent-level settings are not operator arguments: they belong to the agent, 
which is created
+once and referenced by ID on every run.
+:meth:`~airflow.providers.anthropic.hooks.anthropic.AnthropicHook.create_agent`
 forwards
+keyword arguments to the API unchanged, so these need no provider support.
+
+**Pinning the inference region.** Pass ``model`` as a config object instead of 
a bare id to
+confine inference to one region:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="us-only-analyst",
+        model={"id": "claude-opus-4-8", "inference_geo": "us"},
+    )
+
+The accepted values are ``"us"`` and ``"global"``; anything else is rejected 
with
+``400 inference_geo: must be one of ["global" "us"]``. When ``inference_geo`` 
is unset,

Review Comment:
   ```suggestion
   ``400 inference_geo: must be one of ["global", "us"]``. When 
``inference_geo`` is unset,
   ```



##########
providers/anthropic/docs/operators/anthropic.rst:
##########
@@ -282,6 +282,60 @@ task's real outcome is preserved and a warning is logged.
     session records instead. This is the same scenario as the retry warning 
above, so
     ``retries=0`` keeps both problems away.
 
+Configuring the agent
+"""""""""""""""""""""
+
+Agent-level settings are not operator arguments: they belong to the agent, 
which is created
+once and referenced by ID on every run.
+:meth:`~airflow.providers.anthropic.hooks.anthropic.AnthropicHook.create_agent`
 forwards
+keyword arguments to the API unchanged, so these need no provider support.
+
+**Pinning the inference region.** Pass ``model`` as a config object instead of 
a bare id to
+confine inference to one region:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="us-only-analyst",
+        model={"id": "claude-opus-4-8", "inference_geo": "us"},
+    )
+
+The accepted values are ``"us"`` and ``"global"``; anything else is rejected 
with
+``400 inference_geo: must be one of ["global" "us"]``. When ``inference_geo`` 
is unset,
+requests fall through to the workspace's ``default_inference_geo``. On an 
update, ``model``
+is whole-object replacement, so omitting ``inference_geo`` clears it rather 
than preserving
+it.
+
+In a ``multiagent`` configuration the coordinator's pin and every roster 
member's must all
+be set to the same value, or all be unset -- a mismatch is rejected. Following 
both this and
+the roster example below on one agent is the easy way to trip that.
+
+**Adding an advisor.** A coordinator agent can consult a second model mid-turn 
by adding an
+``advisor`` entry to its ``multiagent`` roster:
+
+.. code-block:: python
+
+    hook.create_agent(
+        name="coordinator",
+        model="claude-opus-4-8",
+        multiagent={
+            "type": "coordinator",
+            "agents": [
+                worker_agent_id,
+                {"type": "advisor", "model": "claude-opus-4-8"},

Review Comment:
   ```suggestion
                   {"type": "advisor", "model": "claude-opus-5"},
   ```
   
   let's use the latest



-- 
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]

Reply via email to