Hi Google ADK community,
I’m stuck on a production-blocking integration issue between Vertex AI Agent Engine (ADK Python agent) and CopilotKit v1.50 (AG-UI protocol), and I’m hoping for guidance on the correct architecture.
TL;DR
My app works perfectly on localhost, but fails completely when deployed to Vercel + Vertex AI Agent Engine. I’m stuck in what feels like “Adapter Hell” between CopilotKit’s strict AG-UI validation and Vertex’s REST-based Agent Engine APIs. I’ve been blocked for 48+ hours despite trying every integration path I can find.
Setup:
Backend
-
Google ADK Python agent
-
Deployed to Vertex AI Agent Engine
-
Auth: OAuth2 via service account (working)
-
API shape:
createSession,/sessions/{id}:query
Frontend
-
Next.js 14 (App Router)
-
CopilotKit v1.50.1
-
Deployed on Vercel
Resources
-
Problematic route:
https://github.com/anandjx/locus-ai/blob/main/app/frontend/app/api/copilotkit/route.ts
Core Problem
CopilotKit speaks AG-UI / JSON-RPC, sending requests like:
{ "method": "agent/connect", "params": {...} }
Vertex AI Agent Engine expects REST calls:
-
POST :createSession -
POST /sessions/{id}:query
There is no native AG-UI endpoint exposed by Agent Engine, so I attempted to build a translation layer in route.ts. This works locally but fails immediately in production due to validation, protocol, and runtime mismatches.
What I’ve Tried (Exhaustive)
-
Custom Agent Class
ImplementedVertexAIAgentwithsetMessages / setState / execute
→ Failed due to CopilotKit v1.50 interface/type mismatches. -
Service Adapter Pattern
BuiltVertexAIServiceAdapter.process()
→ Never invoked (ignored by CopilotKit runtime). -
HttpAgent (@ag-ui**/client)**
Usednew HttpAgent({ url, headers })
→ Blocked because headers can’t be async (OAuth token refresh). -
Manual Request Handler
Bypassed CopilotKit runtime and parsed requests manually
→ Messages empty / request shape incorrect. -
AG-UI Protocol Handler
Implementedagent/connectandagent.runJSON-RPC handlers
→ 400 errors from method name mismatches. -
LangChainAdapter Hack
Masqueraded as OpenAI (provider: "openai") with customchainFn
→ Failed validation/runtime. -
Custom Streaming Adapter
ImplementedCopilotServiceAdapterand manually streamed viaeventSource.stream()
→ Not recognized by runtime. -
Observability Config Workaround
Added dummy hooks to satisfy type checker
→ No runtime effect. -
ag_ui_adk Wrapper
Works locally with FastAPI
→ Cannot deploy to Agent Engine (pickle / thread lock errors).
Why I’m Blocked(probably)
-
CopilotKit v1.50 enforces strict AG-UI wiring
-
Vertex AI Agent Engine does not expose AG-UI
-
There’s no documented or supported way to:
-
Disable CopilotKit’s “magic” auto-wiring
-
Or expose Agent Engine via AG-UI in production
-
Key Ask?
-
Is there an official or recommended way to expose a Vertex AI Agent Engine deployment via AG-UI?
-
Should I be using a different deployment target ?
-
Is there a working example of a raw / minimal AG-UI adapter for CopilotKit v1.50 that allows full protocol control?
-
Has anyone successfully deployed a production middleware translator between AG-UI and Vertex Agent Engine?
I found Daniel Zamora’s article very helpful…but it relies on local FastAPI, not a managed Agent Engine deployment, which is where everything breaks.
I’m clearly missing a canonical integration path here. Any guidance—architecture-level or concrete examples—would be a huge lifesaver. I’m happy to adapt my stack if Agent Engine is simply not meant to be consumed this way.
Thank you so much for your time and help ![]()