Key Concepts
- Agentic RAG (Retrieval Augmented Generation): Equipping an agent with a toolkit, particularly RAG, for accessing live data and grounding it in verifiable facts.
- Agent as a Tool: Creating a specialist agent whose sole purpose is to execute code and then wrapping it as a tool for the main agent.
- Model Context Protocol (MCP): A universal plug for AI tools that allows agents to connect to heavy and specialized standalone services.
- Function Tool: A simple, stateless, and direct way to give an agent a new capability by turning a regular Python function into a tool using a decorator.
- Authenticated Function Tool: A secure tool that incorporates authentication logic directly into the function and uses the tool context to check the session state.
- Open API Tool Set: A feature that allows an AI agent to become API-aware by automatically discovering and generating tools for each endpoint based on the Open API specification.
- Langchain Tool Wrapper: A tool that allows developers to reuse their existing Langchain tools with the new ADK.
- Long Running Function Tool: A specialized tool designed for asynchronous jobs that might take seconds, minutes, or even hours, preventing the entire agent from blocking.
Open Source Models Optimized for Agentic Tasks
- Kim K2 (Moonshot AI): Excels at complex autonomous tool use and can execute multi-step jobs without intervention. Suitable for building highly independent agents that handle sophisticated workflows. Demonstrated running 16 consecutive Python commands to analyze data.
- Quen 3 (Alibaba): Offers direct control over the reasoning process through hybrid thinking modes ("think" for detailed step-by-step logic, "no think" for instant answers). Provides multilingual support, covering over 100 languages, making it ideal for global applications.
Google DeepMind's Genai Processors
- Purpose: Simplifies building complex realtime and multimodal AI applications.
- Core Concept: Processor: Modular building blocks for specific tasks (e.g., capturing audio, calling a model).
- Pipeline Creation: Sophisticated pipelines are built by chaining processors together with a simple operator (e.g., input processor + model processor + output processor).
- Asynchronous Logic Handling: The library automatically handles asynchronous logic in the background, simplifying concurrency management for developers.
Google Apps' Opel
- Purpose: A no-code tool designed to allow anyone to build and share AI mini-apps.
- Core Concept: Workflow: Users describe the series of steps they want the AI to take using natural language.
- Visual Workflow Generation: Opel translates the natural language description into a visual workflow (like a flowchart) with blocks for prompts, model calls, and other tools.
- Customization: Users can edit the visual workflow by dragging blocks around or using plain English to add steps.
Building Custom Tools: Finn Wise Example
- Goal: To build an agent that can handle a complex multi-step request from a user in just one goal.
- Prompt Example: "Analyze my portfolio's performance over the last year and plot its growth against the S&P 500. Then using my aggressive risk profile, recommend an optimized allocation. Once you have a recommendation, what's the current price of the top new stock in that list? If I approve, buy 10 shares of it."
Agent as a Tool: Code Execution
- Problem: How to allow the agent to analyze and plot historical data (an open-ended request).
- Solution: Create a specialist agent with a built-in code execution tool.
- Implementation:
- Create an LLM agent and give it the built-in code executor.
- Instruct the specialist agent to be a Python financial data analyst and specify the required output.
- Wrap the specialist agent using the
agent toolclass in ADK. - Add the new agent tool to the main agent's list of tools.
Standalone Service with MCP: Portfolio Optimization
- Problem: How to handle the computationally heavy task of recommending an optimized allocation using a Monte Carlo simulation.
- Solution: Build the optimizer as a standalone service using the Model Context Protocol (MCP).
- Implementation:
- Create a separate server for the optimizer.
- Implement a
list toolsfunction with the@app.list toolsdecorator to advertise the server's capabilities. - Use the ADK utility to convert the internal optimizer tool into the standard MCP format.
- On the agent side, use the
MCP tool setclass to manage the connection to the server. - Set the
connection paramsto the command (e.g., Python 3) and arguments (path to the server script).
Function Tool: Getting Stock Price
- Problem: How to get the current price of the top new stock.
- Solution: Use a standard function tool.
- Implementation:
- Add the
@ADK.tools.function tooldecorator on top of the function. - Write a clear and descriptive dock string for the function, specifying what it does and what arguments it needs.
- Implement the code inside the function to make an API call to a financial API.
- Add the
Authenticated Function Tool: Buying Stock
- Problem: How to securely handle the user's request to buy 10 shares of stock if they approve.
- Solution: Build an authenticated function tool.
- Implementation:
- Define the function with a
tool contextparameter with thetool contexttype hint. - The ADK framework automatically injects the tool context object.
- The function first checks the session state (using the tool context) to see if a valid token for the user already exists.
- If a token does not exist it prompts the user to login.
- The tool proceeds to make the API call to buy the stock after the context has the proper credentials.
- Define the function with a
Listener Questions and Answers
Integrating Large REST APIs
- Question: Is there a more efficient way to integrate a large REST API with dozens of endpoints than by writing a separate tool call for every endpoint?
- Answer: Yes, use the Open API tool set. Provide the Open API specification, and the tool set automatically discovers every valid operation and generates a ready-to-use tool for each endpoint.
Reusing Langchain Tools
- Question: Can I reuse my existing Langchain tools with the new ADK?
- Answer: Yes, use the Langchain tool wrapper. Plug your existing Langchain tool into the wrapper, and it will work instantly inside your new ADK agent.
Handling Long-Running Tasks
- Question: What if my tool needs to perform a long-running task like rendering a video or running a complex analysis? How do I prevent this task from blocking the entire agent?
- Answer: Use the long running function tool. When the agent calls the tool, it kicks off the long asynchronous process and returns a tracking ID. The agent can then pause the specific task without blocking the entire system. An external system processes the final result, and the agent resumes its work.
Conclusion
The key takeaway is that building a great agent is not just about the LLM itself but is heavily dependent on the quality and architecture of the tools it is equipped with. This involves carefully selecting the right tool for each specific task, from simple API calls to complex and secure authenticated actions. Approaches like utilizing agents as tools, leveraging MCP for standalone services, employing function tools for specific functionalities, and ensuring security through authenticated function tools are all critical components of building a robust and capable agent. Furthermore, the discussed tools (Open API tool set, Langchain tool wrapper, and Long Running Function Tool) can streamline the development process and improve agent performance.
AI summaries can miss context or contain errors. Check important details against the original video.