Develop your own agent
This page shows you how to develop a custom Data Commons agent, using two approaches:
- Write a custom Gemini CLI extension
- Simple to set up, no code required
- Minimal customization possible, mostly LLM prompts
- Requires Gemini CLI as the client
- Write a custom Google ADK agent
- Some code required
- Any customization possible
- Provides a UI client as part of the framework
Create a custom Gemini CLI extension
Before you start, be sure you have installed the required prerequisites.
Create the extension
To create your own Data Commons Gemini CLI extension:
- From the directory in which you want to create the extension, run the following command:
gemini extensions new EXTENSION_NAME
The extension name can be whatever you want; however, it must not collide with an existing extension name, so do not use
datacommons. Gemini will create a subdirectory with the same name, with a skeleton configuration filegemini-extension.json. - Switch to the subdirectory that has been created:
cd EXTENSION_NAME
- Create a new Markdown file (with a
.mdsuffix). You can name it however you want, or just use the default,GEMINI.md. - Write natural-language prompts to specify how Gemini should handle user queries and tool results. See https://github.com/gemini-cli-extensions/datacommons/blob/main/DATACOMMONS.md for a good example to get you started. Also see the Google ADK page on LLM agent instructions for tips on how to write good prompts.
- Modify
gemini-extension.jsonto add the following configuration:{ "name": "EXTENSION_NAME", "version": "1.0.0", "description": "EXTENSION_DESCRIPTION", // Only needed if the file name is not GEMINI.md "contextFileName": "MARKDOWN_FILE_NAME", "mcpServers": { "datacommons-mcp": { "command": "uvx", "args": [ "datacommons-mcp@latest", "serve", "stdio", "--skip-api-key-validation" ], "env": { "DC_API_KEY": "YOUR_DATA_COMMONS_API_KEY" // Set these if you are running against a Custom Data Commons instance "DC_TYPE="custom", "CUSTOM_DC_URL"="INSTANCE_URL" } } } }The extension name is the one you created in step 1. In the
descriptionfield, provide a brief description of your extension. If you release the extension publicly, this description will show up on https://geminicli.com/extensions/.For additional options, see the Gemini CLI extension documentation.
- Run the following command to install your new extension locally:
gemini extensions link .
Run the extension locally
- From any directory, run
gemini. - In the input box, enter
/extensions listto verify that your extension is active. - Optionally, if you have already installed the Data Commons extension but do not want to use it, exit Gemini and from the command line, run:
gemini extensions disable datacommons - Restart
gemini. - If you want to verify that
datacommonsis disabled, run/extensions listagain. - Start sending queries!
Make your extension public
If you would like to release your extension publicly for others to use, we recommend using a Github repository. See the Gemini CLI extension release documentation for full details.
Customize the sample agent
We provide two sample Google Agent Development Kit-based agents you can use as inspiration for building your own agent:
- Try Data Commons MCP Tools with a Custom Agent is a Google Colab tutorial that shows how to build an ADK Python agent step by step.
- The sample basic agent is a simple Python Google ADK agent you can use to develop locally. You can make changes directly to the Python files. You’ll need to restart the agent any time you make changes.
Tip: You do not need to install the Google ADK; when you use the command we provide to start the agent, it downloads the ADK dependencies at run time.
Customize the model
To change to a different LLM or model version, edit the AGENT_MODEL constant in packages/datacommons-mcp/examples/sample_agents/basic_agent/agent.py.
Customize agent behavior
The agent’s behavior is determined by prompts provided in the AGENT_INSTRUCTIONS in packages/datacommons-mcp/examples/sample_agents/basic_agent/instructions.py.
You can add your own prompts to modify how the agent handles tool results. See the Google ADK page on LLM agent instructions for tips on how to write good prompts.
Page last updated: December 04, 2025 • Send feedback about this page