Skip to content
Changelog

ApifyTools works with apify-client 3.x, plus YouTube and CSV fixes

November 12, 20261 min read

Agno ApifyTools now works with apify-client 3.x, which a fresh agno[apify] install pulls in. Before, it couldn't register a single Actor with that version. This release also fixes a zero result limit in YouTube search and two reader bugs, in YouTubeReader and FieldLabeledCSVReader. Each fix ran without a key on the earlier release and this one, and the output below is real.

ApifyTools reads apify-client 3.x responses

apify-client 3.x returns Pydantic models where 2.x returned dicts, so the .get("id") calls in ApifyTools raised AttributeError. Agno now converts either shape to a dict before reading the Actor and run IDs. A real 3.x ActorResource went into a MagicMock client, with the build request mocked:

# Before
AttributeError: 'ActorResource' object has no attribute 'get'
 
# Now
build: {'actorDefinition': {'description': 'Crawls websites.'}}

SearchApiTools honors a zero YouTube limit

SearchApiTools.search_youtube(num_results=0) treated zero as unset and returned the toolkit's default count. It now falls back to the default only for None. With a default of 5 and eight videos in a mocked response:

# Before
search_youtube(num_results=0): 5 videos
 
# Now
search_youtube(num_results=0): 0 videos

YouTubeReader.async_read takes a name

Knowledge.ainsert() passes the reader a document name, and YouTubeReader.async_read() took only the URL, so async ingestion of a YouTube video failed. async_read() now accepts name and passes it to read(). A MagicMock stood in for the YouTube transcript API:

# Before
TypeError: YouTubeReader.async_read() got an unexpected keyword argument 'name'
 
# Now
async_read name: Product demo

FieldLabeledCSVReader reads unnamed streams

A SpooledTemporaryFile, which FastAPI's UploadFile.file often is, has a name of None, and a TemporaryFile on Unix has an integer one. FieldLabeledCSVReader called .split(".") on that name, caught the error and returned nothing. It now falls back to csv_file for any name that is not a string.

# Before
SpooledTemporaryFile: 0 documents
 
# Now
SpooledTemporaryFile: 2 documents ['csv_file_row_1', 'csv_file_row_2']

See the Apify tools cookbook, and learn more about Apify, SearchApi, the YouTube reader and the CSV reader in the documentation.

Frequently asked questions

Yes. Agno turns a 3.x Pydantic response into a dict with model_dump(by_alias=True) and passes a 2.x dict through as it is, so both versions give the same keys, such as id and defaultDatasetId. The dependency stays unpinned.

It uses the num_results you set on SearchApiTools. Only an explicit value per call, zero included, overrides it.

It uses csv_file, so document ids read csv_file_row_1, csv_file_row_2 and so on. A name you pass to read() or async_read() still wins.

It logged ERROR Error reading: <tempfile.SpooledTemporaryFile object>: 'NoneType' object has no attribute 'split', and it returned an empty list.

Shipped around the same time