3tears-agent-tools 0.14.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. 3tears_agent_tools-0.14.0/.gitignore +216 -0
  2. 3tears_agent_tools-0.14.0/LICENSE +21 -0
  3. 3tears_agent_tools-0.14.0/PKG-INFO +207 -0
  4. 3tears_agent_tools-0.14.0/README.md +148 -0
  5. 3tears_agent_tools-0.14.0/pyproject.toml +63 -0
  6. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/__init__.py +225 -0
  7. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/_coercion.py +102 -0
  8. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/aliases.py +280 -0
  9. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/base_tool.py +223 -0
  10. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/bootstrap.py +292 -0
  11. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/bridge.py +123 -0
  12. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/__init__.py +160 -0
  13. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/analyze_media.py +748 -0
  14. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/calculator.py +206 -0
  15. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/context_recall.py +168 -0
  16. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/current_date.py +156 -0
  17. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/dictionary.py +183 -0
  18. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/image_generation.py +298 -0
  19. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/image_prep.py +229 -0
  20. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/timezone_converter.py +188 -0
  21. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/unit_converter.py +141 -0
  22. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/web_fetch.py +243 -0
  23. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/builtin/web_search.py +159 -0
  24. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/call_scope.py +202 -0
  25. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/chunker.py +235 -0
  26. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/collections.py +521 -0
  27. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/config.py +127 -0
  28. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/consume.py +217 -0
  29. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/context.py +851 -0
  30. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/context_envelope.py +190 -0
  31. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/deliver.py +216 -0
  32. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/document.py +1031 -0
  33. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/engagement.py +139 -0
  34. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/engagement_resolver.py +284 -0
  35. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/entities.py +55 -0
  36. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/events.py +75 -0
  37. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/executor.py +133 -0
  38. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/graph_nodes.py +236 -0
  39. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/langchain_adapter.py +135 -0
  40. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/mcp.py +145 -0
  41. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/migrations/__init__.py +94 -0
  42. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/migrations/v001_create_context_items_table.py +61 -0
  43. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/migrations/v002_datetime_to_datetimetz.py +153 -0
  44. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/migrations/v003_align_context_items_shape.py +166 -0
  45. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/migrations/v004_tool_result_dedup_index.py +67 -0
  46. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/object_resolver.py +256 -0
  47. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/platform_migrations/__init__.py +80 -0
  48. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/platform_migrations/v001_add_tool_eligibility_columns.py +65 -0
  49. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/produce.py +206 -0
  50. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/protocols.py +31 -0
  51. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/py.typed +0 -0
  52. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/registry.py +81 -0
  53. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/report.py +539 -0
  54. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/reports/__init__.py +22 -0
  55. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/reports/markdown_compiler.py +271 -0
  56. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/reports/mermaid_generator.py +190 -0
  57. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/reports/pdf_renderer.py +152 -0
  58. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/reports/severity.py +93 -0
  59. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/router.py +228 -0
  60. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/serve.py +248 -0
  61. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/server.py +2086 -0
  62. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/strategy.py +302 -0
  63. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/todo.py +303 -0
  64. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/tool_llm_dispatch.py +233 -0
  65. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/types.py +18 -0
  66. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/utils.py +12 -0
  67. 3tears_agent_tools-0.14.0/src/threetears/agent/tools/workflow.py +130 -0
  68. 3tears_agent_tools-0.14.0/tests/conftest.py +9 -0
  69. 3tears_agent_tools-0.14.0/tests/enforcement/__init__.py +0 -0
  70. 3tears_agent_tools-0.14.0/tests/enforcement/test_codebase_conventions.py +137 -0
  71. 3tears_agent_tools-0.14.0/tests/enforcement/test_coercion_coverage.py +142 -0
  72. 3tears_agent_tools-0.14.0/tests/enforcement/test_docstring_conventions.py +166 -0
  73. 3tears_agent_tools-0.14.0/tests/enforcement/test_no_metallm_imports.py +51 -0
  74. 3tears_agent_tools-0.14.0/tests/enforcement/test_package_boundaries.py +88 -0
  75. 3tears_agent_tools-0.14.0/tests/enforcement/test_tool_prompt_budget.py +291 -0
  76. 3tears_agent_tools-0.14.0/tests/integration/__init__.py +0 -0
  77. 3tears_agent_tools-0.14.0/tests/integration/test_platform_migrations_integration.py +228 -0
  78. 3tears_agent_tools-0.14.0/tests/integration/test_tool_server_nats.py +330 -0
  79. 3tears_agent_tools-0.14.0/tests/test_analyze_media.py +708 -0
  80. 3tears_agent_tools-0.14.0/tests/test_builtin_tools.py +258 -0
  81. 3tears_agent_tools-0.14.0/tests/test_chunker.py +171 -0
  82. 3tears_agent_tools-0.14.0/tests/test_context.py +533 -0
  83. 3tears_agent_tools-0.14.0/tests/test_context_collection.py +219 -0
  84. 3tears_agent_tools-0.14.0/tests/test_context_recall.py +249 -0
  85. 3tears_agent_tools-0.14.0/tests/test_document.py +186 -0
  86. 3tears_agent_tools-0.14.0/tests/test_executor.py +130 -0
  87. 3tears_agent_tools-0.14.0/tests/test_graph_nodes.py +248 -0
  88. 3tears_agent_tools-0.14.0/tests/test_image_generation.py +357 -0
  89. 3tears_agent_tools-0.14.0/tests/test_image_prep.py +138 -0
  90. 3tears_agent_tools-0.14.0/tests/test_lazy_init.py +88 -0
  91. 3tears_agent_tools-0.14.0/tests/test_mcp.py +133 -0
  92. 3tears_agent_tools-0.14.0/tests/test_protocols.py +128 -0
  93. 3tears_agent_tools-0.14.0/tests/test_registry.py +86 -0
  94. 3tears_agent_tools-0.14.0/tests/test_reports.py +311 -0
  95. 3tears_agent_tools-0.14.0/tests/test_router.py +146 -0
  96. 3tears_agent_tools-0.14.0/tests/test_smoke.py +4 -0
  97. 3tears_agent_tools-0.14.0/tests/test_todo.py +307 -0
  98. 3tears_agent_tools-0.14.0/tests/test_tool_llm_dispatch.py +167 -0
  99. 3tears_agent_tools-0.14.0/tests/test_workflow.py +109 -0
  100. 3tears_agent_tools-0.14.0/tests/testing_utils.py +202 -0
  101. 3tears_agent_tools-0.14.0/tests/unit/__init__.py +0 -0
  102. 3tears_agent_tools-0.14.0/tests/unit/test_bootstrap.py +151 -0
  103. 3tears_agent_tools-0.14.0/tests/unit/test_context_envelope.py +413 -0
  104. 3tears_agent_tools-0.14.0/tests/unit/test_events.py +31 -0
  105. 3tears_agent_tools-0.14.0/tests/unit/test_migrations.py +360 -0
  106. 3tears_agent_tools-0.14.0/tests/unit/test_platform_migrations.py +205 -0
  107. 3tears_agent_tools-0.14.0/tests/unit/test_strategy.py +171 -0
  108. 3tears_agent_tools-0.14.0/tests/unit/test_to_sqlalchemy_table_parity.py +89 -0
  109. 3tears_agent_tools-0.14.0/tests/unit/tools/__init__.py +0 -0
  110. 3tears_agent_tools-0.14.0/tests/unit/tools/_pod_auth.py +190 -0
  111. 3tears_agent_tools-0.14.0/tests/unit/tools/test_base_tool.py +205 -0
  112. 3tears_agent_tools-0.14.0/tests/unit/tools/test_bridge.py +240 -0
  113. 3tears_agent_tools-0.14.0/tests/unit/tools/test_coercion.py +207 -0
  114. 3tears_agent_tools-0.14.0/tests/unit/tools/test_consume.py +295 -0
  115. 3tears_agent_tools-0.14.0/tests/unit/tools/test_core_tools_mcp.py +211 -0
  116. 3tears_agent_tools-0.14.0/tests/unit/tools/test_deliver.py +172 -0
  117. 3tears_agent_tools-0.14.0/tests/unit/tools/test_engagement.py +177 -0
  118. 3tears_agent_tools-0.14.0/tests/unit/tools/test_engagement_resolver.py +163 -0
  119. 3tears_agent_tools-0.14.0/tests/unit/tools/test_object_resolver.py +158 -0
  120. 3tears_agent_tools-0.14.0/tests/unit/tools/test_produce.py +276 -0
  121. 3tears_agent_tools-0.14.0/tests/unit/tools/test_report.py +272 -0
  122. 3tears_agent_tools-0.14.0/tests/unit/tools/test_tool_eligibility.py +262 -0
  123. 3tears_agent_tools-0.14.0/tests/unit/tools/test_tool_server.py +1841 -0
  124. 3tears_agent_tools-0.14.0/tests/unit/tools/test_tool_server_baseline_audit.py +784 -0
  125. 3tears_agent_tools-0.14.0/tests/unit/tools/test_tool_server_namespace_emission.py +159 -0
  126. 3tears_agent_tools-0.14.0/tests/unit/tools/test_utility_tools_mcp.py +276 -0
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ # Claude Code local state
210
+ .claude/
211
+
212
+ # prawduct session evidence (local governance artifacts, never shipped)
213
+ .prawduct/
214
+
215
+ # macOS folder metadata
216
+ .DS_Store
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mark Pace
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,207 @@
1
+ Metadata-Version: 2.4
2
+ Name: 3tears-agent-tools
3
+ Version: 0.14.0
4
+ Summary: Tool framework for LLM agents -- routing, execution, and builtin tools
5
+ Project-URL: Repository, https://github.com/pacepace/3tears
6
+ Author: pace
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Framework :: AsyncIO
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.14
18
+ Requires-Dist: 3tears
19
+ Requires-Dist: 3tears-agent-audit
20
+ Requires-Dist: 3tears-agent-memory
21
+ Requires-Dist: 3tears-langgraph
22
+ Requires-Dist: 3tears-media-contracts
23
+ Requires-Dist: 3tears-nats
24
+ Requires-Dist: 3tears-observe
25
+ Requires-Dist: httpx
26
+ Requires-Dist: langchain-core
27
+ Provides-Extra: all
28
+ Requires-Dist: openpyxl; extra == 'all'
29
+ Requires-Dist: pdf2image; extra == 'all'
30
+ Requires-Dist: pillow; extra == 'all'
31
+ Requires-Dist: pint; extra == 'all'
32
+ Requires-Dist: pymupdf; extra == 'all'
33
+ Requires-Dist: pytesseract; extra == 'all'
34
+ Requires-Dist: python-docx; extra == 'all'
35
+ Requires-Dist: simpleeval; extra == 'all'
36
+ Requires-Dist: trafilatura; extra == 'all'
37
+ Provides-Extra: calculator
38
+ Requires-Dist: simpleeval; extra == 'calculator'
39
+ Provides-Extra: document
40
+ Requires-Dist: openpyxl; extra == 'document'
41
+ Requires-Dist: pymupdf; extra == 'document'
42
+ Requires-Dist: python-docx; extra == 'document'
43
+ Provides-Extra: docx
44
+ Requires-Dist: python-docx; extra == 'docx'
45
+ Provides-Extra: fetch
46
+ Requires-Dist: trafilatura; extra == 'fetch'
47
+ Provides-Extra: ocr
48
+ Requires-Dist: pdf2image; extra == 'ocr'
49
+ Requires-Dist: pytesseract; extra == 'ocr'
50
+ Provides-Extra: pdf
51
+ Requires-Dist: pymupdf; extra == 'pdf'
52
+ Provides-Extra: units
53
+ Requires-Dist: pint; extra == 'units'
54
+ Provides-Extra: vision
55
+ Requires-Dist: pillow; extra == 'vision'
56
+ Provides-Extra: xlsx
57
+ Requires-Dist: openpyxl; extra == 'xlsx'
58
+ Description-Content-Type: text/markdown
59
+
60
+ # 3tears Agent Tools
61
+
62
+ Tool framework for LLM agents. Provides tool routing, execution, context management, MCP integration, and a set of builtin tools.
63
+
64
+ Part of the [3tears](https://github.com/pacepace/3tears) framework.
65
+
66
+ ## ToolServer baseline audit
67
+
68
+ `ToolServer.handle_call` stamps every dispatch with a unified `AuditEvent` envelope (`event_type='tool.call'`) via `threetears.agent.audit.publish_audit`. The baseline emission fires in a `finally` block so success, failure (tool returned `success=False`), and error (tool raised) outcomes all produce a row. Identity axes carry from the active `ToolCallScope` (`actor_user_id`, `calling_agent_id`, `owner_agent_id`, `customer_id`, `correlation_id`); `resource_namespace_id` / `resource_namespace_type` stay `None` at the baseline layer since the tool resolves its target inside `execute`. Per-tool additive events (e.g. `workspace.fs_write`) still publish via `publish_audit` and ride alongside the baseline row under the same `correlation_id`. The `(correlation_id, event_type)` partial unique index on `platform_audit.audit_events` keeps them distinct. Emission is fire-and-forget: NATS publish failures log WARN and never taint the tool's response.
69
+
70
+ ## Tool-as-namespace emission
71
+
72
+ Tool namespace materialization is platform-owned. `ToolServer.publish_registration` writes the `RegistrationManifest` (carrying `pod_id` + `tools` + the `owner_agent_id` / `customer_id` envelope fields), and a platform-side namespace emitter subscribes to `{ns}.tools.register` and upserts one `platform.namespaces` row of type `tool` per tool. This is the sole writer in the platform.
73
+
74
+ Agent-spun ToolServers stamp `agent_id` + `customer_id` on the `RegistrationManifest` so the emitter lands rows with the right owner scope; platform-built-in pods (admin tool server, datasource tool pod) leave both `None` and the row lands with NULL owner columns (admitted under the widened `namespaces_row_scope_customer_ck` carve-out for `tool` type alongside `system` / `model`).
75
+
76
+ The canonical `name` shape is `tools.<sanitized-mcp>.<sanitized-version>` (per `build_namespace_name`); `metadata` carries the pre-sanitized natural-identity fields `mcp_name` / `mcp_version` / `pod_id` so downstream pattern matching (platform access materializer agent.yaml `access.tools` patterns + registry authorizer canonical-name lookup) does not need to reverse the sanitization rules. Deterministic `uuid5` derived from `(mcp_name, version, owner_agent_id_hex)` keeps concurrent emitters race-safe via `ON CONFLICT (id) DO UPDATE`.
77
+
78
+ The `ToolServer.register_tool` / `deregister_tool` helpers still emit through an injected `namespace_collection` for callers that wire one explicitly, but in production deployments the platform-side emitter is the source of truth and the in-process emission is redundant.
79
+
80
+ ## Installation
81
+
82
+ ```bash
83
+ pip install 3tears-agent-tools
84
+
85
+ # Optional extras for builtin tools
86
+ pip install "3tears-agent-tools[calculator]" # simpleeval
87
+ pip install "3tears-agent-tools[units]" # pint
88
+ pip install "3tears-agent-tools[fetch]" # trafilatura
89
+ pip install "3tears-agent-tools[document]" # PyMuPDF, python-docx, openpyxl
90
+ pip install "3tears-agent-tools[all]" # everything
91
+ ```
92
+
93
+ ## Components
94
+
95
+ ### ToolRouter
96
+
97
+ Routes user messages to the appropriate tool using a lightweight LLM call. Includes recall-intent detection to avoid re-invoking tools when users ask about previous results.
98
+
99
+ ```python
100
+ from threetears.agent.tools import ToolRouter, is_recall_intent
101
+
102
+ # Quick check -- no LLM call needed
103
+ if is_recall_intent("show me what the calculator said"):
104
+ # User wants to recall, not invoke
105
+
106
+ # Full routing with LLM
107
+ router = ToolRouter(chat_model)
108
+ decision = await router.route(user_message, tool_descriptions)
109
+ # decision.tool_name, decision.reasoning
110
+ ```
111
+
112
+ ### ToolExecutor
113
+
114
+ Invokes a tool-LLM: sends the user message to a secondary model configured for a specific task.
115
+
116
+ ```python
117
+ from threetears.agent.tools import ToolExecutor
118
+
119
+ executor = ToolExecutor()
120
+ result = await executor.invoke_with_tools(
121
+ chat_model=tool_model,
122
+ user_message="What is 42 * 17?",
123
+ tools=[calculator_tool],
124
+ tool_name="calculator",
125
+ )
126
+ # result.content, result.tool_calls
127
+ ```
128
+
129
+ ### ToolContextManager
130
+
131
+ Tracks tool invocations and results across a conversation for recall support.
132
+
133
+ ```python
134
+ from threetears.agent.tools import ToolContextManager
135
+
136
+ ctx = ToolContextManager()
137
+ await ctx.record_invocation("calculator", "42 * 17", "714")
138
+ await ctx.get_recall_context("calculator") # Returns formatted recall string
139
+ ```
140
+
141
+ ### McpClient
142
+
143
+ MCP (Model Context Protocol) integration for connecting to external tool servers.
144
+
145
+ ```python
146
+ from threetears.agent.tools import McpClient
147
+
148
+ async with McpClient(server_config) as client:
149
+ tools = await client.list_tools()
150
+ result = await client.invoke_tool("tool_name", {"param": "value"})
151
+ ```
152
+
153
+ ### Builtin Tools
154
+
155
+ Register all builtin tools at once:
156
+
157
+ ```python
158
+ from threetears.agent.tools import register_builtins, ToolRegistry
159
+
160
+ registry = ToolRegistry()
161
+ register_builtins(registry)
162
+ # Registers: calculator, unit_converter, dice_roller, date_time,
163
+ # random_number, web_fetch, text_transform, parse_document
164
+ ```
165
+
166
+ ### Todo Tools
167
+
168
+ Todo list management behind a storage protocol:
169
+
170
+ ```python
171
+ from threetears.agent.tools import TodoStorage, load_todo_tools_from_storage
172
+
173
+ class MyTodoStorage(TodoStorage):
174
+ async def add(self, conv_id, user_id, title, list_name, msg_id) -> dict: ...
175
+ async def list_all(self, conv_id) -> list[dict]: ...
176
+ # ... other methods
177
+
178
+ tools = load_todo_tools_from_storage(my_storage, snapshot_callback=on_snapshot)
179
+ ```
180
+
181
+ ### Protocols
182
+
183
+ For media-related capabilities, implement these protocols:
184
+
185
+ ```python
186
+ from threetears.agent.tools import (
187
+ ImageGenerationBackend,
188
+ MediaStorage,
189
+ VisionProvider,
190
+ TranscriptionProvider,
191
+ )
192
+ ```
193
+
194
+ ### Document Parsing
195
+
196
+ Parse PDF, DOCX, XLSX, and plain text with optional OCR:
197
+
198
+ ```python
199
+ from threetears.agent.tools import parse_document, OcrConfig
200
+
201
+ result = await parse_document(
202
+ file_bytes=data,
203
+ filename="report.pdf",
204
+ ocr_config=OcrConfig(enabled=True),
205
+ )
206
+ # result.sections -- list of DocumentSection with title, content, page numbers
207
+ ```
@@ -0,0 +1,148 @@
1
+ # 3tears Agent Tools
2
+
3
+ Tool framework for LLM agents. Provides tool routing, execution, context management, MCP integration, and a set of builtin tools.
4
+
5
+ Part of the [3tears](https://github.com/pacepace/3tears) framework.
6
+
7
+ ## ToolServer baseline audit
8
+
9
+ `ToolServer.handle_call` stamps every dispatch with a unified `AuditEvent` envelope (`event_type='tool.call'`) via `threetears.agent.audit.publish_audit`. The baseline emission fires in a `finally` block so success, failure (tool returned `success=False`), and error (tool raised) outcomes all produce a row. Identity axes carry from the active `ToolCallScope` (`actor_user_id`, `calling_agent_id`, `owner_agent_id`, `customer_id`, `correlation_id`); `resource_namespace_id` / `resource_namespace_type` stay `None` at the baseline layer since the tool resolves its target inside `execute`. Per-tool additive events (e.g. `workspace.fs_write`) still publish via `publish_audit` and ride alongside the baseline row under the same `correlation_id`. The `(correlation_id, event_type)` partial unique index on `platform_audit.audit_events` keeps them distinct. Emission is fire-and-forget: NATS publish failures log WARN and never taint the tool's response.
10
+
11
+ ## Tool-as-namespace emission
12
+
13
+ Tool namespace materialization is platform-owned. `ToolServer.publish_registration` writes the `RegistrationManifest` (carrying `pod_id` + `tools` + the `owner_agent_id` / `customer_id` envelope fields), and a platform-side namespace emitter subscribes to `{ns}.tools.register` and upserts one `platform.namespaces` row of type `tool` per tool. This is the sole writer in the platform.
14
+
15
+ Agent-spun ToolServers stamp `agent_id` + `customer_id` on the `RegistrationManifest` so the emitter lands rows with the right owner scope; platform-built-in pods (admin tool server, datasource tool pod) leave both `None` and the row lands with NULL owner columns (admitted under the widened `namespaces_row_scope_customer_ck` carve-out for `tool` type alongside `system` / `model`).
16
+
17
+ The canonical `name` shape is `tools.<sanitized-mcp>.<sanitized-version>` (per `build_namespace_name`); `metadata` carries the pre-sanitized natural-identity fields `mcp_name` / `mcp_version` / `pod_id` so downstream pattern matching (platform access materializer agent.yaml `access.tools` patterns + registry authorizer canonical-name lookup) does not need to reverse the sanitization rules. Deterministic `uuid5` derived from `(mcp_name, version, owner_agent_id_hex)` keeps concurrent emitters race-safe via `ON CONFLICT (id) DO UPDATE`.
18
+
19
+ The `ToolServer.register_tool` / `deregister_tool` helpers still emit through an injected `namespace_collection` for callers that wire one explicitly, but in production deployments the platform-side emitter is the source of truth and the in-process emission is redundant.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install 3tears-agent-tools
25
+
26
+ # Optional extras for builtin tools
27
+ pip install "3tears-agent-tools[calculator]" # simpleeval
28
+ pip install "3tears-agent-tools[units]" # pint
29
+ pip install "3tears-agent-tools[fetch]" # trafilatura
30
+ pip install "3tears-agent-tools[document]" # PyMuPDF, python-docx, openpyxl
31
+ pip install "3tears-agent-tools[all]" # everything
32
+ ```
33
+
34
+ ## Components
35
+
36
+ ### ToolRouter
37
+
38
+ Routes user messages to the appropriate tool using a lightweight LLM call. Includes recall-intent detection to avoid re-invoking tools when users ask about previous results.
39
+
40
+ ```python
41
+ from threetears.agent.tools import ToolRouter, is_recall_intent
42
+
43
+ # Quick check -- no LLM call needed
44
+ if is_recall_intent("show me what the calculator said"):
45
+ # User wants to recall, not invoke
46
+
47
+ # Full routing with LLM
48
+ router = ToolRouter(chat_model)
49
+ decision = await router.route(user_message, tool_descriptions)
50
+ # decision.tool_name, decision.reasoning
51
+ ```
52
+
53
+ ### ToolExecutor
54
+
55
+ Invokes a tool-LLM: sends the user message to a secondary model configured for a specific task.
56
+
57
+ ```python
58
+ from threetears.agent.tools import ToolExecutor
59
+
60
+ executor = ToolExecutor()
61
+ result = await executor.invoke_with_tools(
62
+ chat_model=tool_model,
63
+ user_message="What is 42 * 17?",
64
+ tools=[calculator_tool],
65
+ tool_name="calculator",
66
+ )
67
+ # result.content, result.tool_calls
68
+ ```
69
+
70
+ ### ToolContextManager
71
+
72
+ Tracks tool invocations and results across a conversation for recall support.
73
+
74
+ ```python
75
+ from threetears.agent.tools import ToolContextManager
76
+
77
+ ctx = ToolContextManager()
78
+ await ctx.record_invocation("calculator", "42 * 17", "714")
79
+ await ctx.get_recall_context("calculator") # Returns formatted recall string
80
+ ```
81
+
82
+ ### McpClient
83
+
84
+ MCP (Model Context Protocol) integration for connecting to external tool servers.
85
+
86
+ ```python
87
+ from threetears.agent.tools import McpClient
88
+
89
+ async with McpClient(server_config) as client:
90
+ tools = await client.list_tools()
91
+ result = await client.invoke_tool("tool_name", {"param": "value"})
92
+ ```
93
+
94
+ ### Builtin Tools
95
+
96
+ Register all builtin tools at once:
97
+
98
+ ```python
99
+ from threetears.agent.tools import register_builtins, ToolRegistry
100
+
101
+ registry = ToolRegistry()
102
+ register_builtins(registry)
103
+ # Registers: calculator, unit_converter, dice_roller, date_time,
104
+ # random_number, web_fetch, text_transform, parse_document
105
+ ```
106
+
107
+ ### Todo Tools
108
+
109
+ Todo list management behind a storage protocol:
110
+
111
+ ```python
112
+ from threetears.agent.tools import TodoStorage, load_todo_tools_from_storage
113
+
114
+ class MyTodoStorage(TodoStorage):
115
+ async def add(self, conv_id, user_id, title, list_name, msg_id) -> dict: ...
116
+ async def list_all(self, conv_id) -> list[dict]: ...
117
+ # ... other methods
118
+
119
+ tools = load_todo_tools_from_storage(my_storage, snapshot_callback=on_snapshot)
120
+ ```
121
+
122
+ ### Protocols
123
+
124
+ For media-related capabilities, implement these protocols:
125
+
126
+ ```python
127
+ from threetears.agent.tools import (
128
+ ImageGenerationBackend,
129
+ MediaStorage,
130
+ VisionProvider,
131
+ TranscriptionProvider,
132
+ )
133
+ ```
134
+
135
+ ### Document Parsing
136
+
137
+ Parse PDF, DOCX, XLSX, and plain text with optional OCR:
138
+
139
+ ```python
140
+ from threetears.agent.tools import parse_document, OcrConfig
141
+
142
+ result = await parse_document(
143
+ file_bytes=data,
144
+ filename="report.pdf",
145
+ ocr_config=OcrConfig(enabled=True),
146
+ )
147
+ # result.sections -- list of DocumentSection with title, content, page numbers
148
+ ```
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "3tears-agent-tools"
7
+ version = "0.14.0"
8
+ description = "Tool framework for LLM agents -- routing, execution, and builtin tools"
9
+ readme = "README.md"
10
+ requires-python = ">=3.14"
11
+ authors = [{name = "pace"}]
12
+ license = "MIT"
13
+ license-files = ["LICENSE"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Framework :: AsyncIO",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.14",
20
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
21
+ "Topic :: Software Development :: Libraries",
22
+ "Typing :: Typed",
23
+ ]
24
+ dependencies = [
25
+ "3tears",
26
+ "3tears-agent-audit",
27
+ "3tears-agent-memory",
28
+ "3tears-langgraph",
29
+ "3tears-media-contracts",
30
+ "3tears-nats",
31
+ "3tears-observe",
32
+ "langchain-core",
33
+ "httpx",
34
+ ]
35
+
36
+ [project.urls]
37
+ Repository = "https://github.com/pacepace/3tears"
38
+
39
+ [project.optional-dependencies]
40
+ calculator = ["simpleeval"]
41
+ units = ["pint"]
42
+ fetch = ["trafilatura"]
43
+ pdf = ["PyMuPDF"]
44
+ docx = ["python-docx"]
45
+ xlsx = ["openpyxl"]
46
+ vision = [
47
+ "pillow",
48
+ ]
49
+ ocr = ["pytesseract", "pdf2image"]
50
+ document = ["PyMuPDF", "python-docx", "openpyxl"]
51
+ all = ["simpleeval", "pint", "trafilatura", "PyMuPDF", "python-docx", "openpyxl", "pytesseract", "pdf2image", "Pillow"]
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["src/threetears"]
55
+
56
+ [tool.uv.sources]
57
+ 3tears = { workspace = true }
58
+ 3tears-agent-audit = { workspace = true }
59
+ 3tears-agent-memory = { workspace = true }
60
+ 3tears-langgraph = { workspace = true }
61
+ 3tears-media-contracts = { workspace = true }
62
+ 3tears-nats = { workspace = true }
63
+ 3tears-observe = { workspace = true }