CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
2.0 KiB
2.0 KiB
Contributing: new tool
What you're adding
A deterministic Python function that an agent can call. Tools are the
pure-function layer between agents and data — no LLM calls, no I/O except
knowledge/*.yaml loads and SQL reads.
File locations
- Implementation:
perfxpert/tools/<module>.py - Tests:
tests/test_tools/test_<module>.py
Template
"""<module> — <one-line purpose>.
Tool class: READ_ONLY (MCP-safe) or EXECUTION (in-process only).
Tool classes are enumerated in the multi-agent design spec (local
contributor doc, not tracked in the repo) — Appendix A.
"""
from typing import Any, Dict
from perfxpert.knowledge import load_yaml
from perfxpert.tools._class import ToolClass, tool_class
@tool_class(ToolClass.READ_ONLY)
def my_tool(arg: str) -> Dict[str, Any]:
"""<docstring>
Args:
arg: <what>
Returns:
<shape>
Raises:
KeyError: if <condition>
"""
data = load_yaml("my_yaml")
# ...
return {...}
Schema constraints (CI-enforced)
- Type hints mandatory on args + return
- Docstring in Google style
- No external I/O (filesystem writes, network) without
ToolClass.EXECUTION - < 100 ms per call (p99) — covered by a timing test
Tests you must add
test_<name>_returns_expected_shape— happy pathtest_<name>_raises_on_unknown_input— error pathtest_<name>_is_read_only_class— MCP policytest_<name>_under_50ms— performance
Review requirements
- 1 core reviewer
- CI green (unit + MCP-exposure + type check)
Common pitfalls
- Don't re-implement what a
knowledge/*.yamlalready covers — look up instead @tool_classdecorator MUST come after docstring (otherwise Pydantic schema generation skips it)- Avoid f-string SQL for integer bound-params — use f-strings for INTEGER WHERE/LIMIT
- Pure Python stdlib + yaml + Pydantic only — no heavy deps
Related docs
- Design spec: Appendix A (tool inventory)
- Existing tools under
perfxpert/tools/as references