Kgentik SDK for multi-framework tool resolution and agent development
Project description
Kgentik SDK
Seamless tool resolution and agent development for the Kgentik platform.
Installation
For local development:
pip install kgentik
Note: In deployed environments, the SDK is automatically injected and no installation is required.
Quick Start
The KgentikTools wrapper automatically detects and loads tools from your kgentik.yaml configuration:
from kgentik.tools import KgentikTools
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
# Initialize tools - automatically reads from kgentik.yaml
kgentik_tools = KgentikTools()
tools = kgentik_tools.get_tools()
# Create your agent
model = ChatOpenAI(model="gpt-4o-mini")
agent = create_react_agent(model, tools)
Configuration
Define your tools in kgentik.yaml:
tools:
- name: "csv_parser"
source: "local"
file: "tools/csv_parser.py"
description: "Parse CSV data"
- name: "web-scraper"
source: "community"
description: "Scrape web pages"
- name: "email-sender"
source: "team"
description: "Send emails"
Tool Sources
local: Tools you develop locally in thetools/directoryteam: Tools shared within your teamcommunity: Public tools from the community
How It Works
Local Development
- Place your
kgentik.yamlin your project root - Create local tools in the
tools/directory - Use
KgentikTools()to automatically load all configured tools - Same code works when deployed!
Deployed Environment
- Platform automatically injects the SDK during deployment
- Local tools are packaged alongside your agent
- Team/community tools are fetched and made available
KgentikTools()resolves all tools seamlessly
Examples
Basic Usage
from kgentik.tools import KgentikTools
# Auto-detects kgentik.yaml and loads all tools
tools = KgentikTools().get_tools()
Custom Config Path
from kgentik.tools import KgentikTools
# Specify custom config path
tools = KgentikTools(config_path="./custom-config.yaml").get_tools()
LangGraph Integration
from kgentik.tools import KgentikTools
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI
kgentik_tools = KgentikTools()
tools = kgentik_tools.get_tools()
model = ChatOpenAI(model="gpt-4o-mini")
agent = create_react_agent(model, tools)
# Use your agent
result = agent.invoke({"messages": [("user", "Hello!")]})
Custom Agent Implementation
from kgentik.tools import KgentikTools
from langgraph.graph import StateGraph, START
from langgraph.prebuilt import ToolNode
from langchain_openai import ChatOpenAI
# Load tools
kgentik_tools = KgentikTools()
tools = kgentik_tools.get_tools()
# Create custom workflow
workflow = StateGraph(State)
workflow.add_node("agent", call_model)
workflow.add_node("tools", ToolNode(tools))
workflow.add_edge(START, "agent")
workflow.add_conditional_edges("agent", should_continue)
app = workflow.compile()
Error Handling
The SDK provides clear error messages for common issues:
# Missing kgentik.yaml
FileNotFoundError: No kgentik.yaml found. Please ensure you're in a Kgentik project directory or provide a config_path.
# Missing tool file
FileNotFoundError: Tool file not found: /path/to/tools/missing_tool.py
# Invalid tool source
ValueError: Unknown tool source: invalid_source
Troubleshooting
Tool Not Found
- Check that your tool is defined in
kgentik.yaml - Verify the
filepath is correct for local tools - Ensure the tool function is properly exported
Import Errors
- Make sure you're in a Kgentik project directory
- Verify
kgentik.yamlexists in current or parent directory - Check that required dependencies are installed
Deployment Issues
- Ensure your agent uses
KgentikTools()(not manual imports) - Verify all tools are properly configured in
kgentik.yaml - Check that team/community tools exist and are accessible
Future Roadmap
Planned Features
- CLI Tools:
kgentik deploy,kgentik test,kgentik init - Testing Utilities: Built-in testing framework for agents
- Deployment Helpers: Streamlined deployment process
- Multi-Framework Support: Enhanced support for LlamaIndex, CrewAI, etc.
- Tool Validation: Type checking and validation for tools
- Hot Reloading: Development mode with automatic reloading
Contributing
The SDK is part of the Kgentik platform. For contributions and issues, please visit our GitHub repository.
License
MIT License - see LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kgentik-0.1.3.tar.gz.
File metadata
- Download URL: kgentik-0.1.3.tar.gz
- Upload date:
- Size: 79.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8371fd338037fd05b3d77bc6178bd5bbe75818702be7bccd0e9df78a1c23e222
|
|
| MD5 |
3ea926e8003e75f6466a84f64495e988
|
|
| BLAKE2b-256 |
ebc9e72a5a93db8b9bf25467f10aaec090f1e83cda7a9461fec7a1c617efeb6e
|
File details
Details for the file kgentik-0.1.3-py3-none-any.whl.
File metadata
- Download URL: kgentik-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
727e96183a7581b6d9b8f2b3a815b8744a1a594cbae2ac70e7c1991b02c49aba
|
|
| MD5 |
b4e677f1a6874d08dd7cf50ac3198218
|
|
| BLAKE2b-256 |
14260fe88448a11b2122bd3193532312975c76df2f5295b763d5844d97ff1377
|