Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add agents/cubeplexai/cubepi/tool-usegit clone --depth 1 https://github.com/cubeplexai/cubepiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/cubeplexai/cubepi/tool-use)<a href="https://agentmods.dev/agents/cubeplexai/cubepi/tool-use"><img src="https://agentmods.dev/badge/agents/cubeplexai/cubepi/tool-use.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00023 | $0.02880 |
| Opus 5 | $0.00012 | $0.01440 |
| Sonnet 5 | $0.00005 | $0.00576 |
| Haiku 4.5 | $0.00002 | $0.00288 |
Grade A, and why
tool-use scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 339 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Tool Use & Parallel Execution
Tools are how an agent acts on the world. CubePi turns each AgentTool
into a JSON Schema for the model, validates arguments with Pydantic,
runs the work, and feeds the result back as a ToolResultMessage. By
default tools run in parallel when the model calls more than one in a
single turn.
The @tool decorator
The quickest way to define a tool is to decorate an async function. CubePi
generates the input schema from the parameters, so there's no separate model
or boilerplate execute signature to write:
from typing import Annotated
from pydantic import Field
from cubepi import tool
@tool
async def search(
query: Annotated[str, Field(description="The natural-language query")],
limit: Annotated[int, Field(ge=1, le=100)] = 10,
) -> str:
"Search the internal knowledge base."
results = await my_search_backend(query, limit)
return "\n".join(results)
That's a complete, registrable AgentTool. The decorator infers:
- name from the function name (override with
@tool(name=...)); - description from the docstring (override with
@tool(description=...)); - the input schema from the typed parameters —
Field(...)defaults and metadata are honoured exactly as in a hand-written model.
The return value can be a plain str (wrapped as text, as above), a
TextContent, a list of content, or a full AgentToolResult when you need
details, is_error, or terminate:
from cubepi import tool, AgentToolResult, TextContent
@tool
async def search(query: str, limit: int = 10) -> AgentToolResult:
"Search the internal knowledge base."
results = await my_search_backend(query, limit)
return AgentToolResult(
content=[TextContent(text="\n".join(results))],
details={"raw_results": results}, # passes through to ToolResultMessage.details
)
To run a tool sequentially, pass @tool(execution_mode="sequential"). If the
function needs the loop-supplied arguments, just declare them — any of
tool_call_id, signal, or on_update are injected when present and never
appear in the schema:
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 339 lines · 23 tokens per session scan A da6b61b93253
tool-use is an agent published in the GitHub repository cubeplexai/cubepi (46 stars, last pushed 3d ago), licensed MIT. It adds 23 tokens to every session and 2,880 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other agents, from other repositories
llm-integrator
LLM integration: OpenAI/Anthropic/Ollama APIs, prompt templates, function calling, streaming, token cost optimization.
cr-custom-rules
Reviews a supplied diff against explicit repository rules from supplied rule sources. Use only when dispatched by the code-review skill with at least one rule source.
cr-security
Reviews a supplied diff for introduced, practically exploitable security vulnerabilities. Use only when dispatched by the code-review skill.
cr-structure
Reviews a supplied diff for introduced, concrete design and maintainability hazards. Use only when dispatched by the code-review skill.
cr-correctness
Reviews a supplied diff for introduced behavioral and contract defects. Use only when dispatched by the code-review skill.
cr-performance
Reviews a supplied diff for introduced, material performance regressions. Use only when dispatched by the code-review skill.