Installation
This installs
google-genai as a dependency.Chat Agent
UseGoogleChatAgent for conversational agents with streaming support.
gemini-2.5-flash. Override it with the model parameter:
Streaming
Chat agents support streaming out of the box:Task Agent
UseGoogleTaskAgent for structured output with a defined schema.
Options
The first argument to all Google AI agent constructors is agenai.Client instance.
Agent name. Used as the endpoint identifier.
Google AI model to use. Defaults to
gemini-2.5-flash.Maximum number of tokens to generate.
System prompt for the model.
Agent description for discovery and documentation.
Output schema for task agents. Defines the structured output format.
Tags for filtering and organizing agents.
Additional metadata attached to the agent.
Next steps
Deploying
Ship your Google AI agent to production.
Configuration & Secrets
Where to put your
GOOGLE_API_KEY.OpenAI
Same flow with the OpenAI SDK.
TypeScript: Google AI
The same integration in TypeScript.