gemini-starter-agent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gemini_starter_agent-0.1.0/LICENSE.md +26 -0
- gemini_starter_agent-0.1.0/PKG-INFO +138 -0
- gemini_starter_agent-0.1.0/README.md +114 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent/__init__.py +1 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent/main.py +165 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/PKG-INFO +138 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/SOURCES.txt +11 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/dependency_links.txt +1 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/entry_points.txt +2 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/requires.txt +2 -0
- gemini_starter_agent-0.1.0/gemini_starter_agent.egg-info/top_level.txt +1 -0
- gemini_starter_agent-0.1.0/setup.cfg +4 -0
- gemini_starter_agent-0.1.0/setup.py +30 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
### **LICENSE (MIT)**
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Marjan Ahmed
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemini-starter-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool to bootstrap Gemini agents with OpenAI Agent SDK using UV.
|
|
5
|
+
Author: Marjan Ahmed
|
|
6
|
+
Author-email: marjanahmed.dev@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.md
|
|
13
|
+
Requires-Dist: python-dotenv
|
|
14
|
+
Requires-Dist: InquirerPy
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
Gemini Starter Agent 🚀 - Simplifying Gemini Chat Completions in the OpenAI Agents SDK
|
|
26
|
+
======================================================================================
|
|
27
|
+
|
|
28
|
+
[https://img.shields.io/badge/python-3.13+-blue](https://img.shields.io/badge/python-3.13+-blue)[https://img.shields.io/badge/License-MIT-yellow.svg](https://img.shields.io/badge/License-MIT-yellow.svg)
|
|
29
|
+
|
|
30
|
+
Gemini Starter Agent is a Python CLI tool to quickly bootstrap AI agents using the Gemini API and OpenAI Agent SDK. It leverages [UV](https://uv-pypi.org/) for project scaffolding, virtual environment management, and dependency handling.
|
|
31
|
+
|
|
32
|
+
Features
|
|
33
|
+
--------
|
|
34
|
+
|
|
35
|
+
* Quick scaffolding of a Gemini AI agent project.
|
|
36
|
+
|
|
37
|
+
* Automatic creation of virtual environments.
|
|
38
|
+
|
|
39
|
+
* Easy dependency installation (openai-agents, python-dotenv).
|
|
40
|
+
|
|
41
|
+
* Generates a ready-to-run main.py for your agent.
|
|
42
|
+
|
|
43
|
+
* Friendly CLI prompts for agent name, purpose, and API key.
|
|
44
|
+
|
|
45
|
+
* PEP-621 compliant pyproject.toml scripts for easy CLI execution.
|
|
46
|
+
|
|
47
|
+
* Cross-platform support.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Installation
|
|
51
|
+
------------
|
|
52
|
+
Install the package via pip:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install gemini-starter-agent
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Usage
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
Run the CLI to generate a new Gemini agent:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
`pip install gemini-starter-agent `
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
You will be prompted for:
|
|
69
|
+
|
|
70
|
+
* Project name (default: agent)
|
|
71
|
+
|
|
72
|
+
* Gemini API key
|
|
73
|
+
|
|
74
|
+
* Gemini model (choose from default or enter your own)
|
|
75
|
+
|
|
76
|
+
* Agent name (default: Helpful Assistant)
|
|
77
|
+
|
|
78
|
+
* Agent purpose/instructions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
After completion, your project structure will look like:
|
|
82
|
+
|
|
83
|
+
```Plain
|
|
84
|
+
` /your-project-name/ ├── src/ │ └── your_project_name/ │ ├── __init__.py │ └── main.py ├── .env ├── pyproject.toml └── ... `
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Example main.py
|
|
89
|
+
---------------
|
|
90
|
+
|
|
91
|
+
Here is how the generated main.py will look:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
`` import asyncio import os from dotenv import load_dotenv # the openai-agents runtime packages are installed by `uv add` from agents import Agent, Runner, RunConfig, OpenAIChatCompletionsModel, set_tracing_disabled from openai import AsyncOpenAI # Load environment variables load_dotenv() GEMINI_MODEL = os.getenv("GEMINI_MODEL") GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") BASE_URL = os.getenv("BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/") # Disable tracing for cleaner output set_tracing_disabled(True) client: AsyncOpenAI = AsyncOpenAI(api_key=GEMINI_API_KEY, base_url=BASE_URL) model: OpenAIChatCompletionsModel = OpenAIChatCompletionsModel(GEMINI_MODEL, client) agent: Agent = Agent( name="{agent_name}", instructions="{agent_purpose}", model=model, ) async def main() -> None: """Entry point for the agent CLI.""" prompt = "What is Agentic AI in haikus" # enter a prompt here result = await Runner.run(agent, prompt, run_config=RunConfig(model)) print(result.final_output) if __name__ == '__main__': asyncio.run(main()) ``
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Running Your Agent
|
|
98
|
+
------------------
|
|
99
|
+
|
|
100
|
+
Change into the project folder:
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
Run the agent using UV scripts:
|
|
104
|
+
|
|
105
|
+
bash
|
|
106
|
+
|
|
107
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` uv run helpful-assistant # friendly script `
|
|
108
|
+
Environment Variables
|
|
109
|
+
---------------------
|
|
110
|
+
|
|
111
|
+
The .env file is automatically generated and contains:
|
|
112
|
+
|
|
113
|
+
env
|
|
114
|
+
|
|
115
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` GEMINI_API_KEY=your_api_key_here GEMINI_MODEL=your_model_here BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/ `
|
|
116
|
+
|
|
117
|
+
Contributing
|
|
118
|
+
------------
|
|
119
|
+
* Submit bug reports or feature requests via GitHub Issues.
|
|
120
|
+
|
|
121
|
+
* Fork the repository and create pull requests for improvements.
|
|
122
|
+
|
|
123
|
+
* Ensure code style consistency and add documentation for new features.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
License
|
|
127
|
+
-------
|
|
128
|
+
|
|
129
|
+
This project is licensed under the **MIT License**. See the [LICENSE](https://license/) file for details.
|
|
130
|
+
|
|
131
|
+
Author
|
|
132
|
+
------
|
|
133
|
+
|
|
134
|
+
**Marjan Ahmed**
|
|
135
|
+
|
|
136
|
+
* Email:Â [marjanahmed.dev@gmail.com](https://mailto:marjanahmed.dev@gmail.com/)
|
|
137
|
+
|
|
138
|
+
* GitHub:Â [https://github.com/marjan-ahmed](https://github.com/marjan-ahmed)
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
Gemini Starter Agent 🚀 - Simplifying Gemini Chat Completions in the OpenAI Agents SDK
|
|
2
|
+
======================================================================================
|
|
3
|
+
|
|
4
|
+
[https://img.shields.io/badge/python-3.13+-blue](https://img.shields.io/badge/python-3.13+-blue)[https://img.shields.io/badge/License-MIT-yellow.svg](https://img.shields.io/badge/License-MIT-yellow.svg)
|
|
5
|
+
|
|
6
|
+
Gemini Starter Agent is a Python CLI tool to quickly bootstrap AI agents using the Gemini API and OpenAI Agent SDK. It leverages [UV](https://uv-pypi.org/) for project scaffolding, virtual environment management, and dependency handling.
|
|
7
|
+
|
|
8
|
+
Features
|
|
9
|
+
--------
|
|
10
|
+
|
|
11
|
+
* Quick scaffolding of a Gemini AI agent project.
|
|
12
|
+
|
|
13
|
+
* Automatic creation of virtual environments.
|
|
14
|
+
|
|
15
|
+
* Easy dependency installation (openai-agents, python-dotenv).
|
|
16
|
+
|
|
17
|
+
* Generates a ready-to-run main.py for your agent.
|
|
18
|
+
|
|
19
|
+
* Friendly CLI prompts for agent name, purpose, and API key.
|
|
20
|
+
|
|
21
|
+
* PEP-621 compliant pyproject.toml scripts for easy CLI execution.
|
|
22
|
+
|
|
23
|
+
* Cross-platform support.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Installation
|
|
27
|
+
------------
|
|
28
|
+
Install the package via pip:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install gemini-starter-agent
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Usage
|
|
35
|
+
-----
|
|
36
|
+
|
|
37
|
+
Run the CLI to generate a new Gemini agent:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
`pip install gemini-starter-agent `
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You will be prompted for:
|
|
45
|
+
|
|
46
|
+
* Project name (default: agent)
|
|
47
|
+
|
|
48
|
+
* Gemini API key
|
|
49
|
+
|
|
50
|
+
* Gemini model (choose from default or enter your own)
|
|
51
|
+
|
|
52
|
+
* Agent name (default: Helpful Assistant)
|
|
53
|
+
|
|
54
|
+
* Agent purpose/instructions
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
After completion, your project structure will look like:
|
|
58
|
+
|
|
59
|
+
```Plain
|
|
60
|
+
` /your-project-name/ ├── src/ │ └── your_project_name/ │ ├── __init__.py │ └── main.py ├── .env ├── pyproject.toml └── ... `
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Example main.py
|
|
65
|
+
---------------
|
|
66
|
+
|
|
67
|
+
Here is how the generated main.py will look:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
`` import asyncio import os from dotenv import load_dotenv # the openai-agents runtime packages are installed by `uv add` from agents import Agent, Runner, RunConfig, OpenAIChatCompletionsModel, set_tracing_disabled from openai import AsyncOpenAI # Load environment variables load_dotenv() GEMINI_MODEL = os.getenv("GEMINI_MODEL") GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") BASE_URL = os.getenv("BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/") # Disable tracing for cleaner output set_tracing_disabled(True) client: AsyncOpenAI = AsyncOpenAI(api_key=GEMINI_API_KEY, base_url=BASE_URL) model: OpenAIChatCompletionsModel = OpenAIChatCompletionsModel(GEMINI_MODEL, client) agent: Agent = Agent( name="{agent_name}", instructions="{agent_purpose}", model=model, ) async def main() -> None: """Entry point for the agent CLI.""" prompt = "What is Agentic AI in haikus" # enter a prompt here result = await Runner.run(agent, prompt, run_config=RunConfig(model)) print(result.final_output) if __name__ == '__main__': asyncio.run(main()) ``
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
Running Your Agent
|
|
74
|
+
------------------
|
|
75
|
+
|
|
76
|
+
Change into the project folder:
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
Run the agent using UV scripts:
|
|
80
|
+
|
|
81
|
+
bash
|
|
82
|
+
|
|
83
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` uv run helpful-assistant # friendly script `
|
|
84
|
+
Environment Variables
|
|
85
|
+
---------------------
|
|
86
|
+
|
|
87
|
+
The .env file is automatically generated and contains:
|
|
88
|
+
|
|
89
|
+
env
|
|
90
|
+
|
|
91
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` GEMINI_API_KEY=your_api_key_here GEMINI_MODEL=your_model_here BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/ `
|
|
92
|
+
|
|
93
|
+
Contributing
|
|
94
|
+
------------
|
|
95
|
+
* Submit bug reports or feature requests via GitHub Issues.
|
|
96
|
+
|
|
97
|
+
* Fork the repository and create pull requests for improvements.
|
|
98
|
+
|
|
99
|
+
* Ensure code style consistency and add documentation for new features.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
License
|
|
103
|
+
-------
|
|
104
|
+
|
|
105
|
+
This project is licensed under the **MIT License**. See the [LICENSE](https://license/) file for details.
|
|
106
|
+
|
|
107
|
+
Author
|
|
108
|
+
------
|
|
109
|
+
|
|
110
|
+
**Marjan Ahmed**
|
|
111
|
+
|
|
112
|
+
* Email: [marjanahmed.dev@gmail.com](https://mailto:marjanahmed.dev@gmail.com/)
|
|
113
|
+
|
|
114
|
+
* GitHub: [https://github.com/marjan-ahmed](https://github.com/marjan-ahmed)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .main import main
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
base_url = "https://generativelanguage.googleapis.com/v1beta/openai/"
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import toml
|
|
9
|
+
except Exception:
|
|
10
|
+
print("ERROR: python 'toml' package is required by the generator. Install it with:")
|
|
11
|
+
print(" pip install toml")
|
|
12
|
+
raise
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from InquirerPy import inquirer
|
|
16
|
+
except Exception:
|
|
17
|
+
print("ERROR: InquirerPy is required. Install it with:")
|
|
18
|
+
print(" pip install InquirerPy")
|
|
19
|
+
raise
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def sanitize(name: str) -> str:
|
|
23
|
+
s = (name or "").strip().lower()
|
|
24
|
+
s = re.sub(r"[^a-z0-9]+", "-", s)
|
|
25
|
+
s = s.strip("-")
|
|
26
|
+
return s or "helpful-assistant"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def run_cmd(cmd, cwd=None, shell=False):
|
|
30
|
+
try:
|
|
31
|
+
subprocess.run(cmd, cwd=cwd, shell=shell, check=True)
|
|
32
|
+
except subprocess.CalledProcessError as e:
|
|
33
|
+
print(f"\nERROR: Command failed: {cmd}")
|
|
34
|
+
print(f"Return code: {e.returncode}")
|
|
35
|
+
if cwd:
|
|
36
|
+
print(f"Working dir: {cwd}")
|
|
37
|
+
print("Make sure `uv` is installed and available in PATH (pip install uv).")
|
|
38
|
+
raise
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main():
|
|
42
|
+
# --------------- Collect inputs ---------------
|
|
43
|
+
project_name = inquirer.text(message="Enter your project name:").execute()
|
|
44
|
+
|
|
45
|
+
gemini_api_key = inquirer.secret(message="Enter Gemini API key:").execute()
|
|
46
|
+
|
|
47
|
+
default_models = ["gemini-2.0-flash", "gemini-2.5-flash", "Custom (type your own)"]
|
|
48
|
+
model_choice = inquirer.select(message="Choose a Gemini model:", choices=default_models).execute()
|
|
49
|
+
if model_choice == "Custom (type your own)":
|
|
50
|
+
model = inquirer.text(message="Enter your Gemini model:").execute().strip() or default_models[0]
|
|
51
|
+
else:
|
|
52
|
+
model = model_choice
|
|
53
|
+
|
|
54
|
+
agent_name = inquirer.text(message="Enter agent name:", default="Helpful Assistant").execute()
|
|
55
|
+
agent_purpose = inquirer.text(
|
|
56
|
+
message="Enter your agent work:", default="You're a helpful assistant, help user with any query"
|
|
57
|
+
).execute()
|
|
58
|
+
|
|
59
|
+
# --------------- Initialize UV project with src layout ---------------
|
|
60
|
+
uv_command = f"uv init --package {project_name}"
|
|
61
|
+
print(f"\nRunning: {uv_command}")
|
|
62
|
+
run_cmd(uv_command, shell=True)
|
|
63
|
+
|
|
64
|
+
project_path = Path.cwd() / project_name
|
|
65
|
+
if not project_path.exists():
|
|
66
|
+
print(f"ERROR: project folder not found at {project_path} after uv init.")
|
|
67
|
+
return
|
|
68
|
+
|
|
69
|
+
# --------------- Create venv and install runtime deps ---------------
|
|
70
|
+
print("\nCreating virtual environment with `uv venv`...")
|
|
71
|
+
run_cmd("uv venv", cwd=project_path, shell=True)
|
|
72
|
+
|
|
73
|
+
print("\nInstalling runtime packages (openai-agents, python-dotenv) into the project with `uv add`...")
|
|
74
|
+
run_cmd(["uv", "add", "openai-agents", "python-dotenv"], cwd=project_path)
|
|
75
|
+
|
|
76
|
+
# --------------- Write .env ---------------
|
|
77
|
+
env_file = project_path / ".env"
|
|
78
|
+
env_file.write_text(f"GEMINI_API_KEY={gemini_api_key}\nGEMINI_MODEL={model}\nBASE_URL={base_url}", encoding="utf-8")
|
|
79
|
+
|
|
80
|
+
# --------------- Convert project name to valid Python module name ---------------
|
|
81
|
+
# Replace hyphens with underscores for the actual Python module
|
|
82
|
+
module_name = project_name.replace("-", "_")
|
|
83
|
+
|
|
84
|
+
# Create the package root at src/<module_name>
|
|
85
|
+
src_dir = project_path / "src"
|
|
86
|
+
pkg_root = src_dir / module_name
|
|
87
|
+
pkg_root.mkdir(parents=True, exist_ok=True)
|
|
88
|
+
|
|
89
|
+
init_file = pkg_root / "__init__.py"
|
|
90
|
+
if not init_file.exists():
|
|
91
|
+
init_file.write_text("# package initializer\n", encoding="utf-8")
|
|
92
|
+
|
|
93
|
+
# We'll write main.py directly under src/<module_name>/main.py
|
|
94
|
+
script_import_target = f"{module_name}:main"
|
|
95
|
+
|
|
96
|
+
main_file = pkg_root / "main.py"
|
|
97
|
+
if not main_file.exists():
|
|
98
|
+
main_file.write_text(
|
|
99
|
+
f"""import asyncio
|
|
100
|
+
import os
|
|
101
|
+
from dotenv import load_dotenv
|
|
102
|
+
# the openai-agents runtime packages are installed by `uv add`
|
|
103
|
+
from agents import Agent, Runner, RunConfig, OpenAIChatCompletionsModel, set_tracing_disabled
|
|
104
|
+
from openai import AsyncOpenAI
|
|
105
|
+
|
|
106
|
+
# Load environment variables
|
|
107
|
+
load_dotenv()
|
|
108
|
+
|
|
109
|
+
GEMINI_MODEL = os.getenv("GEMINI_MODEL")
|
|
110
|
+
GEMINI_API_KEY = os.getenv("GEMINI_API_KEY")
|
|
111
|
+
BASE_URL = os.getenv("BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/")
|
|
112
|
+
|
|
113
|
+
# Disable tracing for cleaner output
|
|
114
|
+
set_tracing_disabled(True)
|
|
115
|
+
|
|
116
|
+
client: AsyncOpenAI = AsyncOpenAI(api_key=GEMINI_API_KEY, base_url=BASE_URL)
|
|
117
|
+
model: OpenAIChatCompletionsModel = OpenAIChatCompletionsModel(GEMINI_MODEL, client)
|
|
118
|
+
|
|
119
|
+
agent: Agent = Agent(
|
|
120
|
+
name="{agent_name}",
|
|
121
|
+
instructions="{agent_purpose}",
|
|
122
|
+
model=model,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
async def main() -> None:
|
|
126
|
+
\"\"\"Entry point for the agent CLI.\"\"\"
|
|
127
|
+
prompt = "What is Agentic AI in haikus" # enter a prompt here
|
|
128
|
+
result = await Runner.run(agent, prompt, run_config=RunConfig(model))
|
|
129
|
+
print(result.final_output)
|
|
130
|
+
|
|
131
|
+
if __name__ == '__main__':
|
|
132
|
+
asyncio.run(main())
|
|
133
|
+
""",
|
|
134
|
+
encoding="utf-8",
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# --------------- Update pyproject.toml (PEP-621) ---------------
|
|
138
|
+
script_friendly = sanitize(agent_name)
|
|
139
|
+
script_unique = f"{sanitize(project_name)}-{script_friendly}"
|
|
140
|
+
|
|
141
|
+
pyproject_file = project_path / "pyproject.toml"
|
|
142
|
+
if pyproject_file.exists():
|
|
143
|
+
pyproject_data = toml.load(pyproject_file)
|
|
144
|
+
else:
|
|
145
|
+
pyproject_data = {}
|
|
146
|
+
|
|
147
|
+
project_table = pyproject_data.setdefault("project", {})
|
|
148
|
+
scripts_table = project_table.setdefault("scripts", {})
|
|
149
|
+
|
|
150
|
+
# Use the valid module name (with underscores) for the import target
|
|
151
|
+
script_import_target = f"{module_name}.main:main"
|
|
152
|
+
|
|
153
|
+
scripts_table[script_friendly] = script_import_target
|
|
154
|
+
scripts_table[script_unique] = script_import_target
|
|
155
|
+
|
|
156
|
+
with pyproject_file.open("w", encoding="utf-8") as f:
|
|
157
|
+
toml.dump(pyproject_data, f)
|
|
158
|
+
|
|
159
|
+
print("\n🎉 Next steps:")
|
|
160
|
+
print(f" cd {project_name}")
|
|
161
|
+
print(f" uv run {script_friendly}\n")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
if __name__ == "__main__":
|
|
165
|
+
main()
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gemini-starter-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool to bootstrap Gemini agents with OpenAI Agent SDK using UV.
|
|
5
|
+
Author: Marjan Ahmed
|
|
6
|
+
Author-email: marjanahmed.dev@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE.md
|
|
13
|
+
Requires-Dist: python-dotenv
|
|
14
|
+
Requires-Dist: InquirerPy
|
|
15
|
+
Dynamic: author
|
|
16
|
+
Dynamic: author-email
|
|
17
|
+
Dynamic: classifier
|
|
18
|
+
Dynamic: description
|
|
19
|
+
Dynamic: description-content-type
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
Dynamic: requires-dist
|
|
22
|
+
Dynamic: requires-python
|
|
23
|
+
Dynamic: summary
|
|
24
|
+
|
|
25
|
+
Gemini Starter Agent 🚀 - Simplifying Gemini Chat Completions in the OpenAI Agents SDK
|
|
26
|
+
======================================================================================
|
|
27
|
+
|
|
28
|
+
[https://img.shields.io/badge/python-3.13+-blue](https://img.shields.io/badge/python-3.13+-blue)[https://img.shields.io/badge/License-MIT-yellow.svg](https://img.shields.io/badge/License-MIT-yellow.svg)
|
|
29
|
+
|
|
30
|
+
Gemini Starter Agent is a Python CLI tool to quickly bootstrap AI agents using the Gemini API and OpenAI Agent SDK. It leverages [UV](https://uv-pypi.org/) for project scaffolding, virtual environment management, and dependency handling.
|
|
31
|
+
|
|
32
|
+
Features
|
|
33
|
+
--------
|
|
34
|
+
|
|
35
|
+
* Quick scaffolding of a Gemini AI agent project.
|
|
36
|
+
|
|
37
|
+
* Automatic creation of virtual environments.
|
|
38
|
+
|
|
39
|
+
* Easy dependency installation (openai-agents, python-dotenv).
|
|
40
|
+
|
|
41
|
+
* Generates a ready-to-run main.py for your agent.
|
|
42
|
+
|
|
43
|
+
* Friendly CLI prompts for agent name, purpose, and API key.
|
|
44
|
+
|
|
45
|
+
* PEP-621 compliant pyproject.toml scripts for easy CLI execution.
|
|
46
|
+
|
|
47
|
+
* Cross-platform support.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Installation
|
|
51
|
+
------------
|
|
52
|
+
Install the package via pip:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install gemini-starter-agent
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Usage
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
Run the CLI to generate a new Gemini agent:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
`pip install gemini-starter-agent `
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
You will be prompted for:
|
|
69
|
+
|
|
70
|
+
* Project name (default: agent)
|
|
71
|
+
|
|
72
|
+
* Gemini API key
|
|
73
|
+
|
|
74
|
+
* Gemini model (choose from default or enter your own)
|
|
75
|
+
|
|
76
|
+
* Agent name (default: Helpful Assistant)
|
|
77
|
+
|
|
78
|
+
* Agent purpose/instructions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
After completion, your project structure will look like:
|
|
82
|
+
|
|
83
|
+
```Plain
|
|
84
|
+
` /your-project-name/ ├── src/ │ └── your_project_name/ │ ├── __init__.py │ └── main.py ├── .env ├── pyproject.toml └── ... `
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Example main.py
|
|
89
|
+
---------------
|
|
90
|
+
|
|
91
|
+
Here is how the generated main.py will look:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
`` import asyncio import os from dotenv import load_dotenv # the openai-agents runtime packages are installed by `uv add` from agents import Agent, Runner, RunConfig, OpenAIChatCompletionsModel, set_tracing_disabled from openai import AsyncOpenAI # Load environment variables load_dotenv() GEMINI_MODEL = os.getenv("GEMINI_MODEL") GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") BASE_URL = os.getenv("BASE_URL", "https://generativelanguage.googleapis.com/v1beta/openai/") # Disable tracing for cleaner output set_tracing_disabled(True) client: AsyncOpenAI = AsyncOpenAI(api_key=GEMINI_API_KEY, base_url=BASE_URL) model: OpenAIChatCompletionsModel = OpenAIChatCompletionsModel(GEMINI_MODEL, client) agent: Agent = Agent( name="{agent_name}", instructions="{agent_purpose}", model=model, ) async def main() -> None: """Entry point for the agent CLI.""" prompt = "What is Agentic AI in haikus" # enter a prompt here result = await Runner.run(agent, prompt, run_config=RunConfig(model)) print(result.final_output) if __name__ == '__main__': asyncio.run(main()) ``
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Running Your Agent
|
|
98
|
+
------------------
|
|
99
|
+
|
|
100
|
+
Change into the project folder:
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
Run the agent using UV scripts:
|
|
104
|
+
|
|
105
|
+
bash
|
|
106
|
+
|
|
107
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` uv run helpful-assistant # friendly script `
|
|
108
|
+
Environment Variables
|
|
109
|
+
---------------------
|
|
110
|
+
|
|
111
|
+
The .env file is automatically generated and contains:
|
|
112
|
+
|
|
113
|
+
env
|
|
114
|
+
|
|
115
|
+
Plain textANTLR4BashCC#CSSCoffeeScriptCMakeDartDjangoDockerEJSErlangGitGoGraphQLGroovyHTMLJavaJavaScriptJSONJSXKotlinLaTeXLessLuaMakefileMarkdownMATLABMarkupObjective-CPerlPHPPowerShell.propertiesProtocol BuffersPythonRRubySass (Sass)Sass (Scss)SchemeSQLShellSwiftSVGTSXTypeScriptWebAssemblyYAMLXML` GEMINI_API_KEY=your_api_key_here GEMINI_MODEL=your_model_here BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/ `
|
|
116
|
+
|
|
117
|
+
Contributing
|
|
118
|
+
------------
|
|
119
|
+
* Submit bug reports or feature requests via GitHub Issues.
|
|
120
|
+
|
|
121
|
+
* Fork the repository and create pull requests for improvements.
|
|
122
|
+
|
|
123
|
+
* Ensure code style consistency and add documentation for new features.
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
License
|
|
127
|
+
-------
|
|
128
|
+
|
|
129
|
+
This project is licensed under the **MIT License**. See the [LICENSE](https://license/) file for details.
|
|
130
|
+
|
|
131
|
+
Author
|
|
132
|
+
------
|
|
133
|
+
|
|
134
|
+
**Marjan Ahmed**
|
|
135
|
+
|
|
136
|
+
* Email:Â [marjanahmed.dev@gmail.com](https://mailto:marjanahmed.dev@gmail.com/)
|
|
137
|
+
|
|
138
|
+
* GitHub:Â [https://github.com/marjan-ahmed](https://github.com/marjan-ahmed)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE.md
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
gemini_starter_agent/__init__.py
|
|
5
|
+
gemini_starter_agent/main.py
|
|
6
|
+
gemini_starter_agent.egg-info/PKG-INFO
|
|
7
|
+
gemini_starter_agent.egg-info/SOURCES.txt
|
|
8
|
+
gemini_starter_agent.egg-info/dependency_links.txt
|
|
9
|
+
gemini_starter_agent.egg-info/entry_points.txt
|
|
10
|
+
gemini_starter_agent.egg-info/requires.txt
|
|
11
|
+
gemini_starter_agent.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gemini_starter_agent
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as f:
|
|
4
|
+
description = f.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name="gemini-starter-agent",
|
|
8
|
+
version="0.1.0",
|
|
9
|
+
description="A CLI tool to bootstrap Gemini agents with OpenAI Agent SDK using UV.",
|
|
10
|
+
author="Marjan Ahmed",
|
|
11
|
+
author_email="marjanahmed.dev@gmail.com",
|
|
12
|
+
packages=find_packages(exclude=["tests*", "examples*"]),
|
|
13
|
+
install_requires=[
|
|
14
|
+
"python-dotenv",
|
|
15
|
+
"InquirerPy",
|
|
16
|
+
],
|
|
17
|
+
python_requires=">=3.9",
|
|
18
|
+
entry_points={
|
|
19
|
+
"console_scripts": [
|
|
20
|
+
"gemini-starter-agent=gemini_starter_agent.main:main", # <-- FIXED
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
classifiers=[
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"License :: OSI Approved :: MIT License",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
],
|
|
28
|
+
long_description=description,
|
|
29
|
+
long_description_content_type="text/markdown",
|
|
30
|
+
)
|