add-tool
Implement function-calling tools in Prompture agents using ToolRegistry, decorators, and automatic schema generation to enable LLM interaction with external code.
Introduction
This skill provides a robust framework for integrating custom callable functions into Prompture-based LLM agents. By leveraging the ToolRegistry and specialized decorators, developers can bridge the gap between large language models and real-world execution environments. This capability is essential for building autonomous agents that need to retrieve live data, perform calculations, or interact with external systems. It simplifies the complexity of manual JSON schema creation by automatically deriving tool definitions from Python type hints and docstrings.
-
Automatically generates ToolDefinitions using the tool_from_function utility, mapping Python types to JSON schema types.
-
Supports flexible registration methods, including the @registry.tool decorator or explicit registry.register() calls for managing tool collections.
-
Provides built-in serialization for multiple LLM providers, including OpenAI, Anthropic, Groq, and Ollama-based models.
-
Facilitates end-to-end conversation integration where the agent autonomously parses tool calls, executes them, and feeds results back to the LLM until a final response is generated.
-
Includes built-in error handling where execution exceptions are caught and passed back to the LLM, allowing for intelligent error recovery.
-
Users should define clear, concise docstrings for every tool, as these are used as the primary descriptions for the LLM to understand when and how to invoke the function.
-
Ensure target drivers support tool use (e.g., check supports_tool_use = True) to enable automated interaction workflows.
-
Return string-based outputs from functions; for structured data, serialize to JSON using json.dumps() to ensure compatibility with LLM processing.
-
Utilize max_tool_rounds in the Conversation constructor to prevent infinite loops and ensure cost-effective tool execution.
-
Always validate tool schemas using unit tests before deployment to ensure the mapping between Python functions and the underlying JSON schema is correct.
Repository Stats
- Stars
- 9
- Forks
- 0
- Open Issues
- 0
- Language
- Python
- Default Branch
- main
- Sync Status
- Idle
- Last Synced
- May 3, 2026, 06:37 PM