Skip to main content

Overview

The Jinba Toolbox tool registers a Python tool in Jinba Toolbox from within a flow. It creates the toolset on first use and creates or updates the tool on every run, so a flow can keep a generated tool in sync with its source.

Key Features

  • JINBA_TOOLBOX_REGISTER_TOOL
    • Register or update a Python tool identified by org_id, tool_set_slug, and tool_slug
    • Creates the toolset (private, Python sandbox) when it does not exist yet, using tool_set_name and tool_set_description
    • Sends tool_name, tool_description, and code on every run — changing tool_name between runs renames the tool
    • Does not publish a version: publish from the Toolbox web console once the tool is registered

Authentication

Set the api_key config to a Jinba Toolbox API key (secret type JINBA_TOOLBOX_API_KEY). The optional base_url config overrides the Toolbox API URL configured for your Jinba Flow deployment. Note: Treat API keys as sensitive information and never commit them to public repositories.

Usage Examples

Example: Register a Tool

Notes

  • Inputs: org_id (Toolbox organization id or slug), tool_set_slug and tool_slug (lowercase letters, digits, and hyphens; up to 64 characters), tool_set_name and tool_name (up to 256 characters), tool_set_description and tool_description (optional, up to 4,096 characters), and code (up to 65,536 characters).
  • code must define Input and Output pydantic BaseModel classes and a run(input: Input) -> Output function — Toolbox extracts the tool’s I/O schema from them and rejects code that is missing any of them.
  • tool_set_name and tool_set_description are used only when the toolset is created; an existing toolset is not renamed. An empty tool_set_description falls back to tool_set_name. An empty tool_description leaves an existing tool’s description unchanged.
  • result contains tool_set_slug, tool_slug, tool_set_created, and tool_created (true when the run created the toolset or tool rather than updating it).
  • Concurrent registrations of the same tool_set_slug / tool_slug are not coordinated — serialize them in the flow.