Skip to main content

Runtime toolkit for explicit-parameter registration, inspection, replacement, listing, and removal of Swarmauri tools during agent execution.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_toolkit_runtime

Swarmauri Toolkit RuntimeToolkit

RuntimeToolkit is a Swarmauri runtime-management toolkit for agents that need to register, inspect, list, replace, and remove tools during execution. It keeps tool mutation inside the active toolkit instance and requires explicit parameter declarations when a new runtime tool is introduced.

Features

  • Bundles agent-callable CRUD operations for toolkit members.
  • Accepts serialized tool specs with type fields and materializes installed Swarmauri tools at runtime.
  • Enforces a non-empty declared parameters list for runtime tool registration and replacement.
  • Returns agent-friendly dictionaries for reads, lists, and mutation results.
  • Protects the toolkit's own management tools from accidental overwrite or removal.
  • Supports Python 3.10 through 3.12.

Support

  • Python 3.10
  • Python 3.11
  • Python 3.12

Installation

uv

uv add swarmauri_toolkit_runtime

pip

pip install swarmauri_toolkit_runtime

Usage

Use RuntimeToolkit when an agent needs to mutate its own tool surface safely at runtime. The expected workflow is:

  1. Start with the management toolkit.
  2. Register a runtime tool using an explicit parameter contract.
  3. Inspect or list the available runtime tools.
  4. Execute the registered tool.
  5. Replace or unregister the tool when the runtime surface changes.

Instantiate the toolkit and hand it to an agent or tool-capable model. The toolkit starts with only its management tools, then grows as the agent adds tools.

from swarmauri_toolkit_runtime import RuntimeToolkit

toolkit = RuntimeToolkit()

toolkit.get_tool_by_name("RegisterRuntimeTool")(
    {
        "type": "AdditionTool",
        "name": "RuntimeAdditionTool",
        "description": "Adds two integers during the active agent session.",
        "parameters": [
            {
                "name": "x",
                "input_type": "integer",
                "description": "The left operand",
                "required": True,
            },
            {
                "name": "y",
                "input_type": "integer",
                "description": "The right operand",
                "required": True,
            },
        ],
    }
)

result = toolkit.get_tool_by_name("RuntimeAdditionTool")(2, 3)
print(result)

Agent Workflow

  1. Call ListRuntimeTools to inspect the current runtime surface.
  2. Call RegisterRuntimeTool with a tool spec to extend the toolkit.
  3. Call InspectRuntimeTool to inspect the hydrated tool metadata.
  4. Call ReplaceRuntimeTool when the agent needs to replace a tool with a revised spec.
  5. Call UnregisterRuntimeTool when a runtime tool should no longer be available.

Tool Spec Contract

Mutation tools accept a serialized tool specification. At minimum, provide:

  • a type field that resolves to an installed Swarmauri tool import such as swarmauri.tools.AdditionTool
  • a non-empty parameters list that explicitly declares the runtime callable contract

Resolution prefers the swarmauri facade when present and falls back to swarmauri_standard.tools.<ToolName> for isolated package installs.

{
    "type": "AdditionTool",
    "name": "RuntimeAdditionTool",
    "description": "Adds two integers.",
    "parameters": [
        {
            "name": "x",
            "input_type": "integer",
            "description": "The left operand",
            "required": True,
        },
        {
            "name": "y",
            "input_type": "integer",
            "description": "The right operand",
            "required": True,
        },
    ],
}

If the target tool defines extra fields, include them in the spec and the toolkit will validate them against the concrete tool class.

Failure Modes

  • Registration fails when the tool spec omits parameters.
  • Registration fails when the tool name collides with a protected management tool.
  • Replacement fails when the target tool is missing, reserved, or renamed to an existing tool.
  • Unregistration fails when the target is reserved or absent.

License

swarmauri_toolkit_runtime is released under the Apache 2.0 License. See LICENSE for details.

Project details


Download files

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

Source Distribution

swarmauri_toolkit_runtime-0.1.1.dev2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_toolkit_runtime-0.1.1.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_toolkit_runtime-0.1.1.dev2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_toolkit_runtime-0.1.1.dev2.tar.gz
Algorithm Hash digest
SHA256 f65b840510bddc93a36a75b65c725dada4e43c226e6d5c9cd3627ae0f6a4d213
MD5 c91d5a0c38860c34318c1f51137e577a
BLAKE2b-256 183d4937f1f9f2b7f28ed0c3515af45c4e0676d6c00aa2d0cdd9528e4df12bb6

See more details on using hashes here.

File details

Details for the file swarmauri_toolkit_runtime-0.1.1.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_toolkit_runtime-0.1.1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_toolkit_runtime-0.1.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 07cbd59489e357682505d2b8b7c6bff8f97ce86509c1d45c2e0f2ef3da07b927
MD5 e28add96fb6d75fef4663842e5faca24
BLAKE2b-256 80f51a461caea6de504d5b1571ebbbcc6d03a159087f5fbdaeba65e4456e0a55

See more details on using hashes here.

Supported by

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