API Documentation
Setup
Submit Jobs
Finetuning
Job Management
File Management
Custom Tools
Overview
Python SDK Reference
End to End example
GET
List custom tools
GET
Get a custom tool
POST
Create a custom tool
PATCH
Update a custom tool
DELETE
Delete a custom tool
POST
Create a source upload
POST
Build a custom tool
GET
List build logs
POST
Cancel a custom tool build
POST
Run a custom tool
POST
Publish a custom tool version
GET
List custom tool versions
Pipelines
Custom Tools: End to End example
Create a tool, validate and package its source, upload it, wait for the build to finish, and publish that version. Install tamarind-cli>=0.3.0, set TAMARIND_API_KEY, and run the script beside your source folder.
1import os
2import uuid
3
4from tamarind import Tamarind
5
6TOOL_NAME = os.environ.get(
7 "TAMARIND_CUSTOM_TOOL_NAME", f"my-custom-tool-{uuid.uuid4().hex[:12]}"
8)
9SOURCE_DIR = "./my-custom-tool"
10
11
12def show_event(event):
13 print(event.message)
14
15
16with Tamarind(
17 api_key=os.environ["TAMARIND_API_KEY"],
18 api_base=os.environ.get("TAMARIND_API_BASE", "https://app.tamarind.bio/api/"),
19) as client:
20 print(f"Creating a new tool named {TOOL_NAME}")
21 tool = client.custom_tools.create(TOOL_NAME, display_name="My Custom Tool")
22
23 report = tool.validate(SOURCE_DIR)
24 if not report.valid:
25 for problem in report.errors:
26 print(f"{problem.path}: {problem.message}")
27 raise SystemExit("Fix the source validation errors before building")
28
29 build = tool.build(SOURCE_DIR, source_timeout=180.0)
30 print(f"{build.action}: {build.version.version}")
31 version = build.version.monitor(timeout=1800, interval=2.0, on_event=show_event)
32 if version.status != "Complete":
33 raise RuntimeError(f"Build ended with {version.status}: {version.error}")
34
35 # Optional: test version.version with /submit-job before publishing (see below).
36 published_tool = version.publish()
37 print(f"Published {published_tool.name} {published_tool.default_version}")