Catalog PyPI
PACKAGE EXPLORERView in registry

agents-function-tools

PyPI

Portable, policy-friendly system function tools for AI applications.

Versions collected1
Direct dependencies2From release 0.6.0
Last observed20 Oct, 23:21 UTC

README

Version 0.6.0 documentation

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

CategoryToolsRecommended selector
Workspace readList, read UTF-8, inspect metadata, glob-style find, hash files, disk usagefiles.read
Workspace writeWrite text, create directories, copy a regular file, move a path, delete a pathfiles.write
ZIPList archive entries; create and extract bounded ZIP archivesfiles.read / files.write
NetworkSend bounded HTTPS GET/HEAD requests; send approval-gated POST/PUT/PATCH/DELETE requests; optionally build search URLs, resolve hosts, and probe portsnetwork.read / network.write
GitInspect status, diffs, history, and revisions; approval-gated stage and commitgit.read / git.write
HostNon-sensitive system info, UTC time, explicitly allowlisted environment variableshost.inspect
Processes and commandsDescribe configured aliases; optionally inspect allowlisted process names; run one allowlisted executable with shell=Falseprocess.inspect / process.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.

Machine-readable contracts

Every returned bundle exposes contracts, a mapping from FunctionTool name to a ToolContract. The contract snapshots the SDK-derived input schema and declares the stable response schema, failure schema, capability permission, response effect, approval requirement, and retry safety. This lets an application build its own CLI, web approval screen, audit log, or policy check without binding this package to a particular Agent workflow.

from function_tools import create_tools

tools = create_tools("./workspace")
contract = tools.contracts["workspace_write_text"]

assert contract.permission == "workspace.write"
assert contract.needs_approval is True
assert contract.retry_safe is False
print(contract.to_dict())

needs_approval=True is enforced by the OpenAI Agents SDK. The host application receives the interruption, presents its own approval UI, then resumes the saved run state only after an explicit approval. This package deliberately does not impose a CLI or web interaction model.

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.
  • HTTPS writes support only POST, PUT, PATCH, and DELETE with bounded JSON or plain-text bodies. They require SDK approval on every call. Arbitrary headers and credentials are intentionally unsupported.
  • Git tools are disabled until the host configures a Git executable. They use fixed argument shapes with shell=False, require repositories and paths to remain inside the workspace, disable prompts, hooks, pagers, signing, and system Git configuration, and bound execution time and output. Stage and commit require SDK approval; remote operations and arbitrary Git arguments are intentionally unsupported.
  • Host diagnostics intentionally exclude user identities, network configuration, installed software, and environment variables except for names explicitly configured by the host. Process diagnostics are separate, disabled by default, and return only configured process names, PIDs, states, and start times.
  • 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.files.read),
)

Use the narrowest domain selector: tools.files, tools.network, tools.git, tools.host, or tools.process. The v0.3-style tools.read, tools.write, and tools.execute selectors remain available for compatibility, but combine more capabilities. Every *.write and *.execute tool requires approval on every call. The SDK derives each FunctionTool's input schema from the Python signature and docstring.

Documentation

OpenAI Agents workspace assistant is a runnable example with tools.files.read, tools.files.write, and per-call SDK approval. It is intentionally limited to one workspace; it does not attach network, host, process, command, MCP, or database tools.

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

import shutil
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"}),
        git_executable=shutil.which("git"),
    )
)

Network diagnostics and process inspection are disabled until explicitly configured:

from function_tools import ToolConfig, create_tools

tools = create_tools(
    ToolConfig(
        workspace_root="./workspace",
        http_allowed_hosts=frozenset({"api.example.internal"}),
        search_engines={"bing": "https://www.bing.com/search"},
        network_allowed_ports=frozenset({443}),
        process_name_allowlist=frozenset({"python.exe"}),
    )
)

network_read_tools = tools.network.read
network_write_tools = tools.network.write
git_read_tools = tools.git.read
git_write_tools = tools.git.write
process_tools = tools.process.inspect

License

Apache-2.0. See the 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.

GitHub Actions runs formatting and linting, a Windows/Linux plus Python 3.10-3.12 test matrix, and the same package acceptance gate used before publishing. The suite includes public FunctionTool contracts and offline OpenAI Agents SDK integration tests using ScriptedModel, including approval interruption and resume behavior.

OpenAI Agents SDK compatibility

The package requires openai-agents>=0.22,<1; 0.22.0 is the current validated baseline. The weekly OpenAI Agents SDK latest workflow resolves the newest compatible SDK release from PyPI and runs the deterministic suite against it. It detects upstream compatibility changes without silently publishing or accepting a new SDK version.

Release acceptance

Before every PyPI release, run:

uv run python scripts/release_check.py

The gate checks the lockfile, formatting, linting, example compilation, 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

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.6.03 Sept 20262

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
dongrv/agents-function-tools

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:21 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d5d274677d97c327412fc2878f6599c85794dad202cd924d0ae15abb4b055fdd