-
-
System architecture: planner/executor and Google ADK agent share one governance layer, tool set, and Gemini client.
-
Live Google Cloud Run deployment — Liya's backend running and serving real requests in production.
-
Successful Google Cloud Build pipeline: build, push, and gcloud run deploy steps for the Cloud Run backend.
Inspiration
Most "AI assistant" demos are a chat window bolted onto a single LLM call — the model answers, but a person still has to open the file, click the button, or run the search themselves. We wanted an agent that actually finishes the chore, not one that talks about it.
What it does
Liya takes a single messy, multi-step goal in plain language — e.g. "search the web for the latest EV trends, save a summary to a file on my Desktop, and remind me tomorrow at 9am to review it" — and runs it to completion without further input:
- Plans the goal into a sequence of concrete tool calls
(
agent/planner.py) - Executes each step against real tools: web search, file I/O,
app launching, browser control, messaging, reminders, and more
(
actions/*.py) - Recovers from failure by classifying the error and deciding to
retry, skip, replan, or abort — live, not scripted
(
agent/error_handler.py) - Enforces governance on every tool call through a single
allow/confirm/deny policy table, so autonomy is safe by structure,
not by prompt engineering (
agent/governance.py) - Remembers long-term preferences across sessions and feeds them
back into future planning (
memory/memory_manager.py) — reachable from either execution path, since the ADK agent can callmemory_tooldirectly to persist a fact mid-conversation, not just read memory in at plan time - Resumes instead of restarting if a task is interrupted mid-run
(e.g. a Cloud Run instance restart): step-level checkpoints mean
already-completed steps — and their side effects — aren't repeated
(
agent/checkpoint_store.py) - Runs identically as a local desktop app (voice, via Gemini Live) or as a Cloud Run backend that any client can call over HTTP
How we built it
Two execution paths share the same underlying tool implementations:
- A direct Gemini-driven planner/executor loop that produces a JSON step plan and runs it with retry/replan logic.
- A Google ADK agent (
agent/adk_agent.py) wrapping 10 of the same action modules as ADKFunctionTools, run through ADK's own agent loop and session management (agent/adk_runner.py).
Both paths go through one governance layer and one shared Gemini
client (config/ai_client.py), so a model version bump or a policy
change is a single edit, not a repo-wide hunt. The backend
(backend/server.py, FastAPI) is deployed to Cloud Run via
cloudbuild.yaml, backed by Firestore for task state and long-term
memory, with a local-file fallback so the same code runs with zero GCP
setup during development.
Technologies used: Gemini 3.5 Flash / Flash-Lite and Gemma
(gemma-3-27b-it, for high-frequency error classification, via the same
google-genai SDK), Google ADK, Google Cloud Run, Google Cloud
Firestore, Google Cloud Build, FastAPI, PyQt6 (desktop UI), Playwright
(browser control).
Other data sources used: live web search results (Gemini search-grounding, with DuckDuckGo and Bing as fallback backends).
Challenges we ran into
- Governance parity across two execution paths. The first version
of the ADK integration called straight into action functions with no
policy gate — a
confirm-tier tool likesend_messagecould run unchecked through the ADK agent. We caught this and added_governed()inagent/adk_tools.pyso both paths enforce the exact samecheck_tool_permission()check. - Free-tier search quota exhaustion in production. During our own
Cloud Run deployment,
web_search's Gemini backend hit a real429 RESOURCE_EXHAUSTEDunder normal use. We watched our own documented fallback chain (Gemini → DuckDuckGo → Bing) and retry logic (error_handler.py) handle it live rather than crash the task. - Keeping local dev and Cloud Run on one codebase. Firestore is
additive rather than required:
memory_manager.pyandtask_queue.pyboth fall back to local JSON / in-memory state when Firestore isn't configured, so the same code works with no GCP project at all during iteration.
Accomplishments that we're proud of
- Shipping two full execution engines (hand-rolled planner/executor and a Google ADK agent) against the same tool implementations, with provably identical governance instead of two policies to keep in sync.
- Catching and fixing a real security gap — a
confirm-tier tool bypassing governance on the ADK path — before submission, not after. - A live, unstaged Cloud Run failure and recovery: a real
429quota error hit in production and our fallback chain handled it, captured inevidence/cloud_run_deployment_proof.lograther than simulated for the demo. - Step-level checkpoint/resume that actually survives a process
restart mid-task without repeating side effects like a sent message
or a written file — demoed end-to-end against a real
cancelled-then-resumed task (
demo/demo_checkpoint_resume.py). - A single deployment that runs unmodified as a local voice-driven desktop app and as a stateless Cloud Run HTTP service, with zero GCP setup required for local development.
What we learned
- Structural governance (one policy table, enforced identically on every code path) is a much smaller surface to audit than scattered permission checks — and it's the difference between "an agent that is probably safe" and one you can actually point to and say why.
- Running the same tool implementations under two different agent runtimes (hand-rolled vs. ADK) surfaced a real security gap we wouldn't have found by testing either path alone.
- Free-tier API quotas are a production concern, not a demo afterthought — our fallback chain existed on paper before it was ever exercised for real, which is exactly what happened during our own Cloud Run testing.
What's next for LIYA - Autonomous AI Agent
Extending ADK coverage to the remaining 5 action modules (browser
control, computer control, desktop control, screen analysis) that
currently only run on the legacy path, plus a headless-safe split of
youtube_video so its summarize/get_info/trending sub-actions can join
the ADK path too; a durable/distributed task queue in place of the
in-process one; idempotency keys on every write action; and a
prompt-injection defense layer around untrusted tool output.
