-
Notifications
You must be signed in to change notification settings - Fork 5
Add standalone YouTube agent using Agno framework wrapped in Agentuity #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add standalone YouTube agent using Agno framework wrapped in Agentuity #44
Conversation
- Convert Agno YouTube agent from https://docs.agno.com/examples/agents/youtube-agent - Preserve all original Agno framework code and functionality - Wrap in Agentuity structure with welcome() and async run() functions - Follow established framework wrapper patterns from existing examples - Include proper error handling, logging, and response formatting - Set up complete project structure with dependencies and configuration Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
WalkthroughAdds a new standalone YouTube analysis agent project at frameworks/agno/youtube-agent, including packaging, Agentuity config, server startup, Agno-based YouTube agent implementation (async handler + tooling), documentation, editor/gitignore, and development artifacts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Agentuity as Agentuity Runtime
participant Handler as YouTubeAgent.run()
participant Agno as Agno youtube_agent
participant Tools as YouTubeTools
User->>Agentuity: Request (text prompt / URL)
Agentuity->>Handler: AgentRequest
note right of Handler #e6f7ff: Read prompt text\nlog input
Handler->>Handler: Offload to executor
Handler->>Agno: youtube_agent.run(prompt)
Agno->>Tools: Fetch transcripts/metadata
Tools-->>Agno: Video data
Agno-->>Handler: Analysis (string/obj)
Handler->>Handler: Normalize output / fallback if empty
Handler-->>Agentuity: AgentResponse (text)
Agentuity-->>User: Response
sequenceDiagram
autonumber
participant Proc as Process
participant Env as Environment
participant Logger as Logging
participant Autostart as agentuity.autostart()
Proc->>Env: Check AGENTUITY_API_KEY or AGENTUITY_SDK_KEY
alt Missing keys
Proc-->>Proc: Print error and exit(1)
else Keys present
Proc->>Logger: Configure stdout INFO
Proc->>Autostart: autostart()
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (4)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (16)
frameworks/agno/youtube-agent/main.py (1)
1-6: Replace placeholder entrypoint with a helpful CLI message.Avoid confusion by making the entrypoint clearly point to
agentuity dev.def main(): - print("Hello from youtube-agent!") + print("Use `agentuity dev` in this directory to run the YouTube agent (see README).")frameworks/agno/youtube-agent/pyproject.toml (1)
1-10: Add basic metadata for packaging clarity.These fields help tooling and make the project self-describing, even if it’s mainly used via Agentuity.
[project] name = "youtube-agent" version = "0.1.0" description = "YouTube Content Analyzer using Agno framework wrapped in Agentuity" +readme = "README.md" +authors = [{ name = "Agentuity Examples" }] +license = { text = "Apache-2.0" } +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Environment :: Console", + "Intended Audience :: Developers" +] requires-python = ">=3.10, <3.13" dependencies = [ "agentuity>=0.0.87", "agno", "youtube_transcript_api", ]frameworks/agno/youtube-agent/README.md (4)
66-66: Align Python version range with pyproject.Docs say “3.10 or higher”; project constrains to <3.13.
-- **Python**: Version 3.10 or higher +- **Python**: Version 3.10–3.12
103-113: Add language to fenced block.Silences MD040 and improves rendering.
-``` +```text ├── agents/ │ └── YouTubeAgent/ │ ├── agent.py # Agentuity wrapper │ ├── youtube_agent.py # Original Agno agent (preserved) │ └── __init__.py ├── .venv/ # Virtual environment (created by UV) ├── pyproject.toml # Project dependencies and metadata ├── server.py # Server entry point └── agentuity.yaml # Agentuity project configuration--- `6-8`: **Add alt text to the deploy button image.** Satisfies MD045 and improves accessibility. ```diff - <a target="_blank" href="https://app.agentuity.com/deploy" alt="Agentuity"> - <img src="https://app.agentuity.com/img/deploy.svg" /> + <a target="_blank" href="https://app.agentuity.com/deploy" alt="Agentuity"> + <img src="https://app.agentuity.com/img/deploy.svg" alt="Deploy with Agentuity" /> </a>
19-19: Avoid bare URL.Link text improves readability and fixes MD034.
-**Ported from:** https://docs.agno.com/examples/agents/youtube-agent +**Ported from:** [Agno YouTube Agent example](https://docs.agno.com/examples/agents/youtube-agent)frameworks/agno/youtube-agent/.gitignore (1)
104-112: Ignore all env variants and common local tooling cachesReduce risk of committing secrets and local editor config. Add broad .env patterns with an allowlist for examples, plus ruff cache and common IDE folders.
# Environments .env .venv env/ venv/ ENV/ env.bak/ venv.bak/ + +# Environment variants and examples +.env.* +!.env.example + +# Linters & IDEs +.ruff_cache/ +.vscode/ +.idea/ +.devcontainer/ +.DS_Storeframeworks/agno/youtube-agent/server.py (2)
7-17: Fail-fast is good; add optional check for OpenAI key used by the agentSince youtube_agent.py configures OpenAIChat("gpt-4o"), warn early if OPENAI_API_KEY is missing to avoid a later runtime error (unless Agentuity provides a proxy).
if __name__ == "__main__": if not os.environ.get("AGENTUITY_API_KEY") and not os.environ.get( "AGENTUITY_SDK_KEY" ): - print( - "\033[31m[ERROR] AGENTUITY_API_KEY or AGENTUITY_SDK_KEY is not set. This should have been set automatically by the Agentuity CLI or picked up from the .env file.\033[0m" - ) - if os.environ.get("_", "").endswith("uv") and os.path.exists(".env"): - print( - "\033[31m[ERROR] Re-run the command with `uv run --env-file .env server.py`\033[0m" - ) + print("\033[31m[ERROR] AGENTUITY_API_KEY or AGENTUITY_SDK_KEY is not set. This should have been set automatically by the Agentuity CLI or picked up from the .env file.\033[0m") + if os.path.exists(".env"): + print("\033[31m[ERROR] If you are using uv, re-run with: `uv run --env-file .env server.py`\033[0m") sys.exit(1) + + # Heads-up for OpenAI-backed model usage + if not os.environ.get("OPENAI_API_KEY"): + print("\033[33m[WARN] OPENAI_API_KEY is not set. Using OpenAIChat('gpt-4o') will fail unless the platform injects credentials.\033[0m")
19-31: Use logging for warnings; avoid red color for WARN-level guidanceCurrent WARN messages use red (31m). Prefer logging.warning and/or yellow ANSI (33m) if you keep prints. Also initialize logging before emitting warnings to keep output consistent.
-if not os.environ.get("AGENTUITY_URL"): - print( - "\033[31m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\033[0m" - ) - print( - "\033[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of `python script`.\033[0m" - ) - -logging.basicConfig( - stream=sys.stdout, - level=logging.INFO, - format="[%(levelname)-5.5s] %(message)s", -) +logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="[%(levelname)-5.5s] %(message)s") + +if not os.environ.get("AGENTUITY_URL"): + logging.warning("You are running this agent outside of the Agentuity environment. Automatic Agentuity features will be disabled.") + logging.warning("Recommend running `agentuity dev` to run your project locally instead of `python script`.")frameworks/agno/youtube-agent/agents/YouTubeAgent/youtube_agent.py (3)
1-6: Parameterize the model via env; keep hardcoded defaultThis makes switching models (e.g., gpt-4o-mini) trivial without code changes.
-from textwrap import dedent +from textwrap import dedent +import os
7-13: Tweak defaults: env-driven model and quieter tool-call output
- Derive model id from OPENAI_MODEL with "gpt-4o" as default.
- Consider hiding raw tool-call dumps from end users.
youtube_agent = Agent( name="YouTube Agent", - model=OpenAIChat(id="gpt-4o"), + model=OpenAIChat(id=os.getenv("OPENAI_MODEL", "gpt-4o")), tools=[YouTubeTools()], - show_tool_calls=True, + show_tool_calls=False, instructions=dedent(Also applies to: 30-53
12-25: Specify timestamp format explicitly to reduce ambiguityCall out HH:MM:SS to avoid 1:2 vs 01:02 issues and make parsing easier downstream.
- - Format: [start_time, end_time, detailed_summary] + - Format: [HH:MM:SS start, HH:MM:SS end, detailed_summary] + - Use 00:MM:SS for videos under 1 hourframeworks/agno/youtube-agent/agents/YouTubeAgent/agent.py (4)
6-10: welcome() return shape—confirm what the UI expectsSome agents return a plain string; this returns a dict. Verify the Agentuity UI renders this as intended; otherwise return a string.
-def welcome(): - return { - "welcome": "🎬 I'm a YouTube Content Analyzer. Paste any YouTube link and tell me what you need!", - } +def welcome(): + return "🎬 I'm a YouTube Content Analyzer. Paste any YouTube link and tell me what you need!"
11-18: Bridge sync Agno.run via asyncio.to_thread for clarityFunctionally equivalent to run_in_executor(None, ...), but more readable. Also leaves room to pass a timeout with asyncio.wait_for if needed later.
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext): prompt = await request.data.text() context.logger.info(f"[YouTubeAgent] prompt: {prompt!r}") try: - loop = asyncio.get_running_loop() - raw = await loop.run_in_executor(None, lambda: youtube_agent.run(prompt)) + raw = await asyncio.to_thread(youtube_agent.run, prompt)
19-27: Output normalization covers common shapes—add a final safe-castMinor: coerce non-str to string once at the end to avoid branching.
- if isinstance(raw, str): - output = raw - elif hasattr(raw, "content"): - output = raw.content - elif hasattr(raw, "reply"): - output = raw.reply - else: - output = str(raw) + output = ( + raw + if isinstance(raw, str) + else getattr(raw, "content", None) + or getattr(raw, "reply", None) + or str(raw) + )
28-36: Friendlier errors for common YouTube failures; keep generic fallbackMap known transcript/URL issues to actionable messages; keep the broad except for unknown failures. This maintains the “Chill” UX while improving guidance.
- if not output.strip(): + if not output.strip(): context.logger.error("[YouTubeAgent] empty output") return response.text("⚠️ Analyzer produced no content.") return response.text(output) except Exception as exc: - context.logger.error(f"[YouTubeAgent] fatal error: {exc}", exc_info=True) - return response.text("❌ An internal error occurred while analyzing the video.") + msg = str(exc) + context.logger.error(f"[YouTubeAgent] fatal error: {msg}", exc_info=True) + known = ( + "NoTranscriptFound", + "TranscriptsDisabled", + "VideoUnavailable", + "Invalid video ID", + "Could not retrieve a transcript", + ) + if any(k in msg for k in known): + return response.text("⚠️ Unable to fetch a transcript for this video. Try another URL or a video with captions enabled.") + if "Invalid" in msg and "YouTube" in msg: + return response.text("⚠️ That doesn't look like a valid YouTube URL. Please paste a full https://youtube.com/watch?v=... link.") + return response.text("❌ An internal error occurred while analyzing the video.")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (9)
frameworks/agno/youtube-agent/.editorconfig(1 hunks)frameworks/agno/youtube-agent/.gitignore(1 hunks)frameworks/agno/youtube-agent/README.md(1 hunks)frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py(1 hunks)frameworks/agno/youtube-agent/agents/YouTubeAgent/youtube_agent.py(1 hunks)frameworks/agno/youtube-agent/agentuity.yaml(1 hunks)frameworks/agno/youtube-agent/main.py(1 hunks)frameworks/agno/youtube-agent/pyproject.toml(1 hunks)frameworks/agno/youtube-agent/server.py(1 hunks)
🧰 Additional context used
🧠 Learnings (27)
📚 Learning: 2025-05-28T21:02:10.403Z
Learnt from: jhaynie
PR: agentuity/examples#12
File: frameworks/agno/from-agno/pyproject.toml:1-9
Timestamp: 2025-05-28T21:02:10.403Z
Learning: The `agentuity` Python SDK has versions 0.0.87 and higher available on PyPI, and dependency specifications like `agentuity>=0.0.87` in pyproject.toml files are valid and correct for projects using this SDK.
Applied to files:
frameworks/agno/youtube-agent/pyproject.toml
📚 Learning: 2025-07-17T13:41:01.314Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/agno/from_agno/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:41:01.314Z
Learning: Applies to frameworks/agno/from_agno/**/agentuity.yaml : Do not suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/agno/youtube-agent/.editorconfigframeworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:16:16.519Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:16.519Z
Learning: The Agentuity configuration file (agentuity.yaml) is reserved for configuring the AI Agent project and should not be edited or suggested for edits during code review.
Applied to files:
frameworks/agno/youtube-agent/README.mdframeworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:14:18.092Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langchain/basic/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:14:18.092Z
Learning: The file 'agentuity.yaml' is used to configure the Agentuity AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/agno/youtube-agent/README.mdframeworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-05-28T21:02:10.403Z
Learnt from: jhaynie
PR: agentuity/examples#12
File: frameworks/agno/from-agno/pyproject.toml:1-9
Timestamp: 2025-05-28T21:02:10.403Z
Learning: The `agentuity` package is a Python SDK developed by Agentuity Inc., available on PyPI at https://pypi.org/project/agentuity/ with the GitHub repository at https://github.com/agentuity/sdk-py. This is a different package from `agentUniverse` and should not be confused with other agent-related packages.
Applied to files:
frameworks/agno/youtube-agent/README.md
📚 Learning: 2025-06-23T17:16:33.550Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/pydantic/basic/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:33.550Z
Learning: The agentuity.yaml file is a configuration file used by Agentuity to configure the AI Agent project and should not be edited or suggested for edits during code review.
Applied to files:
frameworks/agno/youtube-agent/README.mdframeworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:13:52.368Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/crewai/socialagent/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:13:52.368Z
Learning: The 'agentuity.yaml' file is a configuration file used by Agentuity to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/agno/youtube-agent/README.mdframeworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:15:30.804Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/grokLiveSearch/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:15:30.804Z
Learning: In the context of Agentuity AI projects, the 'agentuity.yaml' file is a configuration file that should not be edited or suggested for edits during code review.
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:15:46.735Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/mem0/mem0demo/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:15:46.735Z
Learning: The Agentuity configuration file (agentuity.yaml) is used to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:17:12.992Z
Learnt from: CR
PR: agentuity/examples#0
File: patterns/llmAsJury/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:17:12.992Z
Learning: In the context of Agentuity AI projects, the agentuity.yaml file is a configuration file that should not be edited or suggested for edits during code review.
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:16:02.063Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai-typescript/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:02.063Z
Learning: The Agentuity AI Configuration file (agentuity.yaml) is used to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:40:40.461Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:40:40.461Z
Learning: Applies to agentuity/sdk-js/streaming/**/agentuity.yaml : Do not suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:39:58.483Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:39:58.483Z
Learning: Applies to agents/deep-research-js/**/agentuity.yaml : Do not suggest edits to the agentuity.yaml configuration file
Applied to files:
frameworks/agno/youtube-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:16:13.875Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:16:13.875Z
Learning: In Agentuity AI Agent Python files (agents/**/*.py), the main entry point should be an async function named `run` that accepts parameters of types AgentRequest, AgentResponse, and AgentContext.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:14:53.981Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/llamaindex/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:14:53.981Z
Learning: When writing Python AI Agent files for the Agentuity platform (in files matching agents/**/*.py), always define an async function named `run` as the entry point.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-07-17T13:41:39.323Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/crewai/socialagent/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:41:39.323Z
Learning: Applies to frameworks/crewai/socialagent/agents/**/*.py : The file should define an async function named `run`
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:16:30.899Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/pydantic/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:16:30.899Z
Learning: In Python agent files under 'agents/**/*.py', always define an async function named 'run' as the entry point for the agent.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:15:43.688Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/mem0/mem0demo/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:15:43.688Z
Learning: When writing Agentuity AI Agents in Python, always define an async function named `run` that serves as the entry point for the agent.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.pyframeworks/agno/youtube-agent/server.py
📚 Learning: 2025-07-17T13:40:58.033Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/agno/from_agno/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:58.033Z
Learning: Applies to frameworks/agno/from_agno/agents/**/*.py : The file should define an async function named `run`
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:15:53.658Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/mem0/mem0demo/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:53.658Z
Learning: In the Agentuity Python SDK, the main entry point for an agent is an async function named 'run' that takes three arguments: request (AgentRequest), response (AgentResponse), and context (AgentContext).
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:16:25.368Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:16:25.368Z
Learning: In the Agentuity Python SDK, the main handler function for an agent should be defined as an async function named 'run' with the signature: async def run(request: AgentRequest, response: AgentResponse, context: AgentContext) -> Any.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:14:03.437Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/crewai/socialagent/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:14:03.437Z
Learning: In the Agentuity Python SDK, the main agent handler should be an async function named 'run' that accepts 'request: AgentRequest', 'response: AgentResponse', and 'context: AgentContext' as arguments.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:16:43.214Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/pydantic/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:16:43.214Z
Learning: In the Agentuity Python SDK, the main handler for an agent is an async function named 'run' that takes 'request', 'response', and 'context' as parameters.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:14:31.499Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langchain/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:14:31.499Z
Learning: In the Agentuity Python SDK, the main agent handler should be an async function named 'run' that accepts 'request: AgentRequest', 'response: AgentResponse', and 'context: AgentContext' as parameters.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-06-23T17:15:05.904Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/llamaindex/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:05.904Z
Learning: In the Agentuity Python SDK, the main agent handler function should be defined as an async function named 'run' that accepts 'request' (AgentRequest), 'response' (AgentResponse), and 'context' (AgentContext) as parameters.
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-07-17T13:40:30.298Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/tavily_agent/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:40:30.298Z
Learning: Applies to agents/tavily_agent/agents/**/*.py : The main handler function for an agent should be defined as an async function named 'run' with parameters (request: AgentRequest, response: AgentResponse, context: AgentContext)
Applied to files:
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py
📚 Learning: 2025-07-17T13:40:30.298Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/tavily_agent/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:40:30.298Z
Learning: Applies to agents/tavily_agent/agents/**/*.py : Import types from 'agentuity' when using Agentuity SDK types
Applied to files:
frameworks/agno/youtube-agent/server.py
🪛 LanguageTool
frameworks/agno/youtube-agent/README.md
[grammar] ~11-~11: There might be a mistake here.
Context: ...iv> # 🎬 YouTube Content Analyzer Agent ## 🔗 Agno Framework Integration This proj...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...eploy) ## 🔗 Agno Framework Integration This project demonstrates how to seamles...
(QB_NEW_EN)
[grammar] ~21-~21: There might be a mistake here.
Context: ...outube-agent ## 🎯 What This Agent Does This intelligent YouTube content analyze...
(QB_NEW_EN)
[grammar] ~27-~27: There might be a mistake here.
Context: ...s video length, type, and basic metadata - Smart Timestamps: Creates precise, mea...
(QB_NEW_EN)
[grammar] ~28-~28: There might be a mistake here.
Context: ..., meaningful timestamps for key segments - Content Organization: Groups related s...
(QB_NEW_EN)
[grammar] ~29-~29: There might be a mistake here.
Context: ...ated segments and identifies main themes - Comprehensive Analysis: Provides detai...
(QB_NEW_EN)
[grammar] ~34-~34: There might be a mistake here.
Context: ... "Analyze this tech review: [video_url]" - "Get timestamps for this coding tutorial...
(QB_NEW_EN)
[grammar] ~35-~35: There might be a mistake here.
Context: ...s for this coding tutorial: [video_url]" - "Break down the key points of this lectu...
(QB_NEW_EN)
[grammar] ~36-~36: There might be a mistake here.
Context: ...key points of this lecture: [video_url]" - "Summarize the main topics in this docum...
(QB_NEW_EN)
[grammar] ~37-~37: There might be a mistake here.
Context: ...topics in this documentary: [video_url]" - "Create a study guide from this educatio...
(QB_NEW_EN)
[grammar] ~40-~40: There might be a mistake here.
Context: ... video: [video_url]" ## 🚀 How It Works With just a simple wrapper function, you...
(QB_NEW_EN)
[grammar] ~62-~62: There might be a mistake here.
Context: ...aling capabilities. ## 📋 Prerequisites Before you begin, ensure you have the fo...
(QB_NEW_EN)
[grammar] ~66-~66: There might be a mistake here.
Context: ...d: - Python: Version 3.10 or higher - UV: Version 0.5.25 or higher ([Documen...
(QB_NEW_EN)
[grammar] ~69-~69: There might be a mistake here.
Context: ...s.astral.sh/uv/)) ## 🚀 Getting Started ### Authentication Before using Agentuity, ...
(QB_NEW_EN)
[grammar] ~91-~91: There might be a mistake here.
Context: ...ur agent in real-time. ## 🌐 Deployment When you're ready to deploy your agent t...
(QB_NEW_EN)
[grammar] ~101-~101: There might be a mistake here.
Context: ...tuity platform. ## 📚 Project Structure ├── agents/ │ └── YouTubeAgent/ │ ├── agent.py # Agentuity wrapper │ ├── youtube_agent.py # Original Agno agent (preserved) │ └── __init__.py ├── .venv/ # Virtual environment (created by UV) ├── pyproject.toml # Project dependencies and metadata ├── server.py # Server entry point └── agentuity.yaml # Agentuity project configuration ## 🔧 Configuration Your project configura...
(QB_NEW_EN)
[grammar] ~115-~115: There might be a mistake here.
Context: ...t configuration ``` ## 🔧 Configuration Your project configuration is stored in ...
(QB_NEW_EN)
[grammar] ~119-~119: There might be a mistake here.
Context: ...nt configuration. ## 🛠️ Advanced Usage ### Environment Variables You can set envir...
(QB_NEW_EN)
[grammar] ~137-~137: There might be a mistake here.
Context: ...ecret KEY VALUE ``` ## 📖 Documentation For comprehensive documentation on the A...
(QB_NEW_EN)
[grammar] ~139-~139: There might be a mistake here.
Context: ...tion on the Agentuity Python SDK, visit: [https://agentuity.dev/SDKs/python](http...
(QB_NEW_EN)
[grammar] ~142-~142: There might be a mistake here.
Context: ....dev/SDKs/python) ## 🆘 Troubleshooting If you encounter any issues: 1. Check t...
(QB_NEW_EN)
[grammar] ~150-~150: There might be a mistake here.
Context: ...he Agentuity support team ## 📝 License This project is licensed under the terms...
(QB_NEW_EN)
🪛 markdownlint-cli2 (0.17.2)
frameworks/agno/youtube-agent/README.md
6-6: Images should have alternate text (alt text)
(MD045, no-alt-text)
19-19: Bare URL used
(MD034, no-bare-urls)
103-103: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (7)
frameworks/agno/youtube-agent/.editorconfig (1)
1-15: LGTM.Settings align with repo conventions; Python override (4 spaces) looks good.
frameworks/agno/youtube-agent/pyproject.toml (1)
6-10: Sanity-check transitive runtime dependencies
This plugin’s pyproject lists onlyagentuity,agno, andyoutube_transcript_api; verify thatagno.models.openaiandagno.tools.youtubedon’t introduce missing deps (e.g.openai,yt-dlp) and add them here if they aren’t already declared in the agno package.frameworks/agno/youtube-agent/agentuity.yaml (1)
1-63: LGTM: agentuity.yaml is consistent with the project layout and bundler settings.frameworks/agno/youtube-agent/.gitignore (1)
1-133: Solid .gitignore baseline for a Python projectCovers common build/test/editor artifacts and uv.lock. No blockers.
frameworks/agno/youtube-agent/server.py (1)
33-33: Startup path looks correctautostart() behind the main guard is consistent with other Agentuity examples.
frameworks/agno/youtube-agent/agents/YouTubeAgent/agent.py (2)
1-5: Correct SDK types and module import pathImports align with Agentuity SDK guidance and preserved Agno agent location. Good.
11-13: No changes needed for request/response usage
request.data.text()must be awaited (as you’ve done), and in the Python SDKresponse.text(...)is a synchronous setter—noawaitrequired.
| ```python | ||
| from agentuity import AgentRequest, AgentResponse, AgentContext | ||
| from agents.YouTubeAgent.youtube_agent import youtube_agent | ||
|
|
||
| # Agentuity handler - wraps the original Agno YouTube agent | ||
| async def run(request: AgentRequest, response: AgentResponse, context: AgentContext): | ||
| # Get user input from Agentuity | ||
| prompt = await request.data.text() | ||
|
|
||
| # Run the original Agno YouTube agent | ||
| raw = await loop.run_in_executor(None, lambda: youtube_agent.run(prompt)) | ||
|
|
||
| # Return response through Agentuity | ||
| return response.text(output) | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix broken example: undefined loop and output.
Current snippet won’t run copy-paste. Minimal fixes below.
```python
+import asyncio
from agentuity import AgentRequest, AgentResponse, AgentContext
from agents.YouTubeAgent.youtube_agent import youtube_agent
# Agentuity handler - wraps the original Agno YouTube agent
async def run(request: AgentRequest, response: AgentResponse, context: AgentContext):
# Get user input from Agentuity
prompt = await request.data.text()
# Run the original Agno YouTube agent
- raw = await loop.run_in_executor(None, lambda: youtube_agent.run(prompt))
+ loop = asyncio.get_running_loop()
+ raw = await loop.run_in_executor(None, lambda: youtube_agent.run(prompt))
+ output = raw if isinstance(raw, str) else getattr(raw, "text", str(raw))
# Return response through Agentuity
- return response.text(output)
+ return response.text(output) # If AgentResponse.text is async, use: `return await response.text(output)`
<details>
<summary>🤖 Prompt for AI Agents</summary>
In frameworks/agno/youtube-agent/README.md around lines 44 to 58, the example
references undefined variables loop and output; fix by importing asyncio at
top, obtain the running event loop via asyncio.get_running_loop() before using
run_in_executor, capture the executor result into raw, convert raw into a
string response by using output = raw if isinstance(raw, str) else getattr(raw, "text", str(raw)), then return the response via response.text(output) and if
AgentResponse.text is an async method, await it (i.e., return await
response.text(output)).
</details>
<!-- fingerprinting:phantom:poseidon:chinchilla -->
<!-- This is an auto-generated comment by CodeRabbit -->
|
Closing due to inactivity for more than 30 days. Configure here. |
Add standalone YouTube agent using Agno framework wrapped in Agentuity
Summary
This PR adds a new standalone YouTube Content Analyzer agent that wraps the Agno YouTube agent within Agentuity's framework structure. The implementation preserves all original Agno framework code while providing an Agentuity-compatible wrapper for deployment and scaling.
Key Changes:
frameworks/agno/youtube-agent/following established patternswelcome()and asyncrun()functionsArchitecture:
youtube_agent.py: Original Agno agent code (unchanged)agent.py: Agentuity wrapper with error handling and response normalizationReview & Testing Checklist for Human
🔴 High Priority (3 items)
agentuity devand test with actual YouTube URLs to verify the agent works correctly and produces meaningful analysispyproject.toml(especiallyagnoandyoutube_transcript_api)run_in_executorcorrectly handles Agno agent responses and the output normalization logic works for all response typesTest Plan Recommendation
cd frameworks/agno/youtube-agent && agentuity devNotes
frameworks/agno/from_agno/exampleSummary by CodeRabbit
New Features
Documentation
Chores
Style