zact-tools
v1.0.3
Published
The go‑to npm toolkit for LLM-powered actions.
Maintainers
Readme
Zact — The Standard Library for LLM Actions
Zact equips your LLM agents with real-world capabilities via ready-to-use tools — with zero boilerplate.
What Is Zact?
Zact is an NPM package offering a library of predefined tools (or "actions") that can be invoked by LLMs such as OpenAI's GPT, Anthropic Claude, or local models via function-calling or tool-use APIs.
Each tool includes:
- A real function (
run) to execute the action (e.g., get weather, send email) - A JSON schema for structured input
- Compatibility with OpenAI and other function-calling interfaces
Installation
npm install zactQuick Example (OpenAI GPT-4 Function Calling)
import { tools, providers } from "zact";
const response = await providers.openai.callLLMWithTools({
prompt: "What's the weather like in Nairobi, Kenya?",
tools: [tools.getWeather],
model: "gpt-4-0613",
apiKey: process.env.OPENAI_API_KEY
});
console.log(response.result);Zact handles the function call logic — the model simply chooses the right tool and parameters.
Built-in Tools
| Tool | Description |
| ------------- | -------------------------------------- |
| getWeather | Get current temperature for a location |
| emailSender | (Coming soon) Send email via API/SMTP |
| webSearcher | (Coming soon) Perform a web search |
| clipboard | (Planned) Copy text to clipboard |
| ... | Additional tools on the way |
Tool Structure
Each tool is defined using registerTool() and includes:
name— the tool identifierdescription— visible to the LLMparameters— a JSON schema defining inputrun(args)— the logic to execute
Example (tools/getWeather.ts):
export const getWeather = registerTool({
name: "getWeather",
description: "Get the current temperature for a given location.",
parameters: {
type: "object",
properties: {
location: {
type: "string",
description: "City and country, e.g., Paris, France"
}
},
required: ["location"],
additionalProperties: false
},
run: async ({ location }) => {
// Fetch lat/lon and call weather API
return `The temperature in ${location} is 27°C`;
}
});Supported Providers
Currently supported:
- OpenAI (
callLLMWithTools) — supportsfunctions[]interface
Planned:
- Anthropic Claude (
tool_useAPI) - Local models (e.g., LLaMA) via prompt parsing
Add Your Own Tools
Define a new tool using registerTool:
export const sayHello = registerTool({
name: "sayHello",
description: "Say hello to someone",
parameters: {
type: "object",
properties: {
name: { type: "string" }
},
required: ["name"]
},
run: async ({ name }) => `Hello, ${name}!`
});Then register and export it from index.ts.
Why Zact?
| Feature | Benefit | | ---------------------- | --------------------------------- | | Prebuilt tools | Skip repetitive schema + logic | | Minimal setup | One-liner integration | | Multi-model support | Compatible with various LLMs | | Extensible | Add and share your own tools |
Pitch Line
Zact: Plug-and-play tools for your AI agents.
Auto-generated schemas, real-world functions — minimal effort.
Contributing
Contributions are welcome!
- Fork the repository
- Add your tool in
tools/ - Export it in
index.ts - Write a test (if possible)
- Submit a PR
License
MIT — free to use, modify, and distribute.
