> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://poly-ai.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://poly-ai.ferndocs.com/_mcp/server.

# Libraries

> Standard library and pre-installed packages available to functions, including requests, jsonschema, and urllib3.

> **Info**
>
> **Python required.** Functions run in a managed sandbox with the standard library plus the packages listed below — no additional installs. Contact your PolyAI representative if you need a library that isn't listed.

## Execution environment

Functions run in a **sandboxed cloud environment**. This means:

* **No local file system access** – you cannot read or write files from your machine (e.g., CSV files, text files, or databases stored locally).
* **No package installation** – only the standard library and the pre-installed packages listed below are available.
* **Network access** – you can make outbound HTTP requests using the `requests` library to call external APIs or fetch hosted data.

If you need to use data from a file, host it externally (e.g., on a web server or cloud storage) and fetch it at runtime using `requests`.

## Standard library

Within functions you have access to the full [Python standard library](https://docs.python.org/3/library/index.html), including modules like `datetime`, `json`, `re`, `urllib`, and `hashlib`.

## Notable language features

The runtime supports modern Python language features, including:

* **Structural pattern matching** (`match`/`case`, Python 3.10+) – a cleaner alternative to long `if`/`elif` chains for branching on values or structures. See the [Python docs on match statements](https://docs.python.org/3/tutorial/controlflow.html#match-statements).
* **Parenthesized context managers** (Python 3.10+) – you can use parentheses to split multiple context managers across lines:
  ```python
  with (
      open("input.json") as infile,
      open("output.json", "w") as outfile,
  ):
      ...
  ```
* **Exception Groups and `except*`** (Python 3.11+) – handle multiple exceptions raised concurrently. Useful when your function makes parallel API calls. See [PEP 654](https://peps.python.org/pep-0654/).

## Pre-installed packages

The following packages are pre-installed and available for `import`:

| Library                                                                | Description                          |
| ---------------------------------------------------------------------- | ------------------------------------ |
| [requests](https://requests.readthedocs.io/en/stable/user/quickstart/) | HTTP library for making API requests |
| [urllib3](https://urllib3.readthedocs.io/en/stable/)                   | Low-level HTTP client                |
| [jsonschema](https://python-jsonschema.readthedocs.io/en/stable/)      | JSON schema validation               |

> **Tip**
>
> The `requests` library is the recommended way to make external API calls from your functions. See the [requests quickstart guide](https://requests.readthedocs.io/en/stable/user/quickstart/) for usage examples.

If you encounter unexpected behavior with a library, contact your PolyAI representative.