Skip to content

Commit 22dd5d0

Browse files
committed
docs: add comprehensive LangChain integration section to README
- Add detailed LangChain integration examples showing tool conversion and usage - Include CrewAI integration section demonstrating LangChain compatibility - Provide practical code examples for model binding and tool execution - Position section after Meta Tools for logical flow
1 parent 8b6de99 commit 22dd5d0

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,69 @@ execute_tool = meta_tools.get_tool("meta_execute_tool")
4848
result = execute_tool.call(toolName="hris_list_employees", params={"limit": 10})
4949
```
5050

51+
## LangChain Integration
52+
53+
StackOne tools work seamlessly with LangChain, enabling powerful AI agent workflows:
54+
55+
```python
56+
from langchain_openai import ChatOpenAI
57+
from stackone_ai import StackOneToolSet
58+
59+
# Initialize StackOne tools
60+
toolset = StackOneToolSet()
61+
tools = toolset.get_tools("hris_*", account_id="your-account-id")
62+
63+
# Convert to LangChain format
64+
langchain_tools = tools.to_langchain()
65+
66+
# Use with LangChain models
67+
model = ChatOpenAI(model="gpt-4o-mini")
68+
model_with_tools = model.bind_tools(langchain_tools)
69+
70+
# Execute AI-driven tool calls
71+
response = model_with_tools.invoke("Get employee information for ID: emp123")
72+
73+
# Handle tool calls
74+
for tool_call in response.tool_calls:
75+
tool = tools.get_tool(tool_call["name"])
76+
if tool:
77+
result = tool.execute(tool_call["args"])
78+
print(f"Result: {result}")
79+
```
80+
81+
### CrewAI Integration
82+
83+
CrewAI uses LangChain tools natively, making integration seamless:
84+
85+
```python
86+
from crewai import Agent, Crew, Task
87+
from stackone_ai import StackOneToolSet
88+
89+
# Get tools and convert to LangChain format
90+
toolset = StackOneToolSet()
91+
tools = toolset.get_tools("hris_*", account_id="your-account-id")
92+
langchain_tools = tools.to_langchain()
93+
94+
# Create CrewAI agent with StackOne tools
95+
agent = Agent(
96+
role="HR Manager",
97+
goal="Analyze employee data and generate insights",
98+
backstory="Expert in HR analytics and employee management",
99+
tools=langchain_tools,
100+
llm="gpt-4o-mini"
101+
)
102+
103+
# Define task and execute
104+
task = Task(
105+
description="Find all employees in the engineering department",
106+
agent=agent,
107+
expected_output="List of engineering employees with their details"
108+
)
109+
110+
crew = Crew(agents=[agent], tasks=[task])
111+
result = crew.kickoff()
112+
```
113+
51114
## Features
52115

53116
- Unified interface for multiple SaaS tools

0 commit comments

Comments
 (0)