Skip to main content

Agents Function Tools

agents-function-tools is a portable Python library of policy-friendly system function tools. It contains no business model, Agent routing, domain workflow, database adapter, or code-review logic. Its Python import name is function_tools.

Install

python -m pip install agents-function-tools

Included tools

Category Tools Tool group
Workspace read List, read UTF-8, inspect metadata, glob-style find, hash files, disk usage read
Workspace write Write text, create directories, copy a regular file, move a path, delete a path write
ZIP List archive entries; create and extract bounded ZIP archives read / write
Network Fetch bounded HTTPS text from configured hosts read
Host Non-sensitive system info, UTC time, explicitly allowlisted environment variables read
Commands Describe configured aliases; run one allowlisted executable with shell=False read / execute

Every tool returns the same JSON envelope with ok, tool, effect, data, and error fields. Paths are always relative to a configured workspace root.

Safety boundary

  • Path traversal and access outside the workspace root are rejected.
  • The workspace root cannot be deleted.
  • Recursive deletion must be explicit.
  • File reads, writes, hashes, and archive expansion have byte limits.
  • Every workspace mutation and local command requires the SDK approval gate in addition to the orchestration approval policy. File copy accepts regular, non-symlink source files only.
  • ZIP creation rejects symlinks; ZIP extraction rejects path traversal and symlink entries before writing files.
  • HTTPS fetching requires an exact host allowlist, rejects redirects, URL credentials, and non-default ports, accepts only text-like content types, and blocks resolved private or loopback addresses. No host is enabled by default. Deployment still needs an egress proxy or firewall: application-layer DNS checks do not replace network isolation.
  • Host diagnostics intentionally exclude user identities, process lists, network configuration, installed software, and environment variables except for names explicitly configured by the host.
  • Command execution accepts an argument array, never a shell string. Programs must be mapped by the host application, execution has a timeout, and output is truncated.
  • The local command runner is not an OS security sandbox. Production deployment must run the service or runner inside the company-approved container/sandbox with no production secrets and restricted network access.
  • Approval remains the orchestration layer's responsibility. Only attach tools.write or tools.execute after the matching approval policy has been validated.

This is a controlled operating-system capability adapter, not a general shell, process-management, credential, service-control, or unrestricted-network interface. Give each business Agent only the smallest subset of these tools it needs.

Example

from pathlib import Path

from agents import Agent

from function_tools import create_tools

tools = create_tools(Path("./workspace"))

agent = Agent(
    name="Workspace assistant",
    instructions="Use workspace tools when needed.",
    tools=list(tools.read),
)

tools.read is read-only. tools.write and tools.execute require approval on every call. The SDK derives each FunctionTool's input schema from the Python signature and docstring.

For configured commands, HTTPS hosts, or readable environment variables, use ToolConfig:

import sys
from pathlib import Path

from function_tools import ToolConfig, create_tools

tools = create_tools(
    ToolConfig(
        workspace_root=Path("./workspace"),
        command_programs={"python": sys.executable},
        http_allowed_hosts=frozenset({"api.example.internal"}),
        environment_variables=frozenset({"APP_ENV"}),
    )
)

License

Apache-2.0. See LICENSE.

Development

Use Python 3.10 or newer:

uv sync --python 3.10
uv run --python 3.10 pytest

Tests do not call the OpenAI API and do not require OPENAI_API_KEY.

Release acceptance

Before every PyPI release, run:

uv run python scripts/release_check.py

The gate checks the lockfile, formatting, linting, tests, wheel and source-distribution contents, package metadata, a clean python -m pip install --no-deps <wheel>, and a separate clean runtime installation with dependencies.

Use the following command to run that gate and publish only when it passes:

uv run python scripts/publish.py

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agents_function_tools-0.3.0.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agents_function_tools-0.3.0-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file agents_function_tools-0.3.0.tar.gz.

File metadata

  • Download URL: agents_function_tools-0.3.0.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agents_function_tools-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c86a5a1651a77bcb4f25a6df580b17d75c71d989158ec7b03e3c7492f2365d16
MD5 0291039e9d7a37d77f13de74fb14924f
BLAKE2b-256 94da310bd787167a839b25989c68dbae7aab960c7def2e1a87412f70e86ed84e

See more details on using hashes here.

File details

Details for the file agents_function_tools-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: agents_function_tools-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agents_function_tools-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac5cfe1a08835a0b8b0e3c8353666c9e2de6835881a5c3f4fd2cc1e5b6836905
MD5 592a8322cc01e0bde35b9074cca2a703
BLAKE2b-256 1b4b0b606eb8c664f250760354f7e3632d02cb7e1a06d864939b7d8d9d7489c0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page