Python
Get started with dynamic tool discovery and execution in Python
from stackone_ai import StackOneToolSet # Initialize the toolset toolset = StackOneToolSet() # Get tools for your account all_tools = toolset.get_tools("*", account_id="your_account_id") # Get meta tools for dynamic discovery meta_tools = all_tools.meta_tools() # Search for relevant tools search_tool = meta_tools.get_tool("meta_search_tools") result = search_tool.call( query="manage employees create update list", limit=5, minScore=0.3 ) print("Found tools:") for tool in result.get("tools", []): print(f"- {tool['name']} (score: {tool['score']:.2f})") # Execute a discovered tool execute_tool = meta_tools.get_tool("meta_execute_tool") if result.get("tools"): best_tool = result["tools"][0] execution_result = execute_tool.call( tool_name=best_tool["name"], params={"limit": 10} ) print(f"Result: {execution_result}")
search_tool = meta_tools.get_tool("meta_search_tools") result = search_tool.call( query="employee time off management", limit=3, minScore=0.4 )
execute_tool = meta_tools.get_tool("meta_execute_tool") result = execute_tool.call( tool_name="hris_list_employees", params={"department": "engineering", "limit": 20} )
from langchain_openai import ChatOpenAI # Convert to LangChain tools langchain_tools = meta_tools.to_langchain() model = ChatOpenAI(model="gpt-4o-mini") model_with_tools = model.bind_tools(langchain_tools) response = model_with_tools.invoke( "Find employee management tools and list recent hires" )
from crewai import Agent # Convert to CrewAI tools crewai_tools = meta_tools.to_crewai() hr_agent = Agent( role="HR Assistant", goal="Help with employee management tasks", tools=crewai_tools, verbose=True )
Was this page helpful?