Using Composio With Letta

Star A Repository on GitHub

In this example, we will use Letta Agent to star a repository on GitHub using Composio Tools

1

Install Packages

$pip install letta-client composio_langchain
2

Import Libraries & Configure Client

1from letta_client import Letta
2from composio_langchain import Action, ComposioToolSet, App
3
4client = Letta(base_url="http://localhost:8283")
3

Connect Your GitHub Account

You need to have an active GitHub Integration. Learn how to do this here
$composio login
>composio add github
4

Add GitHub action to Client

Adding tools to the client

1tool = client.tools.add_composio_tool(composio_action_name=Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER.name)
5

Create the agent

1agent = client.agents.create(
2 name="GitHub Agent",
3 memory_blocks=[
4 {"label": "persona", "value": "I am a helpful assistant"}
5 ],
6 model="openai/gpt-4o",
7 embedding="openai/text-embedding-ada-002",
8 tool_ids=[tool.id]
9)
6

Execute the Agent

1response = client.agents.messages.create(
2 agent_id=agent.id,
3 messages=[
4 {
5 "role": "user",
6 "content": "Star the github repo composioHQ/composio/"
7 }
8 ]
9)
10for message in response.messages:
11 print(message)
Built with