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.

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.

from julep import Client
from composio_julep import ComposioToolSet, App
import os

julep_api_key = "{julep_api_key}" # Replace it
julep_client = Client(api_key=julep_api_key)

2

Configure Julep Agent with Composio Tools

# Initialise the Composio Tool Set
composio_toolset = ComposioToolSet()

# Register the GitHub app with the right settings

tools = composio_toolset.get_tools(apps=[App.GITHUB])

# Create and configure the Julep agent

agent = julep_client.agents.create(
name="Jessica",
about="Tech entrepreneur with a focus on sustainability and AI.",
default_settings={
"temperature": 0.7,
"top_p": 1,
"min_p": 0.01,
"presence_penalty": 0,
"frequency_penalty": 0,
"length_penalty": 1.0,
"max_tokens": 150
},
model="gpt-4-turbo",
tools=tools,
)

3

Execute the Task via Julep Agent

about = """
Sam, a software developer, is passionate about impactful tech.
At the tech fair, he seeks investors and collaborators for his project.
"""
user = julep_client.users.create(
    name="Sam",
    about=about,
)

situation_prompt = "You are at a tech fair seeking innovative projects."
session = julep_client.sessions.create(user_id=user.id, agent_id=agent.id, situation=situation_prompt)

user_msg = "Could you star the GitHub repository composiohq/composio?"

response = julep_client.sessions.chat(
    session_id=session.id,
    messages=[
        {"role": "user", "content": user_msg, "name": "Sam"}
    ],
    recall=True,
    remember=True
)
4

Handle all the Tool calls

response = composio_toolset.handle_tool_calls(response)

print(response.messages)
5

Check Response

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

Use Specific Actions

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

Use Specific Apps

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

Filter apps actions by tags

actions = toolset.get_tools(apps=[App.ASANA], tags=[Tag.ASANA_TASKS])