# Fixes for YouTubeTools, PerplexitySearch, PubmedTools and InMemoryDb

> Agno's YouTubeTools reads video ids from Shorts, live, mobile, music and privacy-enhanced links, PerplexitySearch and PubmedTools send an explicit max_results=0, and InMemoryDb stores its own copy of each user memory.

- Published: 2026-10-19
- Author: Yash Raj Pandey
- Categories: Changelog
- Canonical: https://www.agno.com/blog/fixes-for-youtubetools-perplexitysearch-pubmedtools-and-inmemorydb
- Markdown: https://www.agno.com/blog/fixes-for-youtubetools-perplexitysearch-pubmedtools-and-inmemorydb.md

Agno fixes `YouTubeTools`, `PerplexitySearch`, `PubmedTools` and `InMemoryDb` in this release. Each block below shows real output from the previous release and this one, with mocks in place of the YouTube, Perplexity and PubMed HTTP calls.

### `YouTubeTools` reads Shorts, live and mobile links

`get_youtube_video_id` accepted only `youtube.com`, `www.youtube.com` and `youtu.be`, and on YouTube only the `/watch`, `/embed/` and `/v/` paths. A Shorts link pasted into a chat came back as `No video ID found`. The parser now adds `/shorts/` and `/live/`, the mobile, music and privacy-enhanced hosts, the `youtube.com.br` and `youtube.co.uk` hosts, and links typed without a scheme:

```text
URL                                                  Before   Now
https://www.youtube.com/shorts/BGQWPY4IigY           None     'BGQWPY4IigY'
https://www.youtube.com/live/BGQWPY4IigY             None     'BGQWPY4IigY'
https://m.youtube.com/watch?v=BGQWPY4IigY            None     'BGQWPY4IigY'
https://music.youtube.com/watch?v=BGQWPY4IigY        None     'BGQWPY4IigY'
https://www.youtube-nocookie.com/embed/BGQWPY4IigY   None     'BGQWPY4IigY'
youtu.be/BGQWPY4IigY                                 None     'BGQWPY4IigY'
```

A link with an empty id, such as `https://youtu.be/`, used to yield an empty string. `get_youtube_video_captions` passed it to the transcript API and `get_youtube_video_data` asked oEmbed about `watch?v=`. All three tools now stop at `No video ID found`:

```text
get_youtube_video_data("https://youtu.be/")
Before: requests https://www.youtube.com/oembed?format=json&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D
Now:    'No video ID found', no request

get_youtube_video_captions("https://youtu.be/")
Before: YouTubeTranscriptApi().fetch('')
Now:    'No video ID found', no request
```

### `PerplexitySearch` and `PubmedTools` keep `max_results=0`

`PerplexitySearch.search`, `PerplexitySearch.asearch` and `PubmedTools.search_pubmed` read `max_results or self.max_results`. Python treats `0` as false, so an explicit `0` quietly became the toolkit default. They now fall back only when `max_results` is `None`:

```text
Call                                                          Before      Now
PerplexitySearch(max_results=5).search(q, max_results=0)      sends 5     sends 0
PerplexitySearch(max_results=5).asearch(q, max_results=0)     sends 5     sends 0
PubmedTools(max_results=3).search_pubmed(q, max_results=0)    retmax=3    retmax=0
```

### `InMemoryDb` keeps its own copy of a memory

`InMemoryDb.upsert_user_memory` stored the dict from `UserMemory.to_dict()`, which shares the caller's `topics` list. Editing the `UserMemory` after the upsert rewrote the stored memory and every topic listing, with no second write. The upsert now stores a deep copy on both the insert and the update path, and `upsert_memories` inherits it:

```python
db = InMemoryDb()
memory = UserMemory(memory_id="m1", user_id="alice", memory="Alice ships agents on Fridays", topics=["agents"])
db.upsert_user_memory(memory)
memory.topics.append("unsaved")

db.get_all_memory_topics(user_id="alice")
# Before: ['agents', 'unsaved']
# Now:    ['agents']
```

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/youtube_tools.py), and learn more about [YouTubeTools](https://docs.agno.com/tools/toolkits/others/youtube), [Perplexity](https://docs.agno.com/tools/toolkits/search/perplexity), [PubMed](https://docs.agno.com/tools/toolkits/search/pubmed) and [in-memory storage](https://docs.agno.com/database/providers/in-memory/overview) in the documentation.
