Using Composio With Julep

Composio and Julep together empower your agents to interact effectively with various external applications!

Install Packages & Connect a Tool

Goal: Allow agents to interact with GitHub projects, like starring a repository using natural language & Julep Agent

These commands set up your environment to enable smooth interactions between Julep and GitHub.

Run Command
$pip install composio-julep
>
># Connect your GitHub so agents can interact with it
>
>composio add github
>
># Check all supported apps
>
>composio apps
1

Import Base Packages & Create Default Julep Agent

Replace julep_api_key with actual API key.

Default Imports & Configuration
1from julep import Client
2from composio_julep import ComposioToolSet, App
3import os
4
5julep_api_key = "{julep_api_key}" # Replace it
6julep_client = Client(api_key=julep_api_key)
2

Configure Julep Agent with Composio Tools

Agent Configuration
1# Initialise the Composio Tool Set
2composio_toolset = ComposioToolSet()
3
4# Register the GitHub app with the right settings
5
6tools = composio_toolset.get_tools(apps=[App.GITHUB])
7
8# Create and configure the Julep agent
9
10agent = julep_client.agents.create(
11name="Jessica",
12about="Tech entrepreneur with a focus on sustainability and AI.",
13default_settings={
14"temperature": 0.7,
15"top_p": 1,
16"min_p": 0.01,
17"presence_penalty": 0,
18"frequency_penalty": 0,
19"length_penalty": 1.0,
20"max_tokens": 150
21},
22model="gpt-4-turbo",
23tools=tools,
24)
3

Execute the Task via Julep Agent

Julep Agent Executes the Task
1about = """
2Sam, a software developer, is passionate about impactful tech.
3At the tech fair, he seeks investors and collaborators for his project.
4"""
5user = julep_client.users.create(
6 name="Sam",
7 about=about,
8)
9
10situation_prompt = "You are at a tech fair seeking innovative projects."
11session = julep_client.sessions.create(user_id=user.id, agent_id=agent.id, situation=situation_prompt)
12
13user_msg = "Could you star the GitHub repository composiohq/composio?"
14
15response = julep_client.sessions.chat(
16 session_id=session.id,
17 messages=[
18 {"role": "user", "content": user_msg, "name": "Sam"}
19 ],
20 recall=True,
21 remember=True
22)
4

Handle all the Tool calls

Handle Tool Call
1response = composio_toolset.handle_tool_calls(response)
2
3print(response.messages)
5

Check Response

Check Agent Response
$[{'content': 'I have starred the repository "composio" for you on GitHub under the account "composiohq".', 'role': 'agent'}]

Use Specific Actions

Filter Specific Action
1# To restrict agents from executing any actions, filter specific actions
2actions = composio_toolset.get_tools(actions=[Action.GITHUB_CREATE_ISSUE])

Use Specific Apps

Filter Specific App
1# To restrict agents from using all tools, filter specific tools
2actions = composio_toolset.get_tools(apps=[App.ASANA, App.GITHUB])

Filter apps actions by tags

Filter Actions by Tags
1actions = toolset.get_tools(apps=[App.ASANA], tags=[Tag.ASANA_TASKS])
Built with