Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update base toolset testcases #1206

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/examples_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ jobs:
LISTENNOTES_API_KEY: ${{secrets.LISTENNOTES_API_KEY}}
COMPOSIO_API_KEY: ${{ inputs.api_key || secrets.COMPOSIO_API_KEY_RELEASE }}
COMPOSIO_BASE_URL: 'https://backend.composio.dev'
HELICONE_API_KEY: ${{secrets.HELICONE_API_KEY}}
run: |
pnpm exec jest tests/test_examples.test.js
- name: Slack Notification on Failure
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/run_examples_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ on:
workflow_dispatch:
pull_request:
paths:
- '**/*.js'
- '**/*.ts'
- "js/examples/**"
push:
branches:
- master
paths:
- '**/*.js'
- '**/*.ts'
- "js/examples/**"

jobs:
test-examples:
uses: ./.github/workflows/examples_js.yml
with:
working-directory: ./js
secrets: inherit
secrets: inherit
139 changes: 139 additions & 0 deletions docs/cryptokit/coinbase_agent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: "Coinbase Wallet Manager Agent"
sidebarTitle: "Coinbase Wallet Manager Agent"
description: "This project demonstrates how to use Composio to create a Coinbase Wallet Manager Agent."
---

## Overview

The Coinbase Wallet Manager Agent is an AI Agent that allows your agent to create wallets, send tokens, check balances, and more using Coinbase.

## Getting Started

<Tabs>
<Tab title="Python">
<Steps>
<Step title="Installation">
```bash install dependencies
pip install composio-llamaindex python-dotenv
```
</Step>

<Step title="Connecting to tools and models">
```bash connect to required tools
composio add coinbase

export OPENAI_API_KEY="<your-openai-api-key>"
```
</Step>

<Step title="Importing the required libraries">
```python import required libraries
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv
import json
import os

```
</Step>

<Step title="Initializing the Tools and the LLM">
```python initialize toolset and llm
toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(actions=[
Action.COINBASE_CREATE_WALLET,
Action.COINBASE_LIST_WALLETS,
Action.COINBASE_GET_WALLET_INFO,
Action.COINBASE_SEND_TOKENS,
Action.COINBASE_CHECK_TRANSFER,
Action.COINBASE_COINBASE_FAUCET,
Action.FILETOOL_CREATE_FILE,
Action.FILETOOL_WRITE
])


llm = OpenAI(model="gpt-4o")
```
</Step>

<Step title="Setting up Function Calling Worker">
```python setup function calling worker
prefix_messages = [
ChatMessage(
role="system",
content=(
"You are a coinbase agent that can execute coinbase actions"
),
)
]

agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
).as_agent()
```
</Step>

<Step title="Executing the Agent">
```python run the agent
agent.chat("Create a coinbase wallet, write the wallet address, seed and wallet id in a file called wallet.txt and get its balance")
```
</Step>

<Step title='Final Code'>
```python final code
from composio_llamaindex import ComposioToolSet, App, Action
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.llms import ChatMessage
from llama_index.llms.openai import OpenAI
from dotenv import load_dotenv

load_dotenv()

toolset = ComposioToolSet(api_key="")
tools = toolset.get_tools(actions=[
Action.COINBASE_CREATE_WALLET,
Action.COINBASE_LIST_WALLETS,
Action.COINBASE_GET_WALLET_INFO,
Action.COINBASE_SEND_TOKENS,
Action.COINBASE_CHECK_TRANSFER,
Action.COINBASE_COINBASE_FAUCET,
Action.FILETOOL_CREATE_FILE,
Action.FILETOOL_WRITE
])

llm = OpenAI(model="gpt-4o")

prefix_messages = [
ChatMessage(
role="system",
content=(
"You are a coinbase agent that can execute actions on Coinbase"
),
)
]

agent = FunctionCallingAgentWorker(
tools=tools,
llm=llm,
prefix_messages=prefix_messages,
max_function_calls=10,
allow_parallel_tool_calls=False,
verbose=True,
).as_agent()


response = agent.chat("Create a coinbase wallet, write the wallet address, seed and wallet id in a file called wallet.txt and get its balance")
print(response)
```
</Step>
</Steps>
</Tab>
</Tabs>
Loading
Loading