Build AI agents with StackOne tools and LangChain framework
Build AI agents using LangChain’s framework with direct access to business data through StackOne’s infrastructure of pre-built tools, RPC orchestration, and MCP/A2A interfaces.
ReAct and OpenAI Functions agents with business tool access
Multi-step workflow automation
Conversational agents with memory
Advanced error handling and resilience
Copy
Ask AI
from stackone_ai import StackOneToolSetfrom langchain_openai import ChatOpenAIdef create_agent_for_account(account_id: str): """ Create LangChain agent with tools for a specific account. In production, account_id comes from: - User/tenant context - Authentication middleware - Request parameters """ # Initialize toolset toolset = StackOneToolSet() # Fetch tools dynamically for this account tools = toolset.fetch_tools(account_ids=[account_id]) langchain_tools = tools.to_langchain() # Create model with tools model = ChatOpenAI(model="gpt-5-mini") model_with_tools = model.bind_tools(langchain_tools) return model_with_tools, tools# Usage: Get account from user contextaccount_id = get_current_user_account() # Your functionmodel, tools = create_agent_for_account(account_id)# Use the agentresponse = model.invoke("List all employees in engineering")# Handle tool executionfor tool_call in response.tool_calls: tool = tools.get_tool(tool_call["name"]) if tool: result = tool.execute(tool_call["args"]) print(f"Result: {result}")