composio-langgraph 0.7.19__tar.gz → 1.0.0rc6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of composio-langgraph might be problematic. Click here for more details.
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/PKG-INFO +6 -12
- composio_langgraph-1.0.0rc6/composio_langgraph/__init__.py +3 -0
- composio_langgraph-1.0.0rc6/composio_langgraph/provider.py +93 -0
- composio_langgraph-1.0.0rc6/composio_langgraph/py.typed +0 -0
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/PKG-INFO +6 -12
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/SOURCES.txt +3 -1
- composio_langgraph-1.0.0rc6/composio_langgraph.egg-info/requires.txt +1 -0
- composio_langgraph-1.0.0rc6/pyproject.toml +20 -0
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/setup.py +4 -8
- composio_langgraph-0.7.19/composio_langgraph/__init__.py +0 -14
- composio_langgraph-0.7.19/composio_langgraph/toolset.py +0 -96
- composio_langgraph-0.7.19/composio_langgraph.egg-info/requires.txt +0 -2
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/README.md +0 -0
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/dependency_links.txt +0 -0
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/top_level.txt +0 -0
- {composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/setup.cfg +0 -0
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Use Composio to get array of tools with LangGraph Agent Workflows
|
|
2
|
+
Name: composio-langgraph
|
|
3
|
+
Version: 1.0.0rc6
|
|
4
|
+
Summary: Use Composio to get array of tools with LangGraph Agent Workflows.
|
|
5
5
|
Home-page: https://github.com/ComposioHQ/composio
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: composio
|
|
7
|
+
Author-email: Composio <tech@composio.dev>
|
|
8
|
+
Project-URL: Homepage, https://github.com/ComposioHQ/composio
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
11
|
Classifier: Operating System :: OS Independent
|
|
11
12
|
Requires-Python: >=3.9,<4
|
|
12
13
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: composio_langchain<0.8.0,>=0.5.0
|
|
14
14
|
Requires-Dist: langgraph
|
|
15
15
|
Dynamic: author
|
|
16
|
-
Dynamic: author-email
|
|
17
|
-
Dynamic: classifier
|
|
18
|
-
Dynamic: description
|
|
19
|
-
Dynamic: description-content-type
|
|
20
16
|
Dynamic: home-page
|
|
21
|
-
Dynamic: requires-dist
|
|
22
17
|
Dynamic: requires-python
|
|
23
|
-
Dynamic: summary
|
|
24
18
|
|
|
25
19
|
## 🦜🕸️ Using Composio With LangGraph
|
|
26
20
|
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""ComposioLangChain class definition"""
|
|
2
|
+
|
|
3
|
+
import types
|
|
4
|
+
import typing as t
|
|
5
|
+
from inspect import Signature
|
|
6
|
+
|
|
7
|
+
import pydantic
|
|
8
|
+
from langchain_core.tools import StructuredTool as BaseStructuredTool
|
|
9
|
+
|
|
10
|
+
from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
|
|
11
|
+
from composio.types import Tool
|
|
12
|
+
from composio.utils.pydantic import parse_pydantic_error
|
|
13
|
+
from composio.utils.shared import (
|
|
14
|
+
get_signature_format_from_schema_params,
|
|
15
|
+
json_schema_to_model,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class StructuredTool(BaseStructuredTool):
|
|
20
|
+
def run(self, *args, **kwargs):
|
|
21
|
+
try:
|
|
22
|
+
return super().run(*args, **kwargs)
|
|
23
|
+
except pydantic.ValidationError as e:
|
|
24
|
+
return {"successful": False, "error": parse_pydantic_error(e), "data": None}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class LanggraphProvider(
|
|
28
|
+
AgenticProvider[StructuredTool, t.List[StructuredTool]],
|
|
29
|
+
name="langgraph",
|
|
30
|
+
):
|
|
31
|
+
"""
|
|
32
|
+
Composio toolset for Langchain framework.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def _wrap_action(
|
|
36
|
+
self,
|
|
37
|
+
tool: str,
|
|
38
|
+
description: str,
|
|
39
|
+
schema_params: t.Dict,
|
|
40
|
+
execute_tool: AgenticProviderExecuteFn,
|
|
41
|
+
):
|
|
42
|
+
def function(**kwargs: t.Any) -> t.Dict:
|
|
43
|
+
"""Wrapper function for composio action."""
|
|
44
|
+
return execute_tool(tool, kwargs)
|
|
45
|
+
|
|
46
|
+
action_func = types.FunctionType(
|
|
47
|
+
function.__code__,
|
|
48
|
+
globals=globals(),
|
|
49
|
+
name=tool,
|
|
50
|
+
closure=function.__closure__,
|
|
51
|
+
)
|
|
52
|
+
action_func.__signature__ = Signature( # type: ignore
|
|
53
|
+
parameters=get_signature_format_from_schema_params(
|
|
54
|
+
schema_params=schema_params
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
action_func.__doc__ = description
|
|
58
|
+
return action_func
|
|
59
|
+
|
|
60
|
+
def wrap_tool(
|
|
61
|
+
self, tool: Tool, execute_tool: AgenticProviderExecuteFn
|
|
62
|
+
) -> StructuredTool:
|
|
63
|
+
"""Wraps composio tool as Langchain StructuredTool object."""
|
|
64
|
+
return t.cast(
|
|
65
|
+
StructuredTool,
|
|
66
|
+
StructuredTool.from_function(
|
|
67
|
+
name=tool.slug,
|
|
68
|
+
description=tool.description,
|
|
69
|
+
args_schema=json_schema_to_model(
|
|
70
|
+
json_schema=tool.input_parameters,
|
|
71
|
+
skip_default=True, # make configurable
|
|
72
|
+
),
|
|
73
|
+
return_schema=True,
|
|
74
|
+
func=self._wrap_action(
|
|
75
|
+
tool=tool.slug,
|
|
76
|
+
description=tool.description,
|
|
77
|
+
schema_params=tool.input_parameters,
|
|
78
|
+
execute_tool=execute_tool,
|
|
79
|
+
),
|
|
80
|
+
handle_tool_error=True,
|
|
81
|
+
handle_validation_error=True,
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
def wrap_tools(
|
|
86
|
+
self,
|
|
87
|
+
tools: t.Sequence[Tool],
|
|
88
|
+
execute_tool: AgenticProviderExecuteFn,
|
|
89
|
+
) -> t.List[StructuredTool]:
|
|
90
|
+
"""
|
|
91
|
+
Get composio tools wrapped as Langchain StructuredTool objects.
|
|
92
|
+
"""
|
|
93
|
+
return [self.wrap_tool(tool=tool, execute_tool=execute_tool) for tool in tools]
|
|
File without changes
|
{composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/PKG-INFO
RENAMED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
|
-
Name:
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Use Composio to get array of tools with LangGraph Agent Workflows
|
|
2
|
+
Name: composio-langgraph
|
|
3
|
+
Version: 1.0.0rc6
|
|
4
|
+
Summary: Use Composio to get array of tools with LangGraph Agent Workflows.
|
|
5
5
|
Home-page: https://github.com/ComposioHQ/composio
|
|
6
|
-
Author:
|
|
7
|
-
Author-email:
|
|
6
|
+
Author: composio
|
|
7
|
+
Author-email: Composio <tech@composio.dev>
|
|
8
|
+
Project-URL: Homepage, https://github.com/ComposioHQ/composio
|
|
8
9
|
Classifier: Programming Language :: Python :: 3
|
|
9
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
11
|
Classifier: Operating System :: OS Independent
|
|
11
12
|
Requires-Python: >=3.9,<4
|
|
12
13
|
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: composio_langchain<0.8.0,>=0.5.0
|
|
14
14
|
Requires-Dist: langgraph
|
|
15
15
|
Dynamic: author
|
|
16
|
-
Dynamic: author-email
|
|
17
|
-
Dynamic: classifier
|
|
18
|
-
Dynamic: description
|
|
19
|
-
Dynamic: description-content-type
|
|
20
16
|
Dynamic: home-page
|
|
21
|
-
Dynamic: requires-dist
|
|
22
17
|
Dynamic: requires-python
|
|
23
|
-
Dynamic: summary
|
|
24
18
|
|
|
25
19
|
## 🦜🕸️ Using Composio With LangGraph
|
|
26
20
|
|
{composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/SOURCES.txt
RENAMED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
README.md
|
|
2
|
+
pyproject.toml
|
|
2
3
|
setup.py
|
|
3
4
|
composio_langgraph/__init__.py
|
|
4
|
-
composio_langgraph/
|
|
5
|
+
composio_langgraph/provider.py
|
|
6
|
+
composio_langgraph/py.typed
|
|
5
7
|
composio_langgraph.egg-info/PKG-INFO
|
|
6
8
|
composio_langgraph.egg-info/SOURCES.txt
|
|
7
9
|
composio_langgraph.egg-info/dependency_links.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
langgraph
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "composio-langgraph"
|
|
3
|
+
version = "1.0.0-rc6"
|
|
4
|
+
description = "Use Composio to get array of tools with LangGraph Agent Workflows."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.9,<4"
|
|
7
|
+
authors = [
|
|
8
|
+
{ name = "Composio", email = "tech@composio.dev" }
|
|
9
|
+
]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"License :: OSI Approved :: Apache Software License",
|
|
13
|
+
"Operating System :: OS Independent",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"langgraph",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://github.com/ComposioHQ/composio"
|
|
@@ -6,12 +6,11 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from setuptools import setup
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
setup(
|
|
11
10
|
name="composio_langgraph",
|
|
12
|
-
version="0.
|
|
13
|
-
author="
|
|
14
|
-
author_email="
|
|
11
|
+
version="1.0.0-rc6",
|
|
12
|
+
author="composio",
|
|
13
|
+
author_email="tech@composio.dev",
|
|
15
14
|
description="Use Composio to get array of tools with LangGraph Agent Workflows",
|
|
16
15
|
long_description=(Path(__file__).parent / "README.md").read_text(encoding="utf-8"),
|
|
17
16
|
long_description_content_type="text/markdown",
|
|
@@ -22,9 +21,6 @@ setup(
|
|
|
22
21
|
"Operating System :: OS Independent",
|
|
23
22
|
],
|
|
24
23
|
python_requires=">=3.9,<4",
|
|
25
|
-
install_requires=[
|
|
26
|
-
"composio_langchain>=0.5.0,<0.8.0",
|
|
27
|
-
"langgraph",
|
|
28
|
-
],
|
|
24
|
+
install_requires=["langgraph"],
|
|
29
25
|
include_package_data=True,
|
|
30
26
|
)
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
from composio_langchain import ComposioToolSet as BaseComposioToolSet
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ComposioToolSet(
|
|
5
|
-
BaseComposioToolSet,
|
|
6
|
-
runtime="langgraph",
|
|
7
|
-
description_char_limit=1024,
|
|
8
|
-
action_name_char_limit=64,
|
|
9
|
-
):
|
|
10
|
-
"""
|
|
11
|
-
Composio toolset for LangGraph framework.
|
|
12
|
-
|
|
13
|
-
Example:
|
|
14
|
-
```python
|
|
15
|
-
import json
|
|
16
|
-
import operator
|
|
17
|
-
from typing import Annotated, TypedDict, Sequence
|
|
18
|
-
|
|
19
|
-
from langchain_openai import ChatOpenAI
|
|
20
|
-
from langchain_core.utils.function_calling import convert_to_openai_function
|
|
21
|
-
from langchain_core.messages import BaseMessage, HumanMessage, FunctionMessage
|
|
22
|
-
|
|
23
|
-
from langgraph.graph import StateGraph, END
|
|
24
|
-
from langgraph.prebuilt import ToolInvocation, ToolExecutor
|
|
25
|
-
from composio_langgraph import Action, ComposioToolSet
|
|
26
|
-
|
|
27
|
-
composio_toolset = ComposioToolSet()
|
|
28
|
-
tools = composio_toolset.get_actions(
|
|
29
|
-
actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
|
|
30
|
-
)
|
|
31
|
-
tool_executor = ToolExecutor(tools)
|
|
32
|
-
functions = [convert_to_openai_function(t) for t in tools]
|
|
33
|
-
|
|
34
|
-
model = ChatOpenAI(temperature=0, streaming=True)
|
|
35
|
-
model = model.bind_functions(functions)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def function_1(state):
|
|
39
|
-
messages = state['messages']
|
|
40
|
-
response = model.invoke(messages)
|
|
41
|
-
return {"messages": [response]}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def function_2(state):
|
|
45
|
-
messages = state['messages']
|
|
46
|
-
last_message = messages[-1]
|
|
47
|
-
parsed_function_call = last_message.additional_kwargs["function_call"]
|
|
48
|
-
|
|
49
|
-
action = ToolInvocation(
|
|
50
|
-
tool=parsed_function_call["name"],
|
|
51
|
-
tool_input=json.loads(parsed_function_call["arguments"]),
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
# We call the tool_executor and get back a response
|
|
55
|
-
response = tool_executor.invoke(action)
|
|
56
|
-
|
|
57
|
-
# We use the response to create a FunctionMessage
|
|
58
|
-
function_message = FunctionMessage(
|
|
59
|
-
content=str(response),
|
|
60
|
-
name=action.tool
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
return {"messages": [function_message]}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def where_to_go(state):
|
|
67
|
-
messages = state['messages']
|
|
68
|
-
last_message = messages[-1]
|
|
69
|
-
|
|
70
|
-
if "function_call" in last_message.additional_kwargs:
|
|
71
|
-
return "continue"
|
|
72
|
-
else:
|
|
73
|
-
return "end"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class AgentState(TypedDict):
|
|
77
|
-
messages: Annotated[Sequence[BaseMessage], operator.add]
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
workflow = StateGraph(AgentState)
|
|
81
|
-
workflow.add_node("agent", function_1)
|
|
82
|
-
workflow.add_node("tool", function_2)
|
|
83
|
-
workflow.add_conditional_edges(
|
|
84
|
-
"agent",
|
|
85
|
-
where_to_go,
|
|
86
|
-
{
|
|
87
|
-
"continue": "tool",
|
|
88
|
-
"end": END
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
workflow.add_edge('tool', 'agent')
|
|
92
|
-
workflow.set_entry_point("agent")
|
|
93
|
-
|
|
94
|
-
app = workflow.compile()
|
|
95
|
-
```
|
|
96
|
-
"""
|
|
File without changes
|
|
File without changes
|
{composio_langgraph-0.7.19 → composio_langgraph-1.0.0rc6}/composio_langgraph.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|