id
stringlengths
15
25
source
stringclasses
1 value
chunk_index
int64
0
393k
token_count
int32
449
512
content
stringlengths
203
7.95k
combine_chunk_600
combine.txt
600
512
`` set to ``1``. A toolset meant for other frameworks should read nothing else from ``ctx``. <|file|>airflow/providers/common/ai/docs/toolsets/datafusion.rst .. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work fo...
combine_chunk_601
combine.txt
601
512
.providers.common.ai.toolsets.datafusion import DataFusionToolset from airflow.providers.common.sql.config import DataSourceConfig toolset = DataFusionToolset( datasource_configs=[ DataSourceConfig( conn_id="aws_default", table_name="sales", u...
combine_chunk_602
combine.txt
602
512
Intersect, Except. Only read-only SELECT-family queries are allowed unless allow_writes is enabled; check the SQL syntax and statement type, then try again.`` The second query shows that a URL in the SQL is looked up as a table name, not read as a file. A query over the registered tables runs: .. code-blo...
combine_chunk_603
combine.txt
603
512
names are rejected. - ``max_retries``: How many times the model may correct a failed call to these tools. Default ``None``, the agent's ``retries``. See :ref:`toolset-retry-budget`. When to choose it ----------------- **Choose it when** the data is files on an object store rather than rows in a database (Parquet, ...
combine_chunk_604
combine.txt
604
512
as a table and lets the agent write SQL. Which of the two fits depends on the question. "Read me this object" is a hook method. "What were last quarter's returns by region" is a query, and expressing it through ``list_keys`` and ``read_key`` means the model does the aggregation in its context window instead of the en...
combine_chunk_605
combine.txt
605
512
governing permissions and limitations under the License. SQL databases: ``SQLToolset`` ============================= Curated toolset wrapping :class:`~airflow.providers.common.sql.hooks.sql.DbApiHook` with four tools: .. list-table:: :header-rows: 1 :widths: 20 50 * - Tool - Description * - ``...
combine_chunk_606
combine.txt
606
512
, so its target must be on the list, while ``SHOW`` enumerates objects beyond any single table and is rejected outright (see :ref:`allowed-tables-enforcement`). The read-only check inspects statement types, not what a function does. By default (no ``allowed_tables``) a function call inside a ``SELECT`` is not examined...
combine_chunk_607
combine.txt
607
512
.`` ``SELECT pg_read_file('/etc/passwd')`` ``The query tool failed: Query uses a data source that cannot be checked against allowed_tables: function(s) the parser cannot verify against allowed_tables (pg_read_file); if these functions are trusted, permit them via allowed_functions. Query the allowed ta...
combine_chunk_608
combine.txt
608
512
The task's own ``retries`` then decide whether it runs again, and the budgets differ there too. ``max_retries`` starts again on each attempt. On Airflow 3.3 and later, ``usage_limits`` counts across every attempt, so a retry after ``tool_calls_limit`` ran out fails at its first tool call; see :ref:`the usage budget <...
combine_chunk_609
combine.txt
609
512
IDs ------------------------ ``db_conn_id`` is a Jinja template, rendered for each task instance just before it runs, so one toolset definition can reach a different database depending on where and for what the task runs: - **Per environment.** The same Dag reads the staging warehouse in staging and the production...
combine_chunk_610
combine.txt
610
512
.ai.toolsets.sql import SQLToolset from airflow.sdk import dag, task @dag def customer_reports(): @task def customers() -> list[str]: return ["acme", "globex"] @task.agent( llm_conn_id="pydanticai_default", toolsets=[SQLToolset(db_conn_id="analy...
combine_chunk_611
combine.txt
611
512
. When set, the list is enforced on ``query`` and ``check_query`` as well as discovery -- every table a query references must be on it. See :ref:`allowed-tables-enforcement` for what this does and does not guarantee. - ``allowed_functions``: Names of functions that sqlglot does not recognize as builtins but are...
combine_chunk_612
combine.txt
612
512
. Default 64 KiB. See :ref:`bounded-query-results` and :ref:`bounded-schema-results`. - ``max_columns``: Maximum columns ``get_schema`` returns in full. Default ``100``. Above it the result becomes a bounded summary. See :ref:`bounded-schema-results`. - ``tool_prefix``: Optional prefix joined to each tool name with...
combine_chunk_613
combine.txt
613
512
is bounded but the transfer is not. ``DataFusionToolset`` pushes the bound into the query instead: it runs the statement with a DataFusion ``LIMIT`` of ``max_rows + 1``, so the engine never materializes more than that and the extra row only signals truncation. **A byte budget bounds the payload.** ``max_rows`` caps r...
combine_chunk_614
combine.txt
614
512
on a very wide table the agent asks for the columns relevant to its question rather than all of them. **A summary replaces a very wide list.** Above ``max_columns`` (default ``100``), or when the serialized columns exceed ``max_result_bytes``, the full list is replaced by a summary that reports the shape and points a...
combine_chunk_615
combine.txt
615
512
-in, not the default. The table walk returns immediately while ``allowed_tables`` is unset, so out of the box the agent reaches every table the connection can see. Only omitting the argument grants that: an explicit ``None`` or empty list is rejected at construction. ``DESCRIBE`` and ``SHOW`` both pass, on dial...
combine_chunk_616
combine.txt
616
512
connected, an error from the statement becomes a ``ModelRetry`` so the model can correct it, bounded by the retry budget (:ref:`toolset-retry-budget`). A connection that drops while a ``query`` runs falls in this second group, since the driver reports it like any other statement error; the model usually runs t...
combine_chunk_617
combine.txt
617
512
" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. .. _agent-skills: Agent Skills: ``AgentSkillsToolset`` ==================================== .. note:: Experimental: th...
combine_chunk_618
combine.txt
618
512
howto_operator_agent_skills_git] :end-before: [END howto_operator_agent_skills_git] For a private repository, point ``conn_id`` at a :doc:`git connection <apache-airflow-providers-git:connections/git>`; credentials are resolved through the Git provider's ``GitHook`` (an HTTPS token in the connection password, or ...
combine_chunk_619
combine.txt
619
512
`` listed only ``reference.md`` as a resource, and reading an excluded file got: .. code-block:: text Resource 'warehouse.env' not found in skill 'sql-reporting'. Available resources: ['reference.md']. Use the exact name from load_skill output. Without ``max_retries``, each skills tool allows as many corrections...
combine_chunk_620
combine.txt
620
512
, since ``run_skill_script`` returns its output. A ``message_history`` seeded from another task does not add that task's calls, and calls that a history processor or compaction removes from the transcript are not counted. ``calls`` totals ``calls_by_run``, which keeps the calls of each agent run that made any under its...
combine_chunk_621
combine.txt
621
512
Using Agent Skills with other frameworks ---------------------------------------- ``AgentSkillsToolset`` is a standard pydantic-ai toolset, so it also works with a plain ``pydantic_ai.Agent`` you build yourself, not just ``AgentOperator``. Because Agent Skills is a cross-framework format, the connection handling is a...
combine_chunk_622
combine.txt
622
512
scripts run in the worker process with the worker's reach. If that is not acceptable, exclude the tool or put the work behind ``SandboxToolset`` instead. - It re-fetches a Git source on every run. ``GitSkills`` is resolved and shallow-cloned on the worker when the run starts, and the checkout is deleted when i...
combine_chunk_623
combine.txt
623
512
provider. See :ref:`howto/stability`. Cloud vendors now run agents on your behalf: Snowflake Cortex Agents, Amazon Bedrock AgentCore runtimes, Azure AI Foundry hosted agents, Vertex AI Agent Engine. Their reasoning loops execute on the vendor's infrastructure, so they are not something ``AgentOperator`` runs; the...
combine_chunk_624
combine.txt
624
512
: it is what the model emits when it calls the tool, and the Dag author chooses it. ``description`` is optional and falls back to the tool name rendered as prose, the same way ``HookToolset`` derives one from a method name when there is no docstring. .. note:: Writing a description is still worth the line. It is ...
combine_chunk_625
combine.txt
625
512
by ``max_retries`` (one rephrase by default; ``0`` makes it fatal). * - :class:`~airflow.providers.common.ai.exceptions.ManagedAgentInvocationError` - Terminal: bad credentials, missing agent, malformed request, exhausted quota. - No rephrase; a failover group moves to its next member. Airflow's own ta...
combine_chunk_626
combine.txt
626
512
the external job ID to the task state store before polling, so a worker crash reconnects to the running job instead of submitting a duplicate. A toolset cannot offer that, because the retry boundary is the task, not the tool call. Set ``timeout`` on the toolset so a call that stops being waited for is bounded: a threa...
combine_chunk_627
combine.txt
627
512
a conversation belongs to one member, addressed directly. The three error buckets do real work here: - :class:`~airflow.providers.common.ai.exceptions.ManagedAgentInvocationError` and transient failures move to the next member. - :class:`~airflow.providers.common.ai.exceptions.ManagedAgentRejected` is re-raised i...
combine_chunk_628
combine.txt
628
512
, where each failover warning names the members involved and their positions, but not in XCom. Both counters are tagged by platform rather than agent name to keep cardinality bounded. ``platform`` can also show up as the literal string ``"unknown"``: when an agent's identity fails to resolve -- a connection lookup fai...
combine_chunk_629
combine.txt
629
512
belongs on the vendor's infrastructure: the agent is already deployed there, grounded in data that never leaves, and Airflow's job is to submit one request and read one answer. **What it cannot do** - It has no allow-list to offer. The whole toolset is one tool: a prompt goes in, an answer comes out. Whatever gove...
combine_chunk_630
combine.txt
630
512
required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License....
combine_chunk_631
combine.txt
631
512
such as summing a column, use :doc:`datafusion`. Text compressed as ``.gz``, ``.bz2`` or ``.xz`` is decompressed first. Every path the model supplies is relative to the root. An absolute path, a path with a scheme such as ``s3://``, and a path that climbs out with ``..`` are refused, and on a local root a symboli...
combine_chunk_632
combine.txt
632
512
1.0MB this tool reads.`` Because refused reads cost nothing from ``max_retries``, bound a run that keeps asking with the operator's ``usage_limits``. The path check is the toolset's only boundary on location; credentials that can read only ``s3://acme-reports/finance/`` keep that limit if the check has a gap. Paramet...
combine_chunk_633
combine.txt
633
512
model under one root. **What it cannot do** - It cannot write, delete, move or copy anything. - It does not search inside files. The model finds a file by listing directories, so a store with thousands of files per directory is slow to explore. Give it a narrower root. - It reads one file at a time. To ask a quest...
combine_chunk_634
combine.txt
634
512
.http import HttpHook from airflow.providers.common.ai.toolsets.hook import HookToolset http_hook = HttpHook(http_conn_id="my_api") toolset = HookToolset( http_hook, allowed_methods=["run"], tool_prefix="http", ) For each listed method, the introspection engine: 1. Builds a J...
combine_chunk_635
combine.txt
635
512
--------------------------------------- Exposing a method lets the model pick every argument it takes. When some of them are the Dag author's decision, such as which bucket a storage hook reads, pin them: .. code-block:: python from airflow.providers.amazon.aws.hooks.s3 import S3Hook from airflow.providers...
combine_chunk_636
combine.txt
636
512
_toolset_hook_restricted] The model is offered two tools: ``s3_read_key``, which takes only ``key``, and ``s3_list_keys``, whose parameters include ``prefix`` but not ``bucket_name``. Run against an S3 endpoint that also holds an ``acme-payroll`` bucket, a call that names that bucket was refused before it reached S3, ...
combine_chunk_637
combine.txt
637
512
hook-toolset-binary-data: Binary data ----------- JSON has no binary type, so ``bytes`` travels between the model and the hook as base64. A parameter typed ``bytes`` or ``bytes | None``, such as ``bytes_data`` of ``S3Hook.load_bytes``, is offered to the model as a string whose description asks for base64, and the val...
combine_chunk_638
combine.txt
638
512
it when** the target already has an Airflow connection and a hook, and what you want the agent to do is already a method on that hook. This is the cheapest route (no new server, no new credential, no new query dialect) and the only one that reaches any provider hook with synchronous methods without anyone writing an a...
combine_chunk_639
combine.txt
639
512
.** The read-only S3 pair from the ``HookToolset`` guidance in :doc:`../agent_security`: .. code-block:: python HookToolset( s3_hook, allowed_methods=["list_keys", "read_key"], tool_prefix="s3", ) **Credentials and where it runs.** The hook instance is yours, so the credential is what...
combine_chunk_640
combine.txt
640
512
---------- - ``mcp_conn_id``: Airflow connection ID for the MCP server. Templated when the toolset is passed to ``AgentOperator`` / ``@task.agent``, like ``SQLToolset.db_conn_id`` (see :ref:`sql-toolset-templated-connection`). Build it from values the Dag controls, never from ``params`` or ``dag_run.conf``: a ``...
combine_chunk_641
combine.txt
641
512
password``. The same applies to OAuth / refresh tokens, Workload Identity Federation, and GitHub App installation tokens. For these, pass a ``token_provider`` callable to ``MCPHook`` or ``MCPToolset`` instead of a static token. It is called once, the first time a given hook or toolset instance establishes a connection...
combine_chunk_642
combine.txt
642
512
connection or any other. ``env_provider`` is called once, the first time a given hook or toolset instance establishes a connection (the result is then cached for that instance's lifetime). Its return value is merged over ``Extra.env`` (``env_provider`` keys win on conflicts), and -- as a secondary benefit -- every va...
combine_chunk_643
combine.txt
643
512
model is offered the first two. If it calls ``delete_alert`` anyway, the call never reaches the server, and the model gets this back instead of a result: .. code-block:: text Unknown tool name: 'delete_alert'. Available tools: 'get_alerts', 'get_forecast' Fix the errors and try again. With ``tool_prefix`` s...
combine_chunk_644
combine.txt
644
512
Toolset` forwards ``get_tools`` and ``call_tool`` straight to the underlying server, so whatever the server exposes, the agent gets by default. Because ``MCPToolset`` is itself built on the same ``AbstractToolset`` base every toolset in this provider extends, a Dag author can call ``.filtered()`` to subset th...
combine_chunk_645
combine.txt
645
512
provider. If one exists for your target, it is a third route alongside the hook and DataFusion routes (:doc:`hook`, :doc:`datafusion`), and the two questions in :ref:`Choosing a toolset <howto/toolsets>` settle it. Its tool list is the server's rather than yours, and its token comes from wherever ``mcp_conn_id`` or yo...
combine_chunk_646
combine.txt
646
512
Toolset AgentOperator( task_id="agent_with_langchain_tools", prompt="Research the question and summarise.", llm_conn_id="pydanticai_default", toolsets=[LangChainToolset([my_langchain_tool])], ) **common.ai toolsets → LangChain.** The reverse direction is what :func:`~airflow.pr...
combine_chunk_647
combine.txt
647
512
path every call runs on its own event loop, and even on the async path each call through ``MCPToolset`` opens and closes a session of its own. That is fine for stateless tools but unsuitable for ``stdio`` MCP servers, or any server that keeps state between calls, since each call starts a fresh session. A ``SandboxToo...
combine_chunk_648
combine.txt
648
512
Com under the key ``message_history``. The next run reads it back to resume the conversation. ``None`` (the default) keeps the single-turn behavior unchanged. To record the transcript of a single-turn run, set ``emit_message_history=True``. The operator starts the run with no prior turns and pushes ``result.all_messag...
combine_chunk_649
combine.txt
649
512
ai ``Agent``, so the ``ProcessHistory`` capability from pydantic-ai's documentation works on ``AgentOperator`` as is: .. code-block:: python from pydantic_ai.capabilities import ProcessHistory from pydantic_ai.messages import ModelMessage, ModelRequest, RetryPromptPart, ToolReturnPart def keep_recent(me...
combine_chunk_650
combine.txt
650
512
andbox/index.rst .. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the ...
combine_chunk_651
combine.txt
651
512
included, has to run off a shared worker.** Use ``KubernetesExecutor``, with a pod override for one team's tasks. It isolates the task from your platform, not the task from the code its model writes, so the two combine (:ref:`sandbox-boundaries`). - **You are launching a payload whose image and command are known...
combine_chunk_652
combine.txt
652
512
on the backend: a ``modal`` connection (``modal_conn_id``; see the :ref:`Modal connection page <howto/connection:modal>`) for Modal; ``boat_conn_id``, or ``BOAT_API_KEY`` and optional ``BOAT_BASE_URL``, for Boat; ``ISLO_API_KEY`` (and optional ``ISLO_BASE_URL`` and ``ISLO_COMPUTE_URL``) for Islo; ``opensandbox_conn_id...
combine_chunk_653
combine.txt
653
512
names are the ones pydantic-ai's `Shell <https://pydantic.dev/docs/ai/harness/shell/>`__ and `FileSystem <https://pydantic.dev/docs/ai/harness/filesystem/>`__ capabilities use. **Whether this grants something new depends on what the agent already had.** An agent with a skill script or a shell tool already ran generat...
combine_chunk_654
combine.txt
654
512
-> query -> query -> write_file -> run_command -> query -> query -> query -> query -> run_command -> run_command -> run_command -> run_command -> run_command -> run_command -> run_command -> write_file -> run_command -> final_result The ``Findings`` the task returned to XCom, with ``summary`` and ``suspected_cause`` ...
combine_chunk_655
combine.txt
655
512
block egress per sandbox. Leave it out and the backend refuses to provision the default spec, which denies all egress, and the task fails (:ref:`a failed provisioning fails the task <sandbox-lifecycle>`) with: .. code-block:: text airflow.providers.common.ai.sandbox.base.SandboxTerminalError: SandboxSpec asks fo...
combine_chunk_656
combine.txt
656
512
number in the millions, compute in the warehouse rather than carrying them through the model's context. **Migrate forty dbt models between warehouse dialects.** The model files go into the workspace, the image carries ``sqlglot`` and ``sqlfluff``, and the loop of convert, lint, read errors, fix runs for as long as it...
combine_chunk_657
combine.txt
657
512
the task. Not the task from its own code: the agent and what it runs are both inside this boundary. ``SandboxToolset`` is the first row. Boundary size is not a security level on its own: the image, the credentials you inject, the network policy and the resource limits decide the actual isolation. Choose the sm...
combine_chunk_658
combine.txt
658
512
worker host. - Left running. No server-side lifetime, so the microVM and its workspace directory survive. * - ``ModalSandboxBackend`` - Modal's container runtime, which Modal `documents as gVisor <https://modal.com/docs/guide/security>`__. - Modal's infrastructure, off the worker. ...
combine_chunk_659
combine.txt
659
512
`` or the ``KubernetesExecutor``? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Because they answer a different question. Both isolate a task from the rest of your platform. Neither puts a boundary between an agent and the code that agent writes. Run an ``AgentOperator`` under the ``KubernetesExecu...
combine_chunk_660
combine.txt
660
512
in advance: exploratory analysis, installing a package for one task, a script the model writes, runs, and fixes from its own traceback. .. _sandbox-limitations: **What it cannot do** - **It does not contain the agent.** Pairing it with a credential-bearing toolset on the same agent leaves that credential within r...
combine_chunk_661
combine.txt
661
512
per-sandbox supervisor and refuses ``allow_egress_to_cidrs`` and an open network. Boat cannot restrict egress at all, so it refuses every network restriction, including the default ``block_network=True``: pass ``SandboxSpec(block_network=False)`` to accept open egress there. Islo turns outbound access on or o...
combine_chunk_662
combine.txt
662
512
:doc:`configuration`. The system tests ``example_sandbox_toolset_sbx.py``, ``example_sandbox_toolset_modal.py``, ``example_sandbox_toolset_opensandbox.py``, ``example_sandbox_toolset_openshell.py``, ``example_sandbox_toolset_boat.py`` and ``example_sandbox_toolset_islo.py`` run against a real backend and are reachable...
combine_chunk_663
combine.txt
663
512
async with sandbox:``, rather than provisioning a sandbox nothing would destroy. The toolset's own error rules hold as well: a command that fails is output the model reads, and a sandbox that cannot be provisioned ends the agent run so the task fails. .. _sandbox-security: Security boundary ----------------- **The s...
combine_chunk_664
combine.txt
664
512
cncf.kubernetes`` provider. * - Identity and entitlement - Which data and operations may this workload use? - Hiding a password does not remove the power to use it. - Least-privilege roles on the connections you pass. Nothing in this provider enforces them. * - Network policy - Which de...
combine_chunk_665
combine.txt
665
512
vendor's API is on the egress allowlist. Sandboxes cannot reach each other, so two sandboxes on one agent are isolated from one another as well as from the worker. <|file|>airflow/providers/common/ai/docs/sandbox/backends/opensandbox.rst .. Licensed to the Apache Software Foundation (ASF) under one or more contr...
combine_chunk_666
combine.txt
666
512
SDK read ``OPEN_SANDBOX_DOMAIN`` and ``OPEN_SANDBOX_API_KEY``. ``SandboxSpec.env`` is sent at creation. A default spec sends a deny-all network policy; ``allow_egress_to`` becomes explicit allow rules. With ``block_network=False``, the backend omits network policy entirely so a deployment without the egress sidecar c...
combine_chunk_667
combine.txt
667
512
``: server-side lifetime in seconds. Default ``3600``. - ``ready_timeout``: provisioning/reconnect timeout. Default ``120``. - ``use_server_proxy``: override the connection extra for file and command calls. The runtime remains a deployment choice. The default Docker runtime shares the host kernel; choose a stronger ru...
combine_chunk_668
combine.txt
668
512
account, so it is also the self-hosted backend to try first on a laptop. For a production gateway on Kubernetes, prefer OpenSandbox or Modal: this backend has been verified on OpenShell's Docker driver only, which OpenShell scopes to local development and single-machine gateways. Install the SDK extra: .. code-block...
combine_chunk_669
combine.txt
669
512
Network policy.** A default ``SandboxSpec()`` sends a policy with no egress rule, which OpenShell enforces as no egress: a connection fails with ``EACCES``, and a name lookup is answered by the supervisor with a synthetic ``198.18.0.0/15`` address rather than failing, so no query leaves the sandbox although the tool de...
combine_chunk_670
combine.txt
670
512
rules admit TCP on listed ports only), ``SandboxSpec.owner``, and ``SandboxSpec.env`` keys the supervisor owns: it removes ``HTTP_PROXY`` and the other proxy variables from every command and replaces ``SSL_CERT_FILE``, ``REQUESTS_CA_BUNDLE``, ``CURL_CA_BUNDLE``, ``GIT_SSL_CAINFO``, ``NODE_EXTRA_CA_CERTS`` and ``DENO_C...
combine_chunk_671
combine.txt
671
512
reported to the model as having an unknown outcome rather than retried; if it does not, the task fails. A dropped connection to a gateway that stays up is reported the same way, but does not stop the command: it runs until its budget runs out, and the model is told it may still be running. **Files.** ``write_file`` s...
combine_chunk_672
combine.txt
672
512
", "0")) < cutoff: client.delete(sandbox.name, workspace="default", allow_missing=True) Constructor parameters: - ``gateway``: the CLI gateway registration to use. ``None`` (default) uses ``$OPENSHELL_GATEWAY``, then the CLI's active gateway. - ``workspace``: OpenShell workspace. Default ``"default"``. ...
combine_chunk_673
combine.txt
673
512
" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Sandbox backends ================ .. note:: Experimental: this can change or be removed in a minor release of this prov...
combine_chunk_674
combine.txt
674
512
``. Islo has no per-host form and refuses the spec; Boat has no form of egress control at all and refuses every network restriction. Both refuse rather than provision something weaker. - **Command timeouts.** A timeout destroys an ``sbx`` or Islo sandbox and its files; Modal, Boat and a server-enforced OpenSand...
combine_chunk_675
combine.txt
675
512
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. .. _sandbox-backend-modal: Modal (hosted) ============== .. note:: Experimental: this can...
combine_chunk_676
combine.txt
676
512
lifetime of a sandbox in seconds. Default ``3600``. Modal's own default is 300, which is below a plausible agent run. - ``idle_timeout``: Seconds of inactivity after which Modal reclaims the sandbox, or ``None`` to rely on ``sandbox_timeout`` alone. Default ``None``; see :ref:`sandbox-timeouts`. - ``workdir``: W...
combine_chunk_677
combine.txt
677
512
refused by default**, because Modal cannot combine an allowlist with ``block_network`` at all, and its hostname allowlist is enforced by matching the name in the TLS handshake, which means: - TLS on port 443 to a listed host connects; any other host is refused at once. - **Non-TLS traffic is dropped, not refused.** A ...
combine_chunk_678
combine.txt
678
512
) Entries must be bare hostnames or one leading ``*.`` label; a URL, a ``host:port``, an address or a single-label name is refused, because Modal applies the list without checking it and any of those would silently match nothing. **An address allowlist is enforced properly, and needs no opt-in.** ``allow_egress_t...
combine_chunk_679
combine.txt
679
512
a channel out, as it is under the hostname list; only ``block_network=True`` with no allowlist closes it. - **Entries are canonical CIDR.** A bare address is written as ``/32``. A range with host bits set, such as ``203.0.113.1/24``, is refused rather than widened to ``203.0.113.0/24``, because that is not what ...
combine_chunk_680
combine.txt
680
512
the link with a regular file and leaves the original target untouched, where a shell redirect would follow the link. <|file|>airflow/providers/common/ai/docs/sandbox/backends/custom.rst .. Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file ...
combine_chunk_681
combine.txt
681
512
Spec, ) class AcmeSandboxBackend(SandboxBackend): name = "acme" def create(self, *, spec: SandboxSpec | None = None) -> str: return acme_sdk.create_sandbox().id def run_command(self, sandbox, command, *, timeout, max_output_bytes): r = acme_sdk.exec(sandbox, c...
combine_chunk_682
combine.txt
682
512
importable from ``airflow.providers.common.ai.sandbox.base``. If the vendor lets a caller of your backend set metadata too, make your reserved keys overwrite theirs. Stamping the working directory under ``WORKDIR_TAG`` is optional; without it the attaching backend asks the sandbox. The toolset shortens ``run_command``...
combine_chunk_683
combine.txt
683
512
flow connection, resolved lazily on first use: .. code-block:: python SandboxToolset( BoatSandboxBackend(boat_conn_id="boat_default"), spec=SandboxSpec(block_network=False), ) The connection ``password`` is the Boat API key and is required. ``host``, when set, is the full API base URL, such a...
combine_chunk_684
combine.txt
684
512
seconds after each such answer until ``ready_timeout`` runs out. Each resend gets what is left of ``ready_timeout`` plus ``request_timeout``, so provisioning takes at most their sum, and a sandbox a resend finds too late to become ready in time is deleted rather than left running until its TTL. If a resend fails any o...
combine_chunk_685
combine.txt
685
512
tool error it can retry. Reads deliberately keep the inherited bounded shell implementation, so ``max_bytes`` is enforced inside the guest before file contents reach worker memory. That path rule binds only ``write_file``; it is not a jail. Commands run as the guest user ``user``, which `Boat documents <https://docs....
combine_chunk_686
combine.txt
686
512
not use this file except in compliance with the License. You may obtain a copy of the License at .. http://www.apache.org/licenses/LICENSE-2.0 .. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES O...
combine_chunk_687
combine.txt
687
512
auto_resume``: ``"on_activity"`` (default) resumes a paused sandbox on the next tool call, so a long think between calls costs a resume rather than the run; ``"never"`` leaves it paused, and the backend then treats a paused sandbox as unusable. - ``delete_after``: Seconds after **creation** at which the server de...
combine_chunk_688
combine.txt
688
512
and times it from the API's answer to the start request, so a slow start does not use it up. Polling rides out transient API errors until the deadline. If the command is still running when the deadline passes, the backend deletes the microVM and reports the command as timed out with ``sandbox_terminated`` set, so the ...
combine_chunk_689
combine.txt
689
512
microVM with its own kernel. .. warning:: **Use this backend for local development, not production.** Docker Sandboxes is built for running coding agents against a checkout on your own machine, and driving it from an Airflow worker is off-label use. A production worker would need the ``sbx`` binary on th...
combine_chunk_690
combine.txt
690
512
pass ``SandboxSpec(block_network=False)`` to match. The ``sbx`` CLI has no way to pass environment variables at creation, so the backend writes ``SandboxSpec.env`` as ``export`` lines to ``/etc/profile`` inside the sandbox. Anything in the sandbox can read that file for as long as the sandbox exists. <|file|>airflow...
combine_chunk_691
combine.txt
691
512
't need an agent: drive the backend from a ``@task`` (:ref:`sandbox-results`). .. _sandbox-configuring: Control network access ---------------------- A sandbox has no outbound network by default, including DNS, and the model is told so in the ``run_command`` tool description: .. code-block:: text This sandbox ...
combine_chunk_692
combine.txt
692
512
- Yes - No - No - Yes A setting the backend cannot enforce fails the task on the agent's first tool call, when the toolset creates the sandbox, and the message says what to change. A bare ``SandboxSpec()`` on ``sbx``, where egress is a host-wide policy the backend cannot see, fails without ``host_netwo...
combine_chunk_693
combine.txt
693
512
-block:: text [stderr] WARNING: Retrying (Retry(total=4, ...)) after connection broken by ...: Temporary failure in name resolution')': /simple/requests/ ... ERROR: Could not find a version that satisfies the requirement requests (from versions: none) ERROR: No matching distribution found for reque...
combine_chunk_694
combine.txt
694
512
( SbxSandboxBackend(image="node:22-slim", host_network_policy="deny-all"), tool_prefix="node", ), ] Without it, the run fails on the first model request with: .. code-block:: text UserError: SandboxToolset 'sandbox-sbx' defines a tool whose name conflicts with existing too...
combine_chunk_695
combine.txt
695
512
.sdk import BaseHook token = BaseHook.get_connection("my_api").password backend = ModalSandboxBackend() sandbox = backend.create( spec=SandboxSpec(env={"API_TOKEN": token}, allow_egress_to_cidrs=["203.0.113.10/32"]) ) try: ... # write_file, run_command, ...
combine_chunk_696
combine.txt
696
512
``. Files up to ``max_export_bytes`` (1 GiB) are copied. Each file is first copied to a ``.partial`` name next to its destination. If a named file is missing, is not a regular file, is over the limit, or cannot be copied, the task fails and no destination changes. Only when every copy has succeeded are the files moved...
combine_chunk_697
combine.txt
697
512
attaching to it with the time left: .. code-block:: text Attached to sandbox sb-01M5ZKXF2HPVDBYY77EFZVQZBG on backend modal as example_sandbox_attach/manual__2026-10-27T21:22:55.304167+00:00/analyse; 1795s of its lifetime remain ``provision`` creates the sandbox, stamps it with its Dag run as the owner, and wri...
combine_chunk_698
combine.txt
698
512
while it waits between tasks. Leave idle_timeout unset on the backend that provisions a sandbox for attaching, and size sandbox_timeout to cover the wait. The toolset never deletes an attached sandbox, so give the task that does a ``trigger_rule=TriggerRule.ALL_DONE``. If it reads the file and then fails to delet...
combine_chunk_699
combine.txt
699
512
the transcript. Drop durable=True, or move the sandbox work into its own task. ``enable_hitl_review=True`` is refused unless every ``SandboxToolset`` is attached to a sandbox another task created: .. code-block:: text ValueError: enable_hitl_review=True cannot be used with a SandboxToolset that provision...