This project has been archived by its maintainers, and is no longer receiving any updates.
autourgos-toolbox
Dynamic lazy-loading toolbox middleware for Autourgos agents. Keeps the
agent's context window clean by only showing toolbox names and descriptions upfront — the agent loads the
tools it actually needs at runtime by calling expose_toolbox(name).
from autourgos_toolbox import Toolbox, ToolboxMiddleware
from autourgos_agent import Agent
web_box = Toolbox(name="web", description="Web search and page scraping tools.", tools=[web_search, scrape_url])
db_box = Toolbox(name="database", description="SQL query tools.", tools=[run_query, list_tables])
agent = Agent(llm=my_llm, middleware=[ToolboxMiddleware(toolboxes=[web_box, db_box])])
result = agent.invoke("Find the latest Python release and log it to the database")
Features
- Lazy tool loading — the agent sees only toolbox names/descriptions upfront, real tool schemas load on
demand via
expose_toolbox(name) - Define toolboxes three ways — a list of
Toolboxobjects, a dict, or dynamically withadd_toolbox() StructuredTool— auto-infers a JSON schema from type annotations and docstrings- Clean state per run —
on_agent_end/on_agent_errorfully restore the agent's original tools + prompt - Safe to share across agents — one
ToolboxMiddlewareinstance can serve multiple concurrentAgents; per-agent state is isolated (autourgos-core'sPerAgentRegistry) - Depends on
autourgos-agent; works with any Autourgos agent
Table of Contents
Why Use This?
Real-world agents often need dozens of tools — GitHub, databases, web search, file system, APIs. Dumping all
of them into the prompt at once wastes tokens on tools the agent will never use for a given task, confuses
the LLM with too many choices, and can hit the context window limit before the task even starts.
ToolboxMiddleware groups tools into named toolboxes and only shows the catalog upfront.
Install
pip install autourgos-toolbox
Depends on autourgos-agent.
Quick Start
from autourgos_toolbox import Toolbox, ToolboxMiddleware
from autourgos_agent import Agent
web_box = Toolbox(
name="web",
description="Web search and page scraping tools.",
tools=[web_search, scrape_url],
)
db_box = Toolbox(
name="database",
description="SQL query tools for the production database.",
tools=[run_query, list_tables, describe_table],
)
middleware = ToolboxMiddleware(toolboxes=[web_box, db_box])
agent = Agent(llm=my_llm, middleware=[middleware])
result = agent.invoke("Find the latest Python release and log it to the database")
print(result)
With Agent(verbose=True), this middleware narrates its own actions into the trace:
[Toolbox] Exposed toolbox 'web' to agent.
The agent sees this in its prompt at the start:
## Dynamic Toolboxes
Available Toolboxes:
- **web**: Web search and page scraping tools.
- **database**: SQL query tools for the production database.
When it needs the web tools, it calls:
{"action": "expose_toolbox", "action_input": {"toolbox_name": "web"}}
And immediately all web tools are registered and their schemas injected into the prompt.
How It Works
- on_agent_start — middleware injects
expose_toolboxandexpose_toolmeta-tools plus a toolbox catalog into the agent's system prompt. No actual tools are loaded yet. - Agent calls expose_toolbox — all tools in that toolbox are registered on the agent and their schemas appended to the prompt.
- Agent uses the tools — now fully loaded and callable.
- on_agent_end / on_agent_error — agent is fully restored to its original state so the next run starts clean.
Define Toolboxes
As a list of Toolbox objects
from autourgos_toolbox import Toolbox, ToolboxMiddleware
github_box = Toolbox(
name="github",
description="Tools for reading and writing GitHub issues and PRs.",
tools=[search_issues, create_pr, list_repos],
)
middleware = ToolboxMiddleware(toolboxes=[github_box])
As a dict
middleware = ToolboxMiddleware(toolboxes={
"github": {"description": "Tools for reading and writing GitHub issues and PRs.", "tools": [search_issues, create_pr, list_repos]},
"slack": {"description": "Tools for sending and reading Slack messages.", "tools": [send_message, read_channel]},
})
Add toolboxes dynamically
middleware = ToolboxMiddleware()
middleware.add_toolbox("github", "GitHub tools.", [search_issues, create_pr])
middleware.add_toolbox("slack", "Slack tools.", [send_message, read_channel])
add_toolbox() raises ValueError if any tool name in the new toolbox already exists in a
different, previously registered toolbox — tool names must be unique across every toolbox on
one middleware instance. Re-registering the same toolbox name (to update its tools) is fine and
doesn't trip this check.
Using StructuredTool
Tools can be plain callables or StructuredTool instances. StructuredTool auto-infers the JSON schema from
type annotations and docstrings:
from autourgos_toolbox import StructuredTool
def search_issues(query: str, repo: str) -> str:
"""Search GitHub issues.
Args:
query: Search keywords.
repo: Repository name in owner/repo format.
"""
...
tool = StructuredTool.from_function(search_issues)
Requirements
- Python 3.9+
- Any Autourgos agent with
add_tools(),agent.tools, andagent.system_prompt/agent.prompt_template
License
Apache License 2.0, Copyright (c) 2026 Jitin Kumar Sengar
Metadata
Release files for autourgos-toolbox 3.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autourgos_toolbox-3.4.0.tar.gz | 28.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autourgos_toolbox-3.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.5 kB
Release files / autourgos_toolbox-3.4.0.tar.gz
| Download URL | autourgos_toolbox-3.4.0.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d994e6a1850f034a50fb4571aea23222add801ae30f0dbdc81b4628312bda22b
|
|
BLAKE2b-256 checksum How to use checksums |
47d07842431dceb269146bc8b2006bbfd892070a118f2a4875d9d2df395835aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / autourgos_toolbox-3.4.0-py3-none-any.whl
| Download URL | autourgos_toolbox-3.4.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78541731e5856c02c576e184f39f879f2ad69c12c4e2749c27291831ce2f3838
|
|
BLAKE2b-256 checksum How to use checksums |
e1e95da3d8cf69325b5133a63dbda48ee47504c0a0c579f779ff6cda1d62cc52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|