<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Terrence Ryan on Medium]]></title>
        <description><![CDATA[Stories by Terrence Ryan on Medium]]></description>
        <link>https://medium.com/@tpryan?source=rss-d1af299a6d7b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MjPbOncxjwD8Wpn_-4uVtA.jpeg</url>
            <title>Stories by Terrence Ryan on Medium</title>
            <link>https://medium.com/@tpryan?source=rss-d1af299a6d7b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 13:32:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tpryan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ADK Patterns Part 2: Collaborative Reasoning with Agentic Tools]]></title>
            <link>https://medium.com/google-cloud/adk-patterns-part-2-collaborative-reasoning-with-agentic-tools-a93993d843dd?source=rss-d1af299a6d7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a93993d843dd</guid>
            <category><![CDATA[agent-development-kit]]></category>
            <category><![CDATA[google-adk]]></category>
            <category><![CDATA[agent-design-patterns]]></category>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[adk-design]]></category>
            <dc:creator><![CDATA[Terrence Ryan]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 20:54:34 GMT</pubDate>
            <atom:updated>2026-02-14T04:16:16.826Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F97AQVlEfSiA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D97AQVlEfSiA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F97AQVlEfSiA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/53a32f15f068f0c6c05b84595919c1c1/href">https://medium.com/media/53a32f15f068f0c6c05b84595919c1c1/href</a></iframe><p>Welcome to the second installment of our series on the Google Agent Development Kit (ADK). In the previous post, we explored the “Research and Fill” pattern. Today, we’re looking at how agents can solve a problem that standard apps can’t: managing shared, complex tasks when your hands are full.</p><h3>The Problem: Input Latency and Context Switching</h3><p>If you have a typical task-management application, you’ve likely encountered the “Input Friction” anti-pattern. You have a list of tasks that need to be synchronized, but the environment where the work happens is hostile to screens.</p><p>I built Navallist to solve this. I sail as a hobby, and when leaving the dock, I have to run through a safety checklist. As a developer, my instinct was to build a standard CRUD app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9OFfqBhclio6zEG2QSIbQ.png" /></figure><p>But standard apps failed here because of Context Switching. To check off “Engine Oil,” I had to stop the actual work, unlock a phone, navigate UI layers, and tap a precise target. This high interaction cost meant the app was often ignored, leading to stale data. I needed an interface that functioned as a passive observer, not an active demand on my attention.</p><h3>The Solution: The Virtual Scribe</h3><p>The most efficient analog workflow isn’t passing a clipboard around; it’s dedicating one crew member to hold it. This person acts as a central synchronization node, aggregating verbal updates (“Oil is good”, “Lines are set”) from the distributed team into a single source of truth.</p><p>I didn’t want to build a better form; I wanted to build a virtual version of that scribe.</p><p>Semantic Mapping over “Command and Control” In traditional voice interfaces, we rely on rigid keyword spotting (e.g., “Set variable X to true”). This breaks down in high-cognitive-load environments because the user has to remember the schema.</p><p>The Checklist Agent uses the LLM as a semantic translation layer. When I say, “The inverter is good,” the agent isn’t just matching keywords; it is performing a semantic lookup against the boat’s schema. It maps the sensory input (“I hear the exhaust”) to the specific database state (engine_exhaust_flow = true).</p><p>Crucially, it handles set operations. If I say, “All lights are green,” the agent retrieves the definition of “lights” from the schema (Navigation, Steaming, Deck, Cabin) and constructs a bulk update. This shifts the complexity from the user’s memory to the application’s context.</p><h3>Architecture: The Interface Abstraction</h3><p>How do we build something that can reason like a human but update a database like a computer? The architecture relies on giving the agent Tools that wrap standard Go interfaces.</p><p><strong>1. The Code Structure</strong> We start by defining the Agent in Go. We use llmagent.New to initialize the model, but the most important part is the Tools array. We don’t try to code every possible phrase a user might say. Instead, we give the Agent tools like updateTool, bulkTool, and crewTool.</p><pre>// Model Setup<br>model, err := gemini.NewModel(ctx, &quot;gemini-2.5-flash&quot;, &amp;genai.ClientConfig{<br>    APIKey: &quot;[valid api key]&quot;,<br>})<br><br>return llmagent.New(llmagent.Config{<br>    Name:        &quot;navallist_agent&quot;,<br>    Description: &quot;Manages boat checklists&quot;,<br>    Instruction: instruction,<br>    Model:       model,<br>    Tools: []tool.Tool{<br>        updateTool,<br>        bulkTool,<br>        crewTool,<br>        statusTool,<br>        metaTool,<br>    },<br>})</pre><p><strong>2. The Tool Wrapper</strong> The ChecklistUpdateTool is a wrapper for a traditional bit of code that handles reading and writing to the underlying database.</p><pre>// UpdateItem is the function called by the agent to update checklist items.<br>func (t *ChecklistTool) UpdateItem(ctx tool.Context, args UpdateChecklistArgs) (result ToolResult, err error) {<br> log.Info(&quot;Tool UpdateItem called&quot;, &quot;args&quot;, args, &quot;session_id&quot;, ctx.SessionID())<br><br> adkID := ctx.SessionID()<br> if adkID == &quot;&quot; {<br>  return ToolResult{Status: &quot;error&quot;}, fmt.Errorf(&quot;session_id missing from context&quot;)<br> }<br><br> // Resolve the real DB ID<br> tripID, err := t.resolveTripID(ctx, adkID)<br> if err != nil {<br>  return ToolResult{Status: &quot;error&quot;}, err<br> }<br><br> // --- Check for Artifacts (Photos) in Context ---<br> photoID := args.PhotoArtifactID<br> if photoID != &quot;&quot; &amp;&amp; !strings.Contains(photoID, &quot;?v=&quot;) {<br>  photoID = &quot;&quot;<br> }<br><br> updated, err := t.Store.UpdateItemWithAssignment(ctx, tripID, args.ItemName, args.IsChecked, args.Location, photoID, ctx.UserID(), args.AssignedToName)<br> if err != nil {<br>  return ToolResult{Status: &quot;error&quot;}, fmt.Errorf(&quot;failed to update: %w&quot;, err)<br> }<br><br> loc := &quot;&quot;<br> if updated.LocationText != nil {<br>  loc = *updated.LocationText<br> }<br> msg := fmt.Sprintf(&quot;Updated %s: Checked=%v, Location=%s&quot;, updated.Name, updated.IsChecked, loc)<br> if updated.AssignedToName != nil {<br>  msg += fmt.Sprintf(&quot;, Assigned To=%s&quot;, *updated.AssignedToName)<br> }<br> if photoID != &quot;&quot; {<br>  msg += &quot; (Photo attached)&quot;<br> }<br> return ToolResult{Status: &quot;success&quot;, Message: msg}, nil<br>}</pre><p>Crucially, the traditional codebase uses a Go interface to abstract the data store. This defines the contract. The LLM’s job is to translate messy natural language — “Oil’s good” — into the clean, strictly structured content required by the interface: ItemName: ‘Engine Oil’, IsChecked: true.</p><pre>// Store defines the interface for data persistence.<br>// It consolidates all data access methods required by the agent and the server.<br>type Store interface {<br> // User operations<br> GetUser(ctx context.Context, id string) (*models.User, error)<br> FindUserByName(ctx context.Context, name string) (*models.User, error)<br> UpdateUser(ctx context.Context, id, name string) error<br><br> // Trip operations<br> GetOrCreateTrip(ctx context.Context, adkSessionID, userID, captainName, tripType string) (*models.Trip, error)<br> GetTripIDBySessionID(ctx context.Context, sessionID string) (string, error)<br> GetTrip(ctx context.Context, tripID string) (*models.Trip, error)<br> AddTripCrew(ctx context.Context, tripID, userID, displayName string) error<br> GetActiveCrewNames(ctx context.Context, tripID string) ([]string, error)<br> FindCrewMember(ctx context.Context, tripID, query string) (string, error)<br> ListUserTrips(ctx context.Context, userID string) ([]models.Trip, error)<br> UpdateTripStatus(ctx context.Context, tripID string, status string) error<br> UpdateTripType(ctx context.Context, tripID string, tripType string) error<br> DeleteTrip(ctx context.Context, tripID string) error<br> GetTripReport(ctx context.Context, tripID string) ([]models.ChecklistItem, error)<br> UpdateTripMetadata(ctx context.Context, adkSessionID string, boatName *string, captainName *string) (*models.Trip, error)<br><br> // Checklist operations<br> UpdateItem(ctx context.Context, tripID, itemName string, isChecked bool, location string, photoArtifactID string, userID *string, completedByName string, assignedToUserID *string, assignedToName *string) (*models.ChecklistItem, error)<br> UpdateItemWithAssignment(ctx context.Context, tripID, itemName string, isChecked bool, location, photoID, currentUserID, assignedToName string) (*models.ChecklistItem, error)<br> AddItemPhoto(ctx context.Context, tripID, itemName string, photoArtifactID string) (*models.ChecklistItem, error)<br><br> // Artifact operations<br> CreateArtifact(ctx context.Context, tripID, filename, mimeType, storagePath string) (*models.Artifact, error)<br> GetArtifact(ctx context.Context, filename string) (*models.Artifact, error)<br> GetArtifactByID(ctx context.Context, id string) (*models.Artifact, error)<br>}</pre><p><strong>Why this Interface Pattern Matters</strong> - This is the most critical part of the architecture. Notice that we are not generating SQL with the LLM.</p><p>By forcing the agent to interact with a Go interface (UpdateItem), we create a deterministic boundary. The LLM’s only job is to extract parameters (Item Name, Status) from the messy natural language. The Go code handles the actual state mutation, validation, and database transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fZ_E9krCXF9S0RtkHvHhrQ.png" /></figure><p>This decoupling allows us to:</p><ol><li>Sanitize Inputs: The UpdateItem function can enforce logic (e.g., “You cannot verify the engine if the boat is off”) that the LLM might miss.</li><li>Swap Backends: The agent doesn’t care if Store is backed by Postgres, Firestore, or an in-memory mock for testing.</li><li>Prevent Hallucinations: The agent cannot invent database columns; it can only call the functions we explicitly provided in the Tools definition.</li></ol><p><strong>3. The Instruction Pattern</strong> Finally, we use an instruction.md file to let the agent start making judgments about the space. We give it a reference for all the checklist items and how they are organized. We provide boundaries, such as “Don’t mark an item as checked if the user is assigning it to someone,” and examples of how to interpret sensory input.</p><pre>You are the Navallist Checklist Manager. <br>Your job is to update the shared checklist state based on crew input.<br><br>The Checklist has these sections and items:<br><br>1.  **Boat Information**: Name, Marina, Slip.<br>2.  **Electrical Systems**: Shore Power, Shore Power Cable, Generator, Battery, Outlets, Inverter.<br>3.  **Lights**: Navigation Lights, Steaming Lights, Deck Light, Cabin Lights.<br>4.  **Comms**: Navigation Systems, Radio.<br>5.  **Paperwork**: Rental Agreement, Boat Documentation, Vessel Assist.<br>6.  **Engine**: Engine Hours, Exhaust, Fuel, Belts, Coolant, Oil.<br>7.  **Safety**: First Aid Kit, Extinguishers, Flares, PFD, Ring Buoy, Lifesling.<br>8.  **Lines/Sheets/Fenders**: Docklines, Fenders, Jack lines, Standing Rigging, Life Lines, Preventer.<br>9.  **Inventory**: Winch Handles, Air Horn, Flashlight, Toolbox, Boat Hook.<br>10.  **Steering**: Wheel Control, Forward/Reverse, Emergency Tiller.<br>11.  **Water Systems**: Manual Bilge, Automatic Bilge, Water, Water Pressure, Heads Working.<br>12.  **Sails**: Unfurl main, Unfurl jib, Check furl lock, Check reefing.<br>13.  **Anchor**: Anchor Bow, Anchor Stern, Windlass, Chain Length, Rope Length.<br>14.  **Food Management**: Stove Top, Oven, Grill, Refrigerator.<br><br><br>**Tools:**<br>- Use &#39;update_checklist_item&#39; for regular checklist items (e.g. Engine Oil, PFDs).<br>- Use &#39;get_crew_list&#39; to see who is currently collaborating on this trip.<br>- Use &#39;get_checklist_status&#39; to see the current state of all items and assignments.<br>- Use &#39;update_trip_details&#39; ONLY for updating the Boat Name or Captain Name.<br><br>**Assignment &amp; Name Logic:**<br>- You are STRICTLY FORBIDDEN from assigning an item to a name that is not currently in the crew list.<br>- You can call &#39;update_checklist_item&#39; directly with the name you heard (e.g. &quot;Justin&quot;, &quot;Terrence&quot;). The tool will automatically try to find the best match in the crew list.<br>- Only call &#39;get_crew_list&#39; if you are unsure of who is on the boat or if the update tool returns an error.<br>- **IMPORTANT**: Assignment does NOT imply completion. If a user says &quot;Assign X to Y&quot;, you MUST set &#39;is_checked=false&#39;. Only set &#39;is_checked=true&#39; if the user explicitly states it is done, verified, or checked. Never assume an item is checked just because it was assigned.<br>- If the person is not in the crew list, DO NOT attempt to assign the item. Inform the user they must join the session first.<br><br>**Handling Sensory Input:**<br>- Interpret phrases like &quot;I see...&quot;, &quot;I hear...&quot;, &quot;I noticed...&quot;, or &quot;The [item] is [running/on/visible]&quot; as confirmations that the item is verified/functional.<br>- Map these to `is_checked=true` for the relevant item.<br><br>**Bulk Updates:**<br>- If a user says &quot;All my items are checked&quot;, &quot;I&#39;m done with my list&quot;, or &quot;Check off all my items&quot;:<br>    1. Call &#39;get_checklist_status&#39; to retrieve the full list of items and their assignments.<br>    2. Identify items assigned to the current speaker (look for matches with the current user&#39;s name or ID).<br>    3. Call &#39;bulk_update_items&#39; with the list of updates (e.g. `updates=[{item_name=&quot;...&quot;, is_checked=true}, ...]`).<br>    4. Confirm to the user which items were updated.<br><br>**Examples:**<br>- User: &quot;Assign Marina to Justin&quot; -&gt; Call get_crew_list(), find &quot;Justin Tralongo&quot;, then Call update_checklist_item(item_name=&quot;Marina&quot;, is_checked=false, assigned_to_name=&quot;Justin Tralongo&quot;)<br>- User: &quot;Terrence is doing the engine oil&quot; -&gt; Call get_crew_list(), find &quot;Terrence Ryan&quot;, then Call update_checklist_item(item_name=&quot;Oil&quot;, is_checked=false, assigned_to_name=&quot;Terrence Ryan&quot;)<br>- User: &quot;Assign Flares to Ryan&quot; -&gt; Call get_crew_list(), find &quot;Terrence Ryan&quot;, then Call update_checklist_item(item_name=&quot;Flares&quot;, is_checked=false, assigned_to_name=&quot;Terrence Ryan&quot;)<br>- User: &quot;Checked engine oil&quot; -&gt; Call update_checklist_item(item_name=&quot;Oil&quot;, is_checked=true)<br>- User: &quot;I see the navigation lights&quot; -&gt; Call update_checklist_item(item_name=&quot;Navigation Lights&quot;, is_checked=true)<br>- User: &quot;The boat&#39;s name is Capers&quot; -&gt; Call update_trip_details(boat_name=&quot;Capers&quot;)<br>- User: &quot;The marina is Westpoint&quot; -&gt; Call update_checklist_item(item_name=&quot;Marina&quot;, location=&quot;Westpoint&quot;)<br>- User: &quot;I&#39;m done with all my tasks&quot; -&gt; Call get_checklist_status(), find items assigned to speaker, then call bulk_update_items(updates=[...]) for those items.</pre><h3>The Collaborative Reasoning Pattern</h3><p>This agent implements a pattern I call Collaborative Reasoning. You should consider this architecture when your application meets three specific criteria:</p><ol><li>Shared Mutable State: Multiple users need to view and act on a single source of truth (the checklist) simultaneously.</li><li>High-Friction Environment: Users cannot easily use standard UI controls due to physical constraints or safety concerns.</li><li>Fuzzy Intent: Users may express the same state change in different ways (“The oil is good,” “Checked the engine,” “Fluids are fine”).</li></ol><p>While I built this for sailing, this pattern solves the data-entry bottleneck in other field-work domains:</p><ul><li>Construction: A site manager can say “The framing is done,” and the agent interprets that intent to update specific sub-records (studs, headers, sills) in the database.</li><li>Logistics: A warehouse packer can say “Box 4 is packed,” triggering updates to inventory and shipping manifests without scanning a barcode.</li></ul><h3>Conclusion: The “Headless” Agent</h3><p>The “Collaborative Reasoning” pattern proves that GenAI doesn’t need to live in a chat bubble. By embedding the agent directly into the application logic, we didn’t build a “Sailing Chatbot”; we built a standard CRUD app that understands intent.</p><p>This architecture — LLM for reasoning, Go for state management — solves the “Hands-Full” problem without sacrificing data integrity. The agent handles the noisy, messy reality of human communication, while the Go tools ensure that the database remains strict and structured.</p><p>For developers, the takeaway is clear: You don’t need to rewrite your entire stack to add agentic features. If you have a clean interface for your data, you already have the API your agent needs. You just need to give it the tools to call it.</p><p>You can find the full source code for the Checklist Agent, including the instruction prompts and tool definitions, here: <a href="https://github.com/google/adk-samples">github.com/google/adk-samples</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a93993d843dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/adk-patterns-part-2-collaborative-reasoning-with-agentic-tools-a93993d843dd">ADK Patterns Part 2: Collaborative Reasoning with Agentic Tools</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADK Patterns Part 1: Research and Fill with Agentic Tools]]></title>
            <link>https://medium.com/google-cloud/adk-patterns-part-1-research-and-fill-with-agentic-tools-625a022b193c?source=rss-d1af299a6d7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/625a022b193c</guid>
            <category><![CDATA[agent-development-kit]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[gen-ai-tools]]></category>
            <category><![CDATA[google-adk]]></category>
            <dc:creator><![CDATA[Terrence Ryan]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 18:23:33 GMT</pubDate>
            <atom:updated>2026-02-04T06:32:16.455Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FabyEF1Pe2sM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DabyEF1Pe2sM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FabyEF1Pe2sM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/24d58ebcd75110de615ff68c1f3747d0/href">https://medium.com/media/24d58ebcd75110de615ff68c1f3747d0/href</a></iframe><p><strong>Series Introduction:</strong> Welcome to the first installment of a series on Google Agent Development Kit (ADK). Over the next few posts, we’ll explore some practical, architectural patterns for integrating GenAI into real-world software. Today, we’re starting with a pattern that solves a universal user frustration: the data entry form.</p><h3>The Problem: The Metadata Grind</h3><p>If you have a typical personalized data application, you’ve run into this pattern. You have a form somewhere that requires your users to enter data that exists as reference data elsewhere on the internet. For example I built an app called <strong>Wakelog</strong> to track sailing experiences and validate expertise for charter companies.</p><figure><img alt="A map of San Francisco Bay with the track of a sailing vessel plotted out on it." src="https://cdn-images-1.medium.com/max/1024/1*lqhBvl0FDu99pPFL0e362g.png" /></figure><p>As part of this personalized data I collect stats on the boats I rent. This allows me to make the case that I have spent N number of hours on boats larger than X. To add a boat to the system, I have to input specific metrics: length, beam, draft, and mast height.</p><figure><img alt="A form requesting information about a boat, like type, length, deam, draft, mast." src="https://cdn-images-1.medium.com/max/712/1*UEMIFWLk04P7UbatBBXJRQ.png" /></figure><p>For the user, this creates a lot of work. They have to:</p><ol><li>Leave the app</li><li>Search on Google for “Beneteau 38.1 specs” (or whatever boat they are sailing)</li><li>Click through forums, manufacturer PDFs, or third party review sites</li><li>Find the data — often in meters when they need feet/inches (or vice versa)</li><li>Perform manual unit conversions</li><li>Make sure they have each field: mast height, length, beam (width), draft (depth of lowest point of the boat)</li><li>Return to the app and type it all in for each field</li></ol><p>I really want to solve this problem with AI. The idea of having something else search for this data and fill it in, is really appealing. However, a lot of agentic examples leave you with the solution being: “I’ll build a chatbot to answer sailing questions.” But the better solution isn’t a chat interface; it’s an invisible agent that enhances the existing form.</p><h3>The Solution: The “Research and Fill” Agent</h3><p>Using Agent Development Kit (ADK), I built the <strong>Boat Agent</strong>. It completely shortcuts the manual process. The user simply fills out the model “Beneteau 38.1”, clicks a button, and the agent does the rest.</p><p>The flow looks like this:</p><ul><li>User inputs the boat model (“Catalina 30”) and clicks ‘Fetch Specs.’</li><li>Agent uses geminitool.GoogleSearch to find raw data</li><li>The Reasoning Engine (Gemini) interprets the context (e.g., “depth” means “draft”)</li><li>The agent performs unit conversions (Metric to Inches)</li><li>The agent formats the result into a strict JSON schema and provides source URLs</li><li>The traditional app frontend receives the structured data and fills the form</li></ul><figure><img alt="A visual representation of the flow through ADK." src="https://cdn-images-1.medium.com/max/1024/1*8WRBDYTyt_r9Fiw8ZugZ5w.png" /></figure><p>Why an agent to do this? Because there’s not one common place, format, and structure for this data — an api cannot just retrieve the data. It’s often in serveral different places. So, this isn’t just a search scraper. It is a reasoning engine. The agent has to understand context — for example, that “depth” in a manufacturer’s PDF often refers to “draft” in a nautical context. It also handles the math, converting metric specifications into the inches required by my database schema, and provides source URLs so the user can verify the data.</p><h3>Architecture: Enhancing vs. Replacing</h3><p>Many AI demos today suggest you need a vector database, a new tech stack, or a “chat-first” UI. However, the Boat Agent was built as a <strong>stateless microservice</strong> that plugs directly into my existing Go backend. This agent can be called from my backend Go app, or another app, in any language, that has this admittedly very specific need could use this agent. In a future entry in this series, I’ll talk a little bit more about how I architect the production side of this application so that the front end can take advantage of it.</p><h4>1. The Code Structure</h4><p>The backend for this agent is surprisingly simple — less than 100 lines of code in main.go. I initialize the Gemini model and equip it with a single, powerful tool: geminitool.GoogleSearch. This tool permission is what allows the LLM to break out of its training data and query the live web for specific, up-to-date specs.</p><pre>//go:embed instruction.md<br>var instruction string<br><br>func main() {<br><br> ctx := context.Background()<br><br> model, err := gemini.NewModel(ctx, &quot;gemini-2.5-flash&quot;, &amp;genai.ClientConfig{<br>  APIKey: &quot;[valid api key]&quot;,<br> })<br><br> if err != nil {<br>  log.Fatal(err)<br> }<br><br> boatAgent, err := llmagent.New(llmagent.Config{<br>  Name:        &quot;boat_agent&quot;,<br>  Model:       model,<br>  Description: &quot;Agent designed to gather information about sailboats.&quot;,<br>  Instruction: instruction,<br>  Tools: []tool.Tool{<br>   geminitool.GoogleSearch{},<br>  },<br> })</pre><h4>2. The Instruction Pattern</h4><p>In Agent Development Kit for Go, we can take advantage of file embedding to keep our prompts clean and separate. I use an instruction.md file that is embedded into the binary, that way I can look at the prompt in Markdown and keep my Go readable. This file contains the strict rules for the agent:</p><ul><li><strong>Goal:</strong> Fetch boat specs (Make, Model, Year, Length, Beam, Draft, Mast).</li><li><strong>Constraint:</strong> “Return dimension information in inches rounded to the nearest integer.”</li><li><strong>Format:</strong> A strict JSON schema.</li></ul><pre>When you get some information about a boat including make/manufacturer, model,<br>year, length, beam, draft, mast height, use that to conduct a search and get <br>the rest of the missing information.<br><br>Please only return the following information make, model, year, type, length,<br>beam, draft, mast.<br><br>Type is either: monohull or catamaran.<br><br>If you do not have enough information to return a result please return an error.<br><br><br>Please return dimension information in inches rounded to the nearest integer. <br>Convert dimension information that it is feet and inches to just inches. <br>Expect to get the data in json form as well.   <br><br>Please also return a list of sources where you got the information. Please make<br>sure they are valid and still active urls. <br><br>Please return the data in a json object format:<br>```json<br>{<br>    &quot;make&quot;:&quot;make&quot;,<br>    &quot;model&quot;:&quot;model&quot;,<br>    &quot;year&quot;:year,<br>    &quot;length&quot;:length,<br>    &quot;beam&quot;:beam,<br>    &quot;draft&quot;:draft,<br>    &quot;mast&quot;:mast,<br>    &quot;source&quot;: [source]<br>}</pre><p>By separating the instructions from the code, we can iterate on the “personality” and logic of the agent without making the Go harder to read.</p><h4>3. Seamless Integration</h4><p>ADK handles the session management and conversation history automatically. I use a function in Agent Development Kit for Go to generate a handler I can plug in to the default http server for Go. This lets me plug this agent into my existing web server patterns, like logging or other middleware operations.</p><pre>loader := agent.NewSingleLoader(boatAgent)<br><br>launcherConfig := &amp;launcher.Config{<br> AgentLoader:    loader,<br> SessionService: session.InMemoryService(),<br>}<br><br>adkHandler := adkrest.NewHandler(launcherConfig, 120*time.Second)<br><br>mux := http.NewServeMux()<br>mux.Handle(&quot;/api/&quot;, http.StripPrefix(&quot;/api&quot;, adkHandler))<br><br>srv := &amp;http.Server{<br> Addr:    &quot;:8080&quot;,<br> Handler: recoveryMiddleware(loggingMiddleware(traceMiddleware(mux, &quot;projectid&quot;))),<br>}<br><br>go func() {<br>   if err := srv.ListenAndServe(); err != nil &amp;&amp; !errors.Is(err, http.ErrServerClosed) {<br>  log.Fatal(err)<br>   }<br>}()<br>log.Print(&quot;Server started&quot;, &quot;addr&quot;, srv.Addr)</pre><p>Going back to the existing app, the frontend didn’t need a total redesign; it just needed a “Research” button. The agent does the heavy lifting, and presents the user with information including sources for its data. Then the user has the ability to confirm, and then possibly edit the data before it goes into their system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*TIMIKEYxvb4PPyqctfo0xw.png" /></figure><h3>The “Research and Fill” Pattern</h3><p>This “Boat Agent” is just one implementation of a broader pattern I call <strong>Research and Fill</strong>. You can apply this to almost any domain where users are forced to look up external specifications:</p><ul><li><strong>Home Renovation Apps:</strong> User types “Bosch 800 Series Dishwasher”; Agent fills in the exact rough-in dimensions.</li><li><strong>Meal Planners:</strong> User types “Medium Avocado”; Agent fills in the fat, fiber, and calorie content.</li><li><strong>Hardware Tracking:</strong> User types “MacBook Pro M1”; Agent fills in the screen resolution and port specs.</li></ul><h3>Conclusion</h3><p>The Boat Agent proves that AI doesn’t have to be the star of the show to be valuable. By offloading the research and the math to an ADK agent, and then making sure the data entry part of it is handled by the traditional app, we removed the friction from our application and let users focus on the data that actually matters.</p><p>In the next post, we’ll look at <strong>Collaborative Reasoning</strong> — how an agent can help a crew manage a shared checklist without needing to tap a hundred tiny boxes.</p><p>You can find the full source code for the Boat Agent and other samples at</p><ul><li><a href="http://github.com/google/adk-samples">github.com/google/adk-samples</a></li><li><a href="https://github.com/google/adk-samples/tree/main/go/agents/boat-agent">github.com/google/adk-samples/tree/main/go/agents/boat-agent</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=625a022b193c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/adk-patterns-part-1-research-and-fill-with-agentic-tools-625a022b193c">ADK Patterns Part 1: Research and Fill with Agentic Tools</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whack a Pod Update]]></title>
            <link>https://medium.com/google-cloud/whack-a-pod-update-c4fa33c84cf1?source=rss-d1af299a6d7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4fa33c84cf1</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[minikube]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Terrence Ryan]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 16:16:20 GMT</pubDate>
            <atom:updated>2017-10-31T20:00:05.414Z</atom:updated>
            <content:encoded><![CDATA[<p>A few people have asked me about getting Whack-a-Pod to run on <a href="https://kubernetes.io/docs/getting-started-guides/minikube/">Minikube</a>. To do that I needed to make a number of changes to various parts of the project. As it was, Whack-a-Pod assumed that you would have access to Container Engine, Container Builder, and Container Registry. I assumed that you need a lot of those features to run it and I know I can’t count on all of that in Minikube. So stuff had to be changed. But while I was changing it, I took the opportunity to make some more tweaks…</p><h3>Change 1: Eliminate YAML Files</h3><p>All of the configuration for Whack-a-Pod was stored in YAML files. This certainly makes kubectl easier to deal with, as you don’t have to learn all of the permutations of it. You just have to remember kubectl apply -f filename. This was great, but it led to a situation where to deal with variable project settings, I was having users create a number of yaml files dynamically during the setup, instead of just using the variables with kubectl commands right away.</p><p>Added to that, I run a few different clusters. Switching between clusters meant I had to recreate configs every time. And if I forgot to do it, I screwed up other clusters. Moving the configuration from the yaml files to the settings in kubectl commands called from a Makefile enabled me to take advantage of variables in the Makefile rather than rebuilding yaml files.</p><p>This change eliminated lots of Makefile code and yaml. This led to less system changes leaking into the code base, which would then need to be updated into an image, then pushed to Container <br>Registry. But not all of it — I was still creating a JavaScript config file based on the various service endpoints I was creating, and the js files needed to be updated, baked into an image, and pushed to Container Registry every time I pushed to a different cluster.</p><h3>Change 2: Switch from Service — Load Balancers to Ingress</h3><p>One of the things I added to Whack-a-Pod in reaction to feedback received after running it at demo booths was a way to show off some of the plumbing internals to facilitate deeper conversations about Kubernetes. I made an advanced view where we showed off the underlying nodes, added the ability to kill and resurrect nodes (actually <em>cordon</em> and <em>uncordon</em>, since killing nodes would take a long time to rebuild relative to the game length), and included a way to show which of our pods was actually servicing the request. One thing that became evident immediately was that I did not understand how things were being routed. I expected the answering pod to bounce all over the place, but it didn’t — it stayed pretty consistently sticky to the last pod that had answered the request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*EkYMcFDUSuXQzDQd." /><figcaption>Whack a Pod pod behavior before Ingress</figcaption></figure><p><a href="https://twitter.com/kelseyhightower">Kelsey Hightower</a> was in the office one day and I asked him about it. As Kelsey does, he gave me a very well thought-out and extremely technical explanation of why it was happening and a prescription: <strong>switch to Ingress</strong>. I was able to hold on to this second part.</p><p><a href="https://cloud.google.com/container-engine/docs/tutorials/http-balancer">Switching to Ingress on Container Engine</a> was actually pretty easy. This is one of those places that Container Engine shines doing systems work for your cluster is just simple.</p><ol><li>Change Services from LoadBalancers to NodePort</li><li>Request a global IP for the Ingress to use as its public IP.</li><li>Create an Ingress resource on Kubernetes that points Services to routes.</li></ol><p>I had a little difficulty getting my container ports, service ports, node ports, and Ingress ports along with my container paths to line up. Mostly because I was using ports 8080 on the containers and outputting to 80 but the docs were 80 all the way through. Things were just similar enough to cause me issues. But after a little trial and error (and RTFM), I got it up and running. This had two big pluses:</p><ol><li>I could service all services on the same host, which meant I no longer needed the JavaScript configuration baked into the images as mentioned above — everything could be handled in the UI with relative paths.</li><li>The behavior of the answer pod changed to work as I expected, having it bounce among all the pods.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*H1qGa8FlOifu5G8M." /><figcaption>Whack a Pod pod behavior after Ingress</figcaption></figure><p>This had one drawback, it added a yaml file to the setup since Ingress is not available via direct kubectl options, other than kubectl apply. Small price to pay for what it bought me.</p><h3>Change 3: Make Containers Canonical</h3><p>Switching to Ingress had the added benefit of making the containers much less customized to the project they were running in. Having one host meant that all of the API calls in the front end could point to /path instead of hostname/path. This, in turn, meant no more custom JavaScript in the game container. In fact, there was only one file in all of the containers that was being customized per project: /apps/admin/containers/deployment.json. The custom bit was pointing it to the correct Docker repository — in my case, in Google Container Registry. I changed this to be an env variable that I injected during deployment. This was a lot easier since I had made the whole thing work from kubectl commands instead of yaml. Now the containers are canonical — if you wanted to you could run Whack-a-Pod just by pulling from my my container images. Don’t — you shouldn’t trust me and my Docker images. But you could if you wanted to.</p><h3>Change 4: Shrink Containers</h3><p>In my first build of the various Whack-a-Pod apps I wrote the admin and color api components in PHP and the game/ui in HTML/JS/CSS. For my base container image I used Google Cloud Platform’s <a href="https://github.com/GoogleCloudPlatform/php-docker">App Engine PHP Flexible Docker image</a>. It’s pretty easy to get started with, has GCP’s SDK already on it, and I know and trust the author <a href="https://twitter.com/tmatsuo">Takashi Matsuo</a>. This allowed me to build everything super fast. The downside is that the images ended up being pretty big:</p><ul><li>game 181 MB</li><li>api 171 MB</li><li>admin 171 MB</li><li>total 523 MB</li></ul><p>Considering that <a href="https://hub.docker.com/r/library/php/tags/">PHP’s canonical Docker images</a> clock in in the 150–160MB range, 170–180 isn’t that bad. But it still meant that Whack-a-Pod took over half a gig to run. I figured I could do better. Not just for the sake of just getting a smaller number, but more importantly, smaller images mean faster deploys and probably an easier time of running Whack-a-Pod on Minikube. (Because these Minikube machines might be getting set up at conferences where Wi-Fi is frequently craptastic.)</p><p>First I took on the game component. The game is all HTML/JS/CSS. Since there’s not a lot to it, I figured just a plain NGINX server would handle it just fine and it did. This took the game container from 181 MB down to 49 MB. Not bad.</p><p>Next I took on the admin service. Both the admin and the api services are just APIs — either or both could be rewritten in Go. Doing so would allow me to remove numerous dependencies. In fact, I should be able to run these in a minimal Docker container based on the Scratch image. Then you just cross compile a Go executable and attach. Check out Nick Gauthier’s guide to <a href="https://blog.codeship.com/building-minimal-docker-containers-for-go-applications/">Building Minimal Docker Containers</a>. Rewriting the admin service in Go also meant that I could take advantage of the <a href="https://github.com/kubernetes/client-go">client-go for Kubernetes</a>. I expected it to be super simple to write (which ended up being wrong).</p><p>I got it completely rewritten using the client-go for Kubernetes. This brought my image down to 4 MB. This version worked when I tested each operation in isolation. But when I went to run the game I started to get weird errors on the Ingress’ load balancer. Most of them translated to “the backend is timing out”. I fiddled around with client-go’s settings but when I started tweaking the QPS settings, I ran into errors in dependent libraries. It turns out the repeated polling I was doing was incompatible with the settings for throttling the client.</p><p>I got the impression that client-go was too smart for me. It was doing some sort of rate limiting and the documentation wasn’t that discoverable — nor stackoverflowable (is that a word?). I thought long and hard about it and decided to bypass client-go and write my own client for the Kubernetes API — figuring at least this way I would understand it completely. I just had to translate the PHP code I had written for the previous version into Go. This ended up being much easier and faster, and since it didn’t depend on client-go, it was also lighter at container-building time. My admin container went from 4 MB to 2MB.</p><p>Finally, I took on the API service, which was pretty simple. It had two endpoints: one just gave a random color, the other spit out a JSON object with a random color and the hostname, which on Kubernetes ends up being the pod name. This one was super simple, and took the API container from 171 MB to 2MB.</p><p>To sum up, by switching to the simplest images I could to get the job done (base NGINX in one case and a Go executable running on the scratch Docker image) I was able to achieve the following reduction in Docker image size:</p><ul><li>game 181 MB -&gt; 49 MB</li><li>api 171 MB -&gt;2 MB</li><li>admin 171 MB -&gt;2 MB</li><li>total 523 MB -&gt;53 MB</li></ul><h3>Change 5: Minikube and Xhyve</h3><p>I was prepared to have to do a lot of work to get Whack-a-Pod to work on Minikube. As it turns out, it was actually really easy to do. I had to:</p><ol><li>Install Minikube</li><li>Enable Ingress</li><li>Create a copy of the Ingress yaml I already had:<br>Without GKE annotations<br>With a reference to the host “wap.io”</li><li>Edit /etc/host to point Minikube’s externally available IP address to wap.io</li></ol><p>I got it running, but I ran into a little snag. The performance was a bit slow. You could easily take down all of the pods in the cluster, and they would stay down disrupting the service. I asked around and my coworker <a href="https://twitter.com/ahmetb?lang=en">Ahmet Alp Balkan</a> told me about <a href="https://github.com/zchee/docker-machine-driver-xhyve">xhyve</a>. Xhyve is a hypervisor that makes it possible to run Linux on a Mac. It can be used with Minikube and it sped up pod deployment by 400%. With xhyve the performance was now fast enough to provide a reasonable game experience for Whack a pod.</p><p>I had to alter the UI to handle a slight difference with Minikube. The full advanced UI allows you to kill a node. (Well not really, you can unschedule a node and then kill all the pods on it). But since Minikube is a one-node cluster, you probably shouldn’t kill it — as the rest of the app requires a node to run on — so I disabled this capability in the UI.</p><h3>Conclusions</h3><p>What started with a goal — run Whack-a-Pod on Minikube — ended with a little bit of yak shaving. But all of the changes seem worth it. I hope the updates make it easier for you to try Whack-a-Pod out for yourself. All of the changes are currently available at <a href="https://github.com/tpryan/whack_a_pod">Whack a Pod on github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4fa33c84cf1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/whack-a-pod-update-c4fa33c84cf1">Whack a Pod Update</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whack-a-pod: The Kubernetes cluster whack-a-mole game]]></title>
            <link>https://medium.com/google-cloud/whack-a-pod-359cbfb61662?source=rss-d1af299a6d7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/359cbfb61662</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Terrence Ryan]]></dc:creator>
            <pubDate>Tue, 27 Jun 2017 16:17:17 GMT</pubDate>
            <atom:updated>2017-06-30T19:12:46.960Z</atom:updated>
            <content:encoded><![CDATA[<p>Earlier this week, I released an <a href="https://github.com/tpryan/whack_a_pod">open source version of “Whack a Pod,”</a> a demo that my team at Google Cloud have been using at <a href="https://cloudnext.withgoogle.com/">Google Cloud Next</a>, <a href="https://events.google.com/io/">Google I/O</a> and various regional events. For those that haven’t seen the demo, it turns a Kubernetes cluster into a Whack-a-mole game, where Kubernetes pods are the moles, and you are trying to take down enough pod/moles to disrupt the service those pod/moles are serving up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjsHiyp0zmWEBIeB3ZpXyw.gif" /></figure><p>The versions we have used at our events include a physical whack-a-mole machine that was hooked up to our game, so that you could actually physically kill Kubernetes pods by swinging a hammer at them. The work on the physical rig was done by <a href="http://www.sparksonline.com/">Sparks</a> and is not included in this repo. But, you can run this version anywhere, with minimal hardware requirements — a screen and an interface, touchscreen or mouse based.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7AJAnzgAYkQPNQlG.jpg" /></figure><h3>Why Build it?</h3><p>I wanted an easy and fun way to explain Kubernetes. I wanted something that could be hooked up to a real thing, and allow you to touch, as it were, something in the cloud. I wanted to get across the idea of Kubernetes being resilient.</p><p>I also wanted to make a series of carnival-based games, all with the same look and feel as the carnival version of whack-a-pod. They were shot down for being too whimsical. But that’s another story.</p><h3>How does it work?</h3><p>The entire application consists of three separate applications that are all hosted on the same Kubernetes cluster. We also create three services with which to expose the applications.</p><h4>API</h4><p>This is the application that is represented by the moles. We launch a deployment that creates a replica set with instructions to keep 12 of them running at all times.</p><p><a href="http://[api-service]/api/color"><strong>http://[api-service]/api/color</strong></a></p><p>This is the basic service that the pods are keeping up. It is tremendously simple — when polled it returns a random hexadecimal color value.</p><p><a href="http://[api-service]/api/color-complete"><strong>http://[api-service]/api/color-complete</strong></a></p><p>This is a slightly tweaked version of the color api above for use with the advanced interface. In addition to the color, it returns the unique Kubernetes generated name of the pod that answered the request.</p><h4>Admin</h4><p>This is a set of commands that allow our front-end to issue commands against the Kubernetes cluster without need for credentialing. It is basically a proxy to the Kubernetes API with a restricted set of actions possible.</p><p><a href="http://[admin-service]/api/k8s/createdeploy"><strong>http://[admin-service]/api/k8s/createdeploy</strong></a></p><p>Creates a deployment for running the pods that serve up the API application. Used in all interfaces when you start up.</p><p><a href="http://[admin-service]/api/k8s/deleteallpods"><strong>http://[admin-service]/api/k8s/deleteallpods</strong></a></p><p>Deletes all pods for the API deployment.</p><p><a href="http://[admin-service]/api/k8s/deletedeploy"><strong>http://[admin-service]/api/k8s/deletedeploy</strong></a></p><p>Deletes the deployment for the API application. Used in all interfaces when the game is finished with the deployment</p><p><a href="http://[admin-service]/api/k8s/deletepod"><strong>http://[admin-service]/api/k8s/deletepod</strong></a></p><p>Deletes a single pod. Used in all interfaces when you whack a pod.</p><p><a href="http://[admin-service]/api/k8s/drain"><strong>http://[admin-service]/api/k8s/drain</strong></a></p><p>Cordons a node to prevent any pods being scheduled on it, then it kills all the API pods that are running on the node. Used in the advanced interface.</p><p><a href="http://[admin-service]/api/k8s/getnodes"><strong>http://[admin-service]/api/k8s/getnodes</strong></a></p><p>Gets information about the nodes of the Kubernetes cluster. Used in the advanced interface.</p><p><a href="http://[admin-service]/api/k8s/getpods"><strong>http://[admin-service]/api/k8s/getpods</strong></a></p><p>Gets information about all of the pods running the API service. Used in all of the interfaces to populate the list of pod/moles.</p><p><a href="http://[admin-service]/api/k8s/uncordon"><strong>http://[admin-service]/api/k8s/uncordon</strong></a></p><p>Resets a node so that it can start accepting newly scheduled pods. Used in the advanced interface.</p><h4>Game</h4><p>The game consists of a few separate HTML/JS/CSS apps joined together. All of them work in the same general way.</p><p>The demo starts with no pods running. Each version will prompt you to deploy the pods. Deploying creates a replica set with 12 pods running.</p><p>The UI regularly polls the api/color service. If it gets a result, the service is up, if it doesn’t get a result, the service is down. There is an indicator towards the top that gives the player feedback on service status.</p><p>The pods are displayed in a grid, their status is indicated by color differences (or mole position differences). The statuses are: starting, running, terminated. Starting and terminated pods cannot be “whacked.” When you whack a running pod, the UI calls admin/api/k8s/deletepod/. The pods remain for awhile after they have been terminated, and are replaced by pods in the started state.</p><p><a href="http://[game-service]/"><strong>http://[game-service]/</strong></a></p><p>This is the basic game. It has a fun carnival theme, and is designed to be more of a fun, distracting game than a real lesson about Kubernetes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L7S2yQKxyr1fUJz6.png" /></figure><p><a href="http://[game-service]/next.html"><strong>http://[game-service]/next.html</strong></a></p><p>This is the basic game but without the carnival theme. It’s more in line with the branding for the Google Cloud Next events. We have used this version on a touchscreen at a few of our regional Cloud Next events.</p><p>It also has a panel that displays an abridged version of the JSON response from Kubernetes commands. Why abridged? Because most of the single responses from Kubernetes are over 100 lines of formatted JSON. The app instead shows the salient details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uB2daKH1y-Nd3Y4i.png" /></figure><p><a href="http://[game-service]/advanced.html"><strong>http://[game-service]/advanced.html</strong></a></p><p>When showing the demo at various events, we found ourselves wanting another view of the information for when conversations started to go deeper. The advanced view is a response to that. It gets rid of the time element, and instead displays the pods as they populate the cluster nodes, and not in a fixed grid. We show the service responses directly. We also show off which pod is actually responding to the service request. The interface includes the ability to drain a cluster node to simulate the node going down. Killing an actual node takes much longer, so this seemed like a reasonable way to simulate node death.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GwXWZPrWGbO1ZeaY.png" /></figure><h3>Choices</h3><h4>Why three services?</h4><p>I originally wrote it as one app. When you killed all of those pods, and disrupted the service, you killed the UI too. This combined with inconsistent caching behavior caused really odd issues when you ran the demo. It made much more sense to split them up so as to not kill the game while you were playing the game.</p><h4>Why PHP?</h4><p>For starters I do outreach for Google Cloud to the PHP community. But also I started writing this as a quick and dirty prototype. When I want something done quickly, I write it in PHP. It’s very productive for me. I used the Docker image for App Engine flexible environment’s PHP runtime to just get the thing to work.</p><p>When the time came to tighten up everything, I considered re-writing all of the apis to use Golang instead. But one of the side effects of choosing PHP and the GAE flexible runtime was that there is a little overhead to starting the service — as opposed to writing a lean go app that only does just one thing. That overhead is only a couple of seconds, but having it allows the demo to illustrate the full lifecycle of a pod.</p><h4>Why No Public Demo?</h4><p>I haven’t figured out a way to convert this demo to a multi tenant demo. So it’s one front-end client to one Kubernetes Cluster. So multiple players would interfere with each other. Right now it involves trying to take down a service directly tied to a specific IP. I’m sure there is a way to rewrite it to do so, I just haven’t had the time to do it.</p><h3>What I learned</h3><h4>Kubectl is awesome</h4><p>In a lot of cases, I was just trying to recreate a kubectl command to tie to the front-end. Specific examples are kubectl delete deployment, and kubectl drain. In both cases, these are actually doing a lot of work, but hiding it behind one command. In the case of kubectl delete deployment, the command is deleting the deployment, then the replica set, then each pod and making it all one thing. If you just delete the deployment via the API, all of the children remain — and if you aren’t expecting it, you’ll be confused.</p><p>The fact that kubectl can be called with a flag to reveal those underlying calls is very much appreciated. The flag is “-v=8” in case you need it.</p><h4>Kubernetes is a <a href="https://en.wikipedia.org/wiki/Weeble">weeble</a> not a fortress</h4><p>I think this was one of the more surprising things I learned. I didn’t go out of my way to make the system super resilient or super brittle, but under most conditions if you were able to directly delete all of your Pods, you can cause major outages for your services. However, those outages would seldom be very long. In fact, at Google I/O we were tracking how long people kept the service down, the most we saw was 50% downtime. And this was two very motivated people hitting moles as soon as they appeared. Most of the time we saw downtown of less than 30%. Again, keeping in mind that the point of the game mechanics is to cause as much downtime as possible.</p><h4>A dead Pod is only mostly dead</h4><p>At a few events we ran into issues where none of the visible pods were in a “running” state, but the service was still up. I thought it was due to UI weirdness. Turns out it was due to the fact that running the Kubernetes delete pod command marks the pod as “terminating” and then allows for graceful termination. So if request gets routed to them, and they are still responding to requests, they can still return a result, even if marked terminated. I would have known it already if I had bothered to <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods">read the documentation</a> a little more carefully.</p><h4>Whack-a-mole machines rest when the moles are down</h4><p>When the moles are up, the machines are doing work, when they are down the machine is resting. When Sparks first hooked up the physical whack-a-mole machine to the Kubernetes cluster (virtually — one is in our data center, the other at the event) the moles were up all the time, because, well, that’s what Kubernetes does. Long story short, our first whack-a-mole machine burnt itself out, because when 21st century cloud technology collides with 1970’s arcade technology, the cloud wins.</p><h3>Conclusion</h3><p>This was a really fun project. It helped me learn a lot about Kubernetes, while at the same time enabling a great educational experience about Kubernetes. Plus I got people to build a whack-a-mole machine. It was pretty awesome.</p><p><a href="https://github.com/tpryan/whack_a_pod">Get the source on github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=359cbfb61662" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/whack-a-pod-359cbfb61662">Whack-a-pod: The Kubernetes cluster whack-a-mole game</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We Suck at Apologies]]></title>
            <link>https://medium.com/@tpryan/we-suck-at-apologies-b949e07f0d8c?source=rss-d1af299a6d7b------2</link>
            <guid isPermaLink="false">https://medium.com/p/b949e07f0d8c</guid>
            <dc:creator><![CDATA[Terrence Ryan]]></dc:creator>
            <pubDate>Thu, 19 Dec 2013 16:52:43 GMT</pubDate>
            <atom:updated>2013-12-19T16:52:43.043Z</atom:updated>
            <content:encoded><![CDATA[<h4>Probably because we’re focused on us and not them. </h4><p>We all suck at apologies. I’d like to try and start a conversation to see if we can fix that. I feel like I am qualified to give advice here, as I spent my 20′s as an angry and often offensive guy, who had to apologize quite a bit. Because of this, I’ve learned a little of what works and what doesn’t.</p><p>Let’s start with a premise. You said something that offended someone somewhere. They are angry, and they have called you out on it in some fashion. (It’s vague, but every example I could come up with might have be offensive to someone, so let’s not get sidetracked.)</p><p><strong><em>“Why should I apologize, what I said (or did) was right?”</em></strong></p><p>This here is the major problem we have with apologizing. We think that apologizing means that we are saying <em>“I was wrong, and you were right.”</em> It doesn’t. When you offend someone, you have damaged your relationship with them. Whether you are an individual offending another individual or a company who offended a potential market, your actions have damaged the relationship. <strong>The true purpose of an apology is to try and fix the damage in the relationship between you and the offended party. </strong>That should be your goal.</p><p><strong><em>“I didn’t mean to offend you.”</em></strong></p><p>Actions have consequences, intentions do not matter. Actually, it would be better to say: intentions can mitigate consequences; but they cannot erase them. Suppose I hit a young man with my car. That my intention was to drive home has no impact on the consequence that the young man’s leg is broken. Now the fact that I was soberly driving home, and did my best to swerve out of the way can maybe mitigate what the law says about my culpability, but it cannot fix the man’s leg.</p><p>So, good on ya, that you didn’t want to offend anyone. Unless you’re a deliberate provocateur I don’t assume anyone believes you did. If you were deliberately offending people, I assume you don’t have any interest in apologizing. So if you are apologizing, shut up about your intentions. You just sound like you are trying to excuse yourself.</p><p><strong><em>“I don’t see what you are getting so upset about.”</em></strong></p><p>This is a shitty, defensive way of saying “I don’t understand how I offended you.” That’s fine. It is perfectly acceptable to not understand how you have been offensive. If you were able to wrap your mind perfectly around the thoughts and considerations of the offended party, you probably wouldn’t have taken the action that offended them. It’s perfectly fine to ask for clarification and an explanation. Just try not to phrase that request like an asshole.</p><ul><li>“I’m having trouble wrapping my mind around this, can you explain where you’re coming from?” Good.</li><li>“Can you tell me why a person like you is offended by this?” — Bad.</li></ul><p><strong><em>“I can’t have said something homophobic, I have quite a few gay friends.”</em></strong></p><p>Having positive feeling towards one person of a group does not mean that you totally accept that group. That you have gay/female/minority friends does not mean you can’t say homophobic/sexist/racist things. It means that you probably shouldn’t say them, and perhaps you should check to see if you still have those friends.</p><p><strong><em>“You’re overly sensitive.”</em></strong></p><p>This encapsulates a lot of things but at the core of it you are denying the reasonableness of the person taking offense. The thought here being there are thoughts that while controversial, reasonable people can talk about without taking offense. There are two problems with this.</p><p>The first problem with the reasonableness trope is that it assumes offense is an intellectual response. It’s not, it’s an emotional response. Therefore reasonableness of the offense is irrelevant as offense in this case is not a product of reason. You can tell someone to stop being sad because their life is overall great, but if a personal tragedy has occurred, you can’t stop them from being sad. Likewise whether or not it is reasonable to be offended is irrelevant in the face of actual offense.</p><p>The second problem with reasonableness is that it doesn’t matter. Because reasonableness is part of the right/wrong discussion. “It is not reasonable to be offended over this, therefore you are wrong and I am right.” –which is irrelevant, because apologies aren’t about right and wrong, they’re are about repairing the damage to the relationship.</p><p><strong><em>“140 characters/email/IM is not enough to have a proper conversation about this.”</em></strong></p><p>You’re right. Happy? Now stop wasting time and move to a higher bandwidth form of communication.</p><p><strong><em>“That’s not what I meant.”</em></strong></p><p>Okay, this is a tough one, and it’s different from “I didn’t mean to be offensive.” It happens when what they think you said and what you think you said are two different things. It could be because of someone mishearing you. It’s also perfectly possible that someone is reading into what you have said or done, and giving it a context that makes it offensive to them. It’s also possible that you were not communicating well.</p><p>Again it’s time to remember what’s important, fixing the damage. So apologize first, get acceptance that you want to fix the damage, then start to talk about the misunderstanding. Ask what language you could have use to make your intended meaning come through.</p><p><strong><em>So how should you apologize?</em></strong></p><ol><li>Start with “I am sorry I offended you.” No qualifiers. No “If I offended anyone.” You’re sorry that the relationship is damaged and that you caused the damage. Start your offer of apology from there.</li><li>Seek an understanding of what you did that caused offense, and acknowledge it.</li><li>No excuses. Unless you were kidnapped, drugged and slammed down in front of a keyboard or phone, you are responsible for whatever you did to offend someone. Even if it is a “not what I meant” incident. You’re responsible at least in part for the misunderstanding.</li><li>Don’t apologize angry. When we are criticized, it’s easy to get angry and emotional ourselves, and therefore get in the way of a real apology. If the criticism you receive makes you angry or defensive, then wait and calm down. Very little relationship damage can be fixed with anger.</li></ol><p>There you have it, apology advice from someone who’s had to do a lot of it. It’s not about winning an argument, it’s about saving a relationship.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b949e07f0d8c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>