Register and share your invite link to earn from video plays and referrals.

Search results for GoogleADK
GoogleADK community
One keyword maps to one global community path.
Create community
People
Not Found
Tweets including GoogleADK
🤝 "LLMs for ambiguity, deterministic agents for hard policy"—a contract-compliance ADK sample that takes role separation seriously. Title: Contract Compliance Pipeline (GoogleCloudPlatform/generative-ai) URL: An auditable demo that uses Google ADK's A2A protocol to coordinate a Python (intake) agent and a Go (validation) agent. Three highlights worth your attention. 🧠 Separating LLM from deterministic work Instead of routing everything through an LLM, ambiguous extraction goes to the LLM/parser side while hard policy enforcement runs in a deterministic Go engine. Rules like "value ≤ $500k" or "term ≤ 5 years" get checked in a repeatable, identical-every-time way. 🔌 Cross-language A2A handoff ADK's RemoteA2aAgent discovers the Go service via its Agent Card (/.well-known/agent.json) and sends a JSON-RPC 2.0 SendMessage. A Python agent (FastAPI:8000) and a Go agent (net/http:8888) collaborate using only a standard protocol. 📜 Auditable policy and artifacts Policies (value cap, term limit, minimum insurance, required exit clause, no unlimited liability, etc.) are passed as custom_policies and swappable per audit. Results are visualized with an execution trace, and the system even auto-generates compliance certificates and parameter sheets. It reads like a template you could lift straight into real regulated/review-heavy systems. #AIAgents# #GoogleADK#
Show more
# Practical and Useful Patterns with ADK ✋ "Are you sure you want to send this email?" — ADK's Action Confirmations add pre-execution user approval for irreversible operations, building safer agents. 📌 Title: Action Confirmations — Pre-Execution Approval for Irreversible Operations 🔗 URL: 🧩 Overview ADK's Action Confirmations require explicit user approval before executing hard-to-reverse operations like email sending, data deletion, and payment processing. The agent asks "Should I proceed?" and only executes upon user approval. This maintains human control at critical decision points while keeping agents autonomous for routine tasks. 🛠 Usage Defining tools with confirmation requirements. To define tools with confirmation, import `Agent` and `ToolContext` from `google.adk`. In `send_email(to: str, subject: str, body: str, tool_context: ToolContext)`, call `tool_context.actions.request_confirmation(message=...)` before the actual send, displaying a preview with recipient, subject, and body. The email is only sent if the user approves. Similarly, `delete_records(table: str, condition: str, tool_context: ToolContext)` counts records to be deleted first, then displays the count in a confirmation message for user approval. Pass both tools to an `Agent` with `name="admin_assistant"` and `model="gemini-2.5-flash"` via the `tools` parameter. 🏗 Practical Patterns **When to Require Confirmation**: Add confirmation for these categories: - External sends (email, messages, API calls) - Data modification or deletion - Operations that incur charges - Permission or access control changes For payment processing, define `process_payment(amount: float, currency: str, recipient: str, tool_context: ToolContext)`. This function calls `tool_context.actions.request_confirmation(message=...)` with the recipient, currency, and amount details. Only after user approval does it execute `payment_gateway.charge(amount=..., currency=..., recipient=...)` to process the transaction. **Confirmation Message Design**: Include the target, scope of impact, and irreversibility in confirmation messages. Provide exactly the information users need to make an informed decision. **Staged Confirmations**: For multi-step operations, decide whether to confirm at each step or summarize at the final step. Balance thoroughness with user experience. 💡 Use Cases 📧 Email and message send confirmation 🗑️ Database record deletion approval 💳 Payment and transfer execution confirmation 🔐 Permission and access control change approval ⚠️ Caveats - Too many confirmations degrade user experience. Limit confirmations to truly irreversible operations. - Insufficient confirmation messages prevent users from making informed decisions. Be specific about the operation's impact. - Confirmations become bottlenecks in batch processing and automation pipelines. Consider skippable confirmations for automated scenarios. ✨ Properly configured Action Confirmations balance agent autonomy with human safety oversight. The key is confirming only "can't-undo" operations! #ADK# #AIAgent#
Show more
# Useful but Little-Known Features of ADK 2.0 🌍 What if your agent could remember conversations from last week and use that context to give better answers today? ADK 2.0's Memory feature provides agents with long-term knowledge that persists across sessions. It stores past conversations and learned information, retrieving them when needed. 📌 Title: Memory 🔗 URL: 🧩 Overview Unlike State, Memory manages long-term knowledge that spans across sessions. Three memory service implementations are available: InMemoryMemoryService for development and testing, VertexAiMemoryBankService for production with semantic search, and VertexAiRagMemoryService for vector-based RAG. Two built-in tools handle retrieval: PreloadMemory (auto-loads at session start) and LoadMemory (loads on demand). For programmatic access, use tool_context.search_memory(). You can also combine multiple memory services through custom tools. 🛠 How to use it Set up a memory service and add memory tools to your agent. ```python from google.adk.memory import InMemoryMemoryService from import PreloadMemory, LoadMemory # Development: in-memory implementation memory_service = InMemoryMemoryService() # Add memory tools to the agent agent = Agent( name="assistant", tools=[PreloadMemory(), LoadMemory()], ... ) # Configure the runner with the memory service runner = Runner( agent=agent, memory_service=memory_service, ... ) ``` To search memory programmatically from within a tool: ```python def my_tool(query: str, tool_context: ToolContext) -> str: results = tool_context.search_memory(query="past conversations") return str(results) ``` For multiple memory sources, create custom tools that integrate them together. 🏗 Building it into production ・Prototype quickly with InMemoryMemoryService, then switch to VertexAI services for production ・Use PreloadMemory to auto-load frequently needed context and improve response quality ・Design appropriate boundaries for what gets stored in memory to prevent data bloat ・Build custom tools to integrate multiple memory sources into a comprehensive knowledge base 💡 Use cases 🧠 Generate personalized responses based on past conversation history 📚 Retain long-term memory of project discussions and decisions 🔍 Automatically retrieve relevant past interactions via semantic search 🤝 Share a knowledge base across multiple agents using memory as a common layer ⚠️ Watch out InMemoryMemoryService loses all data when the process terminates — do not use it in production. VertexAI-based services require GCP setup and configuration. As stored data grows, search latency can be affected, so plan a data management strategy for your memory stores. ✨ Memory gives your agents the ability to carry context across sessions. It's a game-changer for building agents that deliver consistently better long-term user experiences. #ADK# #AIAgent#
Show more
# Practical and Useful Patterns with ADK ⚡ Turn Python functions into tools, wrap agents as tools, and run long tasks without blocking — ADK's Function Tools maximize flexibility in tool definitions. 📌 Title: Function Tools — Functions, Agents, and Async Tasks as Tools 🔗 URL: 🧩 Overview ADK's Function Tools let you use Python/TypeScript functions directly as agent tools. AgentTool wraps an entire agent as a tool accessible to other agents. Long Running Function Tools handle time-consuming tasks like video encoding and batch jobs without blocking the agent's execution flow. 🛠 Usage Basic function tool definitions and AgentTool usage. Import `Agent` and `AgentTool` from `google.adk`. Define a simple function tool `calculate_price` that takes `base_price` (float), `quantity` (int), and `discount_percent` (float, default 0), computes the total with the discount applied, and returns a dict with `total` and `currency`. For wrapping an agent as a tool, create an `analysis_agent` with `name="data_analyst"` and `tools=[query_database]`. Then define `main_agent` with `tools=[calculate_price, AgentTool(agent=analysis_agent)]`, allowing the main agent to call both the pricing function and the data analysis agent as tools. Using Long Running Function Tools. Import `LongRunningFunctionTool` from `google.adk`. Define an async function `encode_video` that takes `video_url` (str) and `format` (str, default "mp4"), starts an encoding job via `start_encoding_job`, and returns the job ID with a processing status. Wrap it with `LongRunningFunctionTool(func=encode_video)` to create `video_tool`, then pass it to an `Agent`'s `tools` list so the agent can trigger long-running tasks without blocking. 🏗 Practical Patterns **Modularization with AgentTool**: Encapsulate complex logic as specialized agents and expose them via AgentTool. This keeps the main agent's instructions simple while each specialist agent maintains its own tools and prompts -- achieving clean separation of concerns. Define a `summarizer` agent (for 3-line summaries) and a `translator` agent (for Japanese translation) as separate `Agent` instances. Then create a `content_manager` agent with `tools=[AgentTool(agent=summarizer), AgentTool(agent=translator)]`, allowing the main agent to invoke these specialists as tools for content management tasks. **When to Use Long Running Tools**: Ideal for batch processing, external API polling, file conversion — anything taking seconds to minutes. The agent receives a job ID and can proceed with other tasks in parallel. **Type Annotations Matter**: Clear parameter types and return types help the LLM call tools accurately. Docstrings serve as tool descriptions, so keep them concise and clear. 💡 Use Cases 🧮 Calculation and conversion functions as tools (pricing, unit conversion) 🤖 Reusable specialist agents via AgentTool 🎬 Async video encoding and image processing 📊 Non-blocking batch data processing ⚠️ Caveats - Function docstrings become tool descriptions. Write LLM-friendly descriptions — missing docstrings make tool purposes unclear. - Agents called via AgentTool run in a separate session from the parent. Be careful about state sharing. - Long Running Function Tools require a separate completion notification mechanism. Consider polling or webhook-based notifications. ✨ Function Tools let you integrate existing code assets directly into agents, and AgentTool enables seamless agent reuse. A massive boost to development productivity! #ADK# #AIAgent#
Show more
# Useful but Little-Known Features of ADK 2.0 🌍 Sending the same system prompt and tool definitions to the LLM on every call wastes both money and time. What if the SDK could cache that for you? ADK 2.0's ContextCacheConfig caches repeated context data sent to the LLM, reducing both API costs and response latency. Available with Gemini 2.0+, Python v1.15.0+, and Java v0.1.0+. 📌 Title: Context Cache (ContextCacheConfig) 🔗 URL: 🧩 Overview ContextCacheConfig reduces token consumption by caching context sent to the LLM — system prompts, tool definitions, fixed portions of conversation history, and more. It has three key parameters: min_tokens sets the minimum token threshold for caching to activate (default 0), ttl_seconds controls cache lifetime (default 1800 seconds / 30 minutes), and cache_intervals limits maximum cache reuse count (default 10). Configure it on the App object and caching is applied automatically. 🛠 How to use it Create a ContextCacheConfig and set it on the App. ```python from import App from google.adk.context import ContextCacheConfig cache_config = ContextCacheConfig( min_tokens=1000, # Cache only when context >= 1000 tokens ttl_seconds=3600, # Keep cache for 1 hour cache_intervals=20, # Reuse up to 20 times ) app = App( agent=my_agent, context_cache_config=cache_config, ) ``` Setting min_tokens appropriately ensures that small contexts are sent normally while large contexts benefit from caching. 🏗 Building it into production ・Agents with large system prompts or many tool definitions benefit the most from caching ・Tune ttl_seconds to match your workload pattern (short conversations → shorter TTL, long ones → longer TTL) ・Adjust cache_intervals based on request frequency to balance freshness and cost savings ・Monitor cost reduction metrics and continuously optimize parameters 💡 Use cases 💰 Cut API costs for agents with large, stable system prompts ⚡ Reduce response latency by skipping repeated tool definition transmission 🔁 Optimize token consumption for high-frequency chatbot interactions 📋 Efficiently handle fixed context (rules, guidelines, policies) that rarely changes ⚠️ Watch out This feature requires Gemini 2.0 or later. Context changes won't take effect while a cache is active, so set a shorter ttl_seconds if you frequently update system prompts. When cache_intervals is exceeded, a new cache is created, which can cause cost optimization effects to fluctuate. ✨ Context caching delivers significant cost and performance improvements, especially in scenarios with large, frequently-accessed context. It's a quick win for production deployments. #ADK# #AIAgent#
Show more
# Practical and Useful Patterns with ADK 📄 What if you could define agents in YAML instead of code? ADK's Agent Config enables declarative agent definitions with environment-specific switching -- no redeployment needed for prompt or model changes! 📌 Title: Agent Config — Declarative, Code-Free Agent Definitions in YAML 🔗 URL: 🧩 Overview Agent Config lets you build ADK workflows without writing code, using YAML files to define `name`, `model`, `description`, `instruction`, `tools`, and `sub_agents`. Create projects with `adk create --type=config`, then run with `adk web`, `adk run`, or `adk api_server`. For programmatic loading, use `config_agent_utils.from_config()` in Python. This separation of agent definition from code enables prompt changes, model swaps, and environment-specific configurations without redeployment. 🛠 Usage A basic Agent Config YAML: ```yaml # root_agent.yaml name: assistant_agent model: gemini-flash-latest description: A helper agent that answers user questions. instruction: | You are an agent that answers various user questions. Provide accurate and helpful responses. tools: - google_search sub_agents: - config_path: specialist_agent.yaml ``` Create and run a project: ```bash # Create project adk create --type=config my_agent # Run options adk web # Web interface adk run # Terminal execution adk api_server # API server mode ``` Load programmatically in Python: Use `config_agent_utils.from_config()` from `google.adk.agents` to programmatically load an agent from a YAML file path (e.g., `"my_agent/root_agent.yaml"`). 🏗 Practical Patterns **Environment-Specific Configuration**: Maintain separate YAML files for dev/staging/prod and select them via environment variables. ```yaml # config/dev/root_agent.yaml name: assistant_agent model: gemini-flash-latest instruction: | [DEV] Include debug information in your responses. # config/prod/root_agent.yaml name: assistant_agent model: gemini-2.5-pro instruction: | Answer user questions accurately and concisely. ``` Read the environment name with `os.getenv("ENVIRONMENT", "dev")` and dynamically load the corresponding YAML file via `config_agent_utils.from_config(f"config/{env}/root_agent.yaml")`. **Prompt Versioning**: Track YAML files in Git for full prompt change history. Update instructions without code changes and roll back easily when needed. **A/B Testing**: Prepare multiple YAML files with different instructions or models, and switch between them at runtime to compare performance. Call `get_ab_variant(user_id)` to determine the A/B variant (`"a"` or `"b"`), then load the corresponding YAML file with `config_agent_utils.from_config(f"config/variant_{variant}.yaml")` for runtime A/B testing. 💡 Use Cases 🔄 Prompt and model changes without code modifications or redeployment 🌍 Per-environment configuration management (dev/staging/prod) 📊 A/B testing different instructions and models 📝 Git-tracked prompt versioning with easy rollback 🧩 Enabling non-engineers to update agent configurations safely ⚠️ Considerations - Currently only Gemini models are supported. Other model providers are not yet available. - Custom code tools are limited to Python and Java. - `LangGraphAgent` and `A2aAgent` are not yet supported in Agent Config. - API keys and project settings are managed via `.env` files -- be careful not to commit secrets. ✨ Agent Config separates agent definitions from code, enabling non-engineers to safely modify prompts and models while making environment switching and A/B testing straightforward. Use it to maximize operational flexibility! #ADK# #AIAgent#
Show more
googled my symptoms turns out i need to fuck
0
9
1.5K
249
Forward to community
@GoogleDeepMind Nano Banana Pro 2 Let's go, great job! Thank you as always. I look forward to working with you in the future.💖
Just googled my symptoms. Turns out I just need to sit on your face
Join @GoogleDeepMind Principal Engineer @__apf__ to walk through how Gemini Spark helps simplify your daily workflows. Powered by Gemini 3.5 Flash, Spark builds upon Gemini's ability to connect with @GoogleWorkspace apps like Docs and Gmail to execute complex tasks.
Show more
0
68
962
133
Forward to community