Skip to content

Commit fe16a1b

Browse files
authored
Python goat-sdk 0.1.1: Support async tool calling (#211)
Support async tool calling
1 parent 684e74e commit fe16a1b

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

python/pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ readme = "README.md"
77
keywords = ["goat", "sdk", "web3", "agents", "ai"]
88
homepage = "https://ohmygoat.dev/"
99
repository = "https://github.com/goat-sdk/goat"
10+
package-mode = false
1011

1112
[tool.poetry.dependencies]
1213
python = "^3.12"
1314
pydantic = "^2.10.0"
15+
goat-sdk = { path = "src/goat-sdk/" }
16+
goat-sdk-plugin-coingecko = { path = "src/plugins/coingecko/" }
17+
goat-sdk-plugin-erc20 = { path = "src/plugins/erc20/" }
18+
goat-sdk-wallet-web3 = { path = "src/wallets/web3/" }
19+
goat-sdk-adapter-langchain = { path = "src/adapters/langchain/" }
1420

1521
[tool.poetry.group.test.dependencies]
1622
pytest = "^8.3.4"
@@ -30,12 +36,6 @@ asyncio_default_fixture_loop_scope = "function"
3036
requires = ["poetry-core"]
3137
build-backend = "poetry.core.masonry.api"
3238

33-
[tool.poetry.group.dev.dependencies]
34-
ruff = "^0.8.6"
35-
goat-sdk = { path = "src/goat-sdk/", develop = true }
36-
goat-sdk-plugin-coingecko = { path = "src/plugins/coingecko/", develop = true }
37-
goat-sdk-plugin-erc20 = { path = "src/plugins/erc20/", develop = true }
38-
3939
[tool.ruff]
4040
line-length = 120
4141
target-version = "py312"

python/src/goat-sdk/goat/classes/plugin_base.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import asyncio
2+
import inspect
13
from abc import ABC, abstractmethod
24
from typing import List, Any, TypeVar, Generic
35

@@ -112,4 +114,8 @@ def _execute_tool(
112114
args[parameters_index - 1] = params
113115

114116
method = getattr(tool_provider, tool_metadata.target.__name__)
115-
return method(*args)
117+
result = method(*args)
118+
119+
if inspect.iscoroutine(result):
120+
return asyncio.get_event_loop().run_until_complete(result)
121+
return result

python/src/goat-sdk/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "goat-sdk"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
description = "Goat 🐐 (Great Onchain Agent Toolkit) is an open-source framework for connecting AI agents to any onchain app"
55
authors = ["Andrea Villa <[email protected]>"]
66
readme = "README.md"
@@ -14,6 +14,7 @@ packages = [
1414
[tool.poetry.dependencies]
1515
python = "^3.10"
1616
pydantic = "^2.10.0"
17+
asyncio = "^3.4.1"
1718

1819
[tool.poetry.group.test.dependencies]
1920
pytest = "^8.3.4"

0 commit comments

Comments
 (0)