Composio enables your PraisonAI agents to connect with many tools!

Goal: Star a repository on GitHub with natural language & PraisonAI Agent

Install Packages & Connect a Tool

These commands prepare your environment for seamless interaction between PraisonAI and GitHub.

pip install PraisonAI -q
pip install composio-praisonai
# login to composio
composio login
# Connect your GitHub using command below, so agents can use it. 
composio add github
# Check all different apps which you can connect with
composio apps

Goal: Use PraisonAI Agent to Interact with Github using Composio

1

Import Base Packages

Prepare your environment by initializing necessary imports from PraisonAI and setting up your client.

import os
import yaml
from praisonai import PraisonAI

from composio_praisonai import Action, ComposioToolSet
2

Write the Praison-supported Composio Tools in `tools.py` file.

This step involves fetching and integrating GitHub tools provided by Composio, and writing them in PraisonAI supported Format, returning the name of tools in a format, that should be added to agents.yml file.

composio_toolset = ComposioToolSet()
tools = composio_toolset.get_tools(
    actions=[Action.GITHUB_ACTIVITY_STAR_REPO_FOR_AUTHENTICATED_USER]
)
tool_section_str = composio_toolset.get_tools_section(tools)
print(tool_section_str)
3

Define the `agents.yml` either in a separate file, or in your script.

This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.

agent_yaml = """
framework: "crewai"
topic: "Github Management"

roles:
  developer:
    role: "Developer"
    goal: "An expert programmer"
    backstory: "A developer exploring new codebases and having certain tools available to execute different tasks."
    tasks:
      star_github:
        description: "Star a repo composiohq/composio on GitHub"
        expected_output: "Response whether the task was executed."
""" + tool_section_str

print(agent_yaml)
4

Run the PraisonAI Agents to execute the goal/task.

Here you initialize PraisonAI class, and execute.

# Create a PraisonAI instance with the agent_yaml content
praison_ai = PraisonAI(agent_yaml=agent_yaml)

# Run PraisonAI
result = praison_ai.main()

# Print the result
print(result)