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-cli add github 

# Check all supported apps 
composio-cli show-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
toolset = ComposioToolset()

# Register the GitHub app with the right settings
composio_tools = toolset.get_tools(tools=[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=composio_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 SamparkAI/composio_sdk?"

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_tools.handle_tool_calls(response)

print(response.messages)
5

Check Response

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

Use Specific Actions

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

Use Specific Apps

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

Filter apps actions by tags

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