# Profile for the COMPLETE mode: the whole process runs under `python-sb`, so
# this profile has to allow the framework's own dispatch too. The partial mode
# has its own profile, `.py-sandboxes`, deliberately separate. Relearn both with
# `learn.py`; see its docstring.
py-sandbox=true
os-sandbox=${OS_SANDBOX:-subprocess}

net=ALLOW|TCP|www.google.com|443|OUT

# Add rules (2026/09/10 at 07:18)
env=*_API_KEY=${*_API_KEY}
env=*_TOKEN=${*_TOKEN}
env=*_BASE_URL=${*_BASE_URL}
env=n_examples=${n_examples}
env=n_load=${n_load}

# ⚠ Dangerous!
python-import=atexit, ctypes, importlib, inspect, mmap, pkgutil, subprocess
python-import=webbrowser

# Standard Python
python-import=asyncio
python-import=compression
# annotationlib is new in 3.14 (PEP 649/749) and is pulled in by the annotation
# machinery, so the profile needs it to cover that version.
python-import=annotationlib
python-import=__future__, _cffi_backend, _codecs_cn, _codecs_hk, _codecs_iso2022
python-import=_codecs_jp, _codecs_kr, _codecs_tw, _compression, _elementtree
python-import=_csv, _decimal, _hashlib, _markupbase, _multibytecodec, _queue, _socket, _sqlite3, _string
python-import=_sysconfigdata__linux_x86_64-linux-gnu, _thread, _zoneinfo, abc
python-import=argparse, array, ast, base64, binascii, bisect, calendar, codecs
python-import=collections, colorsys, concurrent, configparser, contextlib
python-import=contextvars, copy, copyreg, csv, dataclasses, datetime, decimal, difflib
python-import=dis, email, encodings, enum, errno, fcntl, fnmatch, fractions
python-import=functools, getpass, gettext, glob, graphlib, grp, gzip, hashlib, heapq, hmac
python-import=html, http, io, ipaddress, itertools, json, keyword, logging, marshal
python-import=math, mimetypes, multiprocessing, numbers, operator, os, pathlib
python-import=pickle, platform, posixpath, pprint, pwd, queue, random, re, reprlib
python-import=secrets, select, shlex, shutil, signal, socket, sqlite3, ssl, stat
python-import=string, stringprep, struct, sysconfig, tarfile, tempfile, termios
python-import=textwrap, threading, time, traceback, types, typing, unicodedata
python-import=urllib, uuid, weakref, xml, zipfile, zipimport, zlib, zoneinfo

# External modules (Are you sure about the origin?)
python-import=81d243bd2c585b0f4821__mypyc
python-import=aiohttp
python-import=annotated_doc
python-import=annotated_types
python-import=anyio
python-import=appdirs
python-import=attr
python-import=attrs
python-import=bcrypt
python-import=bs4
python-import=certifi
python-import=charset_normalizer
python-import=chromadb
python-import=click
python-import=aiofiles
python-import=aiosqlite
python-import=crewai
python-import=crewai_core
python-import=jiter
python-import=crewai_demo
python-import=tomli
python-import=tomllib
python-import=cryptography
python-import=distro
python-import=dotenv
python-import=email_validator
python-import=fastapi
python-import=fastuuid
python-import=google
python-import=grpc
python-import=h11
python-import=httpcore
python-import=httpx
python-import=idna
python-import=importlib_metadata
python-import=jinja2
python-import=json5
python-import=json_repair
python-import=jsonref
python-import=jsonschema
python-import=jsonschema_specifications
python-import=jwt
python-import=litellm
python-import=markdownify
python-import=markupsafe
python-import=numpy
python-import=openai
python-import=opentelemetry
python-import=orjson
python-import=overrides
python-import=packaging
python-import=portalocker
python-import=proxytypes
python-import=pybase64
python-import=pydantic
python-import=pydantic_core
python-import=pydantic_settings
python-import=pyexpat
python-import=pygments
python-import=python_multipart
python-import=referencing
python-import=requests
python-import=rich
python-import=rpds
python-import=six
python-import=sniffio
python-import=soupsieve
python-import=starlette
python-import=tenacity
python-import=tiktoken
python-import=tiktoken_ext
python-import=tokenizers
python-import=typing_extensions
python-import=typing_inspection
python-import=urllib3
python-import=yaml
python-import=zipp

expose-ro=~/.local/share/crewai-demo
expose-ro=~/.local/share/crewai/credentials
# The repository root, which uv installs as an editable dependency (see
# `[tool.uv.sources]`), so the sandbox must be able to read it. Relative to the
# working directory, which is this sample's own directory: an absolute `~/...`
# form only resolves on a machine that checked the repository out there, and
# fails on any CI runner. Learning mode cannot emit this form -- it never walks
# above PWD -- so `make learn` puts the absolute path back.
expose-ro=../..
expose-rw=~/.config/crewai

net=ALLOW|TCP|api.scarf.sh|443|OUT
net=ALLOW|TCP|ip6-localhost|0|IN
net=ALLOW|TCP|ip6-loopback|0|IN
net=ALLOW|TCP|raw.githubusercontent.com|443|OUT

# threads: concurrency primitives. CPython renamed the internal entry point:
# 3.13+ goes through _start_joinable_thread, 3.11 and 3.12 through
# _start_new_thread. Both are named so one profile covers every version the
# project claims -- this grants no capability the line above did not.
python-api=ALLOW:threading.Thread.start
python-api=ALLOW:threading._start_joinable_thread
python-api=ALLOW:threading._start_new_thread

# The calculator tool evaluates a string the model produced. `closed` rather
# than the adaptive default: the caller already passes {"__builtins__": {}},
# so the resulting namespace is identical, and a profile handling model output
# should declare its surface here rather than at the call site.
eval-namespace=closed
eval-syntax=arith, compare
eval-max-iterations=100_000
eval-timeout=2s
