Skip to content
Changelog

Linear, Discord and ModelsLab tools stop waiting on a hung server

November 17, 20261 min read

Agno's LinearTools, DiscordTools and ModelsLabTools now take a timeout and apply it to every request, so a server that never answers can no longer freeze an agent run. Linear and Discord default to 30 seconds, and ModelsLab defaults to 120. Earlier releases waited on a stalled server indefinitely.

from agno.tools.discord import DiscordTools
from agno.tools.linear import LinearTools
from agno.tools.models_labs import ModelsLabTools
 
tools = [LinearTools(timeout=10), DiscordTools(timeout=10), ModelsLabTools(timeout=60)]

With wait_for_completion=True, ModelsLabTools polls ModelsLab until the media is ready. Each poll now gets only the time left before the wait ends, so a stalled poll can no longer stretch the wait past max_wait_time.

We pointed each toolkit at a local socket that accepts connections and never replies, a stand-in for a stalled API, and stopped watching after 10 seconds. DiscordTools ran with timeout=2, and the ModelsLab poll ran with max_wait_time=4.

# Before
DiscordTools.get_channel_info: still waiting after 10s
ModelsLabTools._wait_for_media: still waiting after 10s
# Now
DiscordTools.get_channel_info: returned after 2.0s -> Error getting channel info: ... Read timed out. (read timeout=2)
ModelsLabTools._wait_for_media: returned after 4.0s -> False

See the cookbook, and learn more about LinearTools, DiscordTools and ModelsLabTools in the documentation.

Frequently asked questions

No. The base Toolkit accepted timeout= and stored it, but LinearTools, DiscordTools and ModelsLabTools never handed it to requests. With timeout=2 against a server that never replies, each call was still waiting when the test stopped watching at 10 seconds.

Both stop after the timeout. LinearTools.get_user_details raised ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=55605): Read timed out. (read timeout=2) after 2.0 seconds, and ModelsLabTools.generate_media returned Error: Network error while generating mp4: HTTPConnectionPool(host='127.0.0.1', port=55605): Read timed out. (read timeout=2) after 2.0 seconds.

The ModelsLab generation request can hold the connection open while it renders the media, so it gets a longer default than Linear and Discord. Pass your own timeout to change it.

Shipped around the same time