Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
feat: make the file downloadable path configuerable
angrybayblade committed
Jul 21, 2025 at 13:05 UTC
8c69fa1e630d04f683144b38ab28170afd9609b4
3 files changed
+16
-4
python/composio/core/models/_files.py
+2
-1
@@ -157,9 +157,10 @@ class FileDownloadable(BaseModel):
157
158
159
class FileHelper(WithLogger):
160
- def __init__(self, client: HttpClient):
160
+ def __init__(self, client: HttpClient, outdir: t.Optional[str] = None):
161
super().__init__()
162
self._client = client
163
+ self._outdir = Path(outdir or LOCAL_OUTPUT_FILE_DIRECTORY)
164
165
def _file_uploadable(self, schema: t.Dict):
166
if "allOf" in schema:
python/composio/core/models/tools.py
+8
-2
@@ -51,17 +51,23 @@ class Tools(Resource, t.Generic[TProvider]):
51
52
provider: TProvider
53
54
- def __init__(self, client: HttpClient, provider: TProvider):
54
+ def __init__(
55
+ self,
56
+ client: HttpClient,
57
+ provider: TProvider,
58
+ file_download_dir: t.Optional[str] = None,
59
+ ):
60
"""
61
Initialize the tools resource.
62
63
:param client: The client to use for the tools resource.
64
:param provider: The provider to use for the tools resource.
65
+ :param file_download_dir: Output directory for downloadable files
66
"""
67
self._client = client
68
self._custom_tools = CustomTools(client)
69
self._tool_schemas: t.Dict[str, Tool] = {}
64
- self._file_helper = FileHelper(client=self._client)
70
+ self._file_helper = FileHelper(client=self._client, outdir=file_download_dir)
71
72
self.custom_tool = self._custom_tools.register
73
self.provider = provider
python/composio/sdk.py
+6
-1
@@ -29,6 +29,7 @@ class SDKConfig(te.TypedDict):
29
timeout: te.NotRequired[int]
30
max_retries: te.NotRequired[int]
31
allow_tracking: te.NotRequired[bool]
32
+ file_download_dir: te.NotRequired[str]
33
34
35
class Composio(t.Generic[TProvider], WithLogger):
@@ -68,7 +69,11 @@ class Composio(t.Generic[TProvider], WithLogger):
69
max_retries=kwargs.get("max_retries", DEFAULT_MAX_RETRIES),
70
)
71
self.provider = provider
71
- self.tools = Tools(client=self._client, provider=self.provider)
72
+ self.tools = Tools(
73
+ client=self._client,
74
+ provider=self.provider,
75
+ file_download_dir=kwargs.get("file_download_dir"),
76
+ )
77
self.toolkits = Toolkits(client=self._client)
78
self.triggers = Triggers(client=self._client)
79
self.auth_configs = AuthConfigs(client=self._client)