The era of simple chatbots is over. Companies are now racing to build AI Agent platforms — systems that don’t just talk, but act. Whether it’s a support bot resolving Jira tickets or a data analyst agent querying BigQuery, these new digital teammates need a platform that offers more than just text generation: they require reasoning, security, and enterprise-grade observability.

Gemini Enterprise provides a great path to achieving this on Google Cloud. It offers a comprehensive set of features including agent exposition, governance, integrated knowledge search, and a visual agent builder, connecting with backends like Vertex AI Agent Engine, Conversational Agent, or A2A.

However, for some organizations or specific use cases, the cost can be a friction point. The catalog price sits at ~$7/user/month for agent users and ~$35/user/month for visual agent builders. While this pricing is competitive for knowledge workers who gain significant productivity, it can be prohibitive for large audiences with lower usage frequency, such as field workers or occasional users.

Enter Chaigent: https://github.com/fmind/chaigent.

The Architecture

Chaigent enables you to build a private, secure AI agent platform by combining serverless infrastructure with open-source tooling.

  1. Frontend (Chainlit on Cloud Run): A Python-based UI that handles user sessions, chat history, and authentication.
  2. Backend (Vertex AI Agent Engine): The “brain” of the operation, capable of reasoning and tool use.
  3. Persistence & Auth: Cloud SQL for storing chat history and feedback, and OAuth (Google, GitHub, etc.) for secure identity management.

This approach allows you to pay for consumption only (Cloud Run CPU + Vertex AI tokens), significantly reducing costs for intermittent usage patterns compared to a flat per-seat license.

The “Do It Yourself” Trade-off

Gemini Enterprise provides a managed, “batteries-included” platform with built-in governance and visual tools. Chaigent, in contrast, offers a code-first, developer-centric approach.

What you gain:

What you lose (The “Subtext”):

Implementation Highlights

Chaigent is surprisingly simple to set up. Here is a glimpse of the code.

1. Defining the Agent

The agent is defined declaratively using the Google ADK. It’s just a Python object specifying the model and tools.

# chaigent/agent.py
root_agent = agent(
    name="chaigent",
    model="gemini-2.5-flash",
    description="answer questions with google search.",
    instruction="you are an expert researcher. you always stick to the facts.",
    tools=[google_search],
)

2. The Bridge (Chainlit Adapter)

The app.py acts as the bridge. It connects the user’s chat session to the Vertex AI Agent Engine, handling the streaming response seamlessly.

# app.py

@cl.on_message
async def on_message(message: cl.Message):
    # Initialize response message
    answer = cl.Message(content="")
    await answer.send()

    # Retrieve session
    session = cl.user_session.get("session")
    user_id, session_id = session["userId"], session["id"]

    # Stream the query to Vertex AI
    response_stream = engine.async_stream_query(
        user_id=user_id, message=message.content, session_id=session_id
    )

    # Stream back the tokens
    async for chunk in response_stream:
        for part in chunk.get("content", {}).get("parts", []):
            text = part.get("text", "")
            if text:
                await answer.stream_token(text)
                await answer.update()

User Experience

Despite being a “DIY” solution, the user experience is premium. Chainlit provides features that users expect from modern chat apps.

Rich Chat Interface: Supports markdown, code highlighting, and streaming responses out of the box.

Authentication & Persistence: Secure login screens and persisted chat history allow users to resume conversations across devices.

Data Layer: All interactions are stored in your own SQL database, giving you full ownership of the data for analytics or fine-tuning later.

Conclusion

Chaigent is an excellent solution when cost efficiency is the primary driver, particularly for large audiences with low individual usage.

The decision comes down to ROI. At ~$7/month/user for Gemini Enterprise, you need to save each user at least one hour of work per month to break even. For knowledge workers, this is a no-brainer. But for field workers or casual users, a consumption-based “Pay-as-you-go” model like Chaigent might be the smarter financial move.

If you are ready to trade some convenience for control and cost savings, go build your own agents!