forked from ComposioHQ/composio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlangchain_demo.py
More file actions
35 lines (23 loc) · 761 Bytes
/
Copy pathlangchain_demo.py
File metadata and controls
35 lines (23 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Langchain demo.
"""
from composio_langchain import LangchainProvider
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from composio import Composio
openai_client = ChatOpenAI(model="gpt-5")
def main():
composio = Composio(provider=LangchainProvider())
# Get All the tools
tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
# Define task
task = "Star a repo composiohq/composio on GitHub"
# Define agent
agent = create_agent(
model=openai_client, tools=tools, system_prompt="intelligent composio agent"
)
# Execute task
result = agent.invoke({"messages": [{"role": "user", "content": task}]})
print(result)
if __name__ == "__main__":
main()