Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## Unreleased

### Changed

- **Bumped `colony-sdk` floor to `>=1.5.0`.** All retry logic, error formatting, and rate-limit handling now lives in the SDK rather than being duplicated here.
- **`RetryConfig` is now re-exported from `colony_sdk`.** `from crewai_colony import RetryConfig` keeps working unchanged, but the implementation is the SDK's `RetryConfig` (which adds a `retry_on` field for tuning *which* status codes get retried — defaults to `{429, 502, 503, 504}`).
- **Retries are now performed inside the SDK client**, not by the tool wrapper. `ColonyToolkit(retry=...)` hands the config straight to `ColonyClient(retry=...)`. The SDK honours the server's `Retry-After` header automatically and retries 5xx gateway errors (`502/503/504`) by default in addition to `429`.

### Removed

- **`crewai_colony.tools._is_retryable`**, **`_RETRYABLE_STATUSES`**, and **`_STATUS_HINTS`** — duplicated SDK 1.5.0 internals. The tool layer now catches `colony_sdk.ColonyAPIError` (whose `str()` already contains the human-readable hint and the server's `detail` field) and prepends `Error (status) [code] —`.
- **Per-tool `retry` constructor argument** — was unused after the retry loop moved into the SDK. Tools no longer accept a `retry=` kwarg.

### Behaviour notes

- The default retry budget is now **2 retries (3 total attempts)** instead of 3 — this matches `colony-sdk`'s default. Pass `RetryConfig(max_retries=3)` to restore the old number.
- Connection errors (DNS failure, connection refused, raw timeouts) are no longer retried by the tool layer. The SDK raises them as `ColonyNetworkError(status=0)` immediately. If you need transport-level retries, wrap the tool call in your own backoff loop or supply a custom transport at the SDK layer.
- `ColonyRateLimitError.retry_after` is now exposed on the exception instance — useful for higher-level backoff above the SDK's built-in retries.

## 0.5.0 — 2026-04-08

### New features
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"colony-sdk>=1.4.0",
"colony-sdk>=1.5.0",
"crewai>=0.80.0",
]

Expand Down
13 changes: 9 additions & 4 deletions src/crewai_colony/toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import functools
from typing import Any

from colony_sdk import ColonyClient
from colony_sdk import ColonyClient, RetryConfig
from crewai.tools import BaseTool

from crewai_colony.tools import ALL_TOOLS, READ_TOOLS, RetryConfig
from crewai_colony.tools import ALL_TOOLS, READ_TOOLS


def _fire(callbacks: list[Any], event: str, **kwargs: Any) -> None:
Expand Down Expand Up @@ -69,7 +69,13 @@ def __init__(
callbacks: list[Any] | None = None,
retry: RetryConfig | None = None,
) -> None:
self.client = ColonyClient(api_key, base_url=base_url)
# Retry policy (max attempts, backoff, Retry-After handling, which
# status codes to retry on) is enforced inside the SDK client itself —
# we just hand it through at construction time.
client_kwargs: dict[str, Any] = {"base_url": base_url}
if retry is not None:
client_kwargs["retry"] = retry
self.client = ColonyClient(api_key, **client_kwargs)
self.read_only = read_only
self.callbacks = callbacks or []
self.retry = retry
Expand All @@ -95,7 +101,6 @@ def get_tools(
tool = cls( # type: ignore[call-arg]
client=self.client,
callbacks=self.callbacks,
retry=self.retry,
)
if include and tool.name not in include:
continue
Expand Down
Loading
Loading