├── .allstar
└── branch_protection.yaml
├── .env.example
├── .gitignore
├── .vscode
└── launch.json
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── README.md
├── assets
└── demo.gif
├── pyproject.toml
├── src
├── api
│ └── service.py
├── github_resume_generator
│ ├── __init__.py
│ ├── config
│ │ ├── agents.yaml
│ │ └── tasks.yaml
│ ├── crew.py
│ └── main.py
└── static
│ ├── index.html
│ └── social.png
└── uv.lock
/.allstar/branch_protection.yaml:
--------------------------------------------------------------------------------
1 | action: log
2 |
--------------------------------------------------------------------------------
/.env.example:
--------------------------------------------------------------------------------
1 | MODEL=gemini/gemini-2.5-flash-preview-04-17
2 | GEMINI_API_KEY=AIza_your_key_goes_here
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .env
2 | __pycache__/
3 | .DS_Store
4 | dist/
5 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | "name": "PyDebug: Run API server",
6 | "type": "debugpy",
7 | "request": "launch",
8 | "module": "uvicorn",
9 | "args": ["api.service:app","--reload"],
10 | "cwd": "${workspaceFolder}",
11 | "justMyCode": false,
12 | },
13 | {
14 | "name": "PyDebug: Run Crew",
15 | "type": "debugpy",
16 | "request": "launch",
17 | "module": "github_resume_generator.main",
18 | "args": "markmcd",
19 | "cwd": "${workspaceFolder}",
20 | "justMyCode": false,
21 | },
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | We would love to accept your patches and contributions to this project.
4 |
5 | ## Before you begin
6 |
7 | ### Sign our Contributor License Agreement
8 |
9 | Contributions to this project must be accompanied by a
10 | [Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
11 | You (or your employer) retain the copyright to your contribution; this simply
12 | gives us permission to use and redistribute your contributions as part of the
13 | project.
14 |
15 | If you or your current employer have already signed the Google CLA (even if it
16 | was for a different project), you probably don't need to do it again.
17 |
18 | Visit to see your current agreements or to
19 | sign a new one.
20 |
21 | ### Review our Community Guidelines
22 |
23 | This project follows [Google's Open Source Community
24 | Guidelines](https://opensource.google/conduct/).
25 |
26 | ## Contribution process
27 |
28 | ### Code Reviews
29 |
30 | All submissions, including submissions by project members, require review. We
31 | use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
32 | for this purpose.
33 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.11-slim-bookworm
2 |
3 | WORKDIR /app
4 |
5 | # Install uv
6 | RUN pip install uv
7 |
8 | # Copy project config files.
9 | COPY pyproject.toml .
10 | COPY uv.lock .
11 |
12 | # Install dependencies using uv. Speeds up runtime.
13 | RUN uv sync --no-dev
14 |
15 | COPY src/ .
16 |
17 | # Cloud Run requires your application to listen on the PORT environment variable
18 | # which it automatically injects. Default is 8080.
19 | ENV PORT 8080
20 | EXPOSE $PORT
21 |
22 | # And run!
23 | CMD ["uv", "run", "uvicorn", "api.service:app", "--host", "0.0.0.0", "--port", "8080", "--workers", "1"]
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GitHub Resume Generator - Gemini API x CrewAI
2 |
3 | Use the [Gemini API](https://ai.google.dev/gemini-api/) and [CrewAI](https://crewai.com)
4 | to generate a CV/Resume from a GitHub profile, using CrewAI to manage
5 | a crew of agents, and using the Gemini API with Google Search Grounding to
6 | research and write the content.
7 |
8 | ## Demo
9 |
10 | 
11 |
12 | *The app in action: Enter a GitHub username and watch as AI agents research and generate a professional resume*
13 |
14 | ## How it works
15 |
16 | A crew is defined that follows a short plan:
17 |
18 | * Research the user's GitHub profile
19 | * Research any projects from the profile
20 | * Generate a CV/Resume in Markdown format
21 |
22 | You can see the CrewAI configuration in [the config
23 | dir](src/github_resume_generator/config/). Also check out the [custom LLM
24 | class](src/github_resume_generator/crew.py) that uses the `google_search` tool
25 | with CrewAI.
26 |
27 | The agents all use the Gemini API, by default [Gemini 2.5
28 | Flash](https://ai.google.dev/gemini-api/docs/models#gemini-2.5-flash-preview).
29 | The agent defined for the research task uses the Gemini API's [Google Search
30 | Grounding](https://ai.google.dev/gemini-api/docs/grounding) feature to look up
31 | any relevant information on the supplied user's GitHub profile. This is easy to
32 | implement, runs pretty quickly and can grab any relevant GitHub information from
33 | around the web.
34 |
35 | The Crew is wrapped in a FastAPI that serves a streaming endpoint. This API
36 | streams progress updates to indicate as tasks complete, and eventually returns a
37 | message with the resume, in markdown.
38 |
39 | The web frontend is just a static HTML page that calls the API and renders
40 | updates. If you want to develop something more complex, the API is serving the
41 | HTML as a static route, so you can deploy a separate web app pointed at the API.
42 |
43 | ## Installation
44 |
45 | This project uses [UV](https://docs.astral.sh/uv/) for Python dependency management and package handling.
46 |
47 | ### Initial setup
48 |
49 | First, if you haven't already, install `uv`:
50 |
51 | ```bash
52 | pipx install uv
53 | ```
54 |
55 | > [!NOTE]
56 | > Check out the extensive list of [`uv` installation options](https://docs.astral.sh/uv/getting-started/installation/#installation-methods), including instructions for macOS, Windows, Docker and more.
57 |
58 | Next, navigate to your project directory and install the dependencies:
59 |
60 | ```bash
61 | uv sync
62 | ```
63 |
64 | #### API key
65 |
66 | Grab an API key from [Google AI Studio](https://aistudio.google.com/apikey) and
67 | add it to the `.env` file as `GEMINI_API_KEY`.
68 |
69 | ```bash
70 | cp .env.example .env
71 | # Now edit .env and add add your key to the GEMINI_API_KEY line.
72 | ```
73 |
74 | You can now choose to run the API service locally or with Docker. Read one of
75 | the the next two sections depending on what you prefer. Docker will need to be
76 | installed, or just run locally using the already-installed tools.
77 |
78 | ### Run locally
79 |
80 | Run the service. Use `--reload` to automatically refresh while you're editing.
81 |
82 | ```bash
83 | uv run uvicorn api.service:app --reload
84 | ```
85 |
86 | With the API server running, browse to http://localhost:8000/
87 |
88 | ### Docker
89 |
90 | To build and run a docker image locally, using a specified API key:
91 |
92 | ```bash
93 | docker build -t resume-generator-backend-local:latest .
94 | docker run -p 8000:8080 -e GEMINI_API_KEY=your_api_key_here --name my-resume-generator-app-local resume-generator-backend-local:latest
95 | ```
96 |
97 | With the API server running, browse to the docker port, http://localhost:8080/
98 |
99 | The Docker container can also be deployed directly to [Google Cloud Run](https://cloud.google.com/run).
100 |
101 | ## Running the Crew
102 |
103 | To run your crew of AI agents directly, without an API server, run this from the root folder of your project. Pass your GitHub username as the last argument to generate their resume.
104 |
105 | ```bash
106 | uv run github_resume_generator yourgithubusername
107 | ```
108 |
109 | You will get a markdown file created in the same directory, `yourgithubusername_resume.md`. Load it in your favourite markdown renderer, e.g. [`glow`](https://github.com/charmbracelet/glow).
110 |
111 |
112 | ## Disclaimer
113 |
114 | This is not an officially supported Google product. This project is not eligible for the [Google Open Source Software Vulnerability Rewards Program](https://bughunters.google.com/open-source-security).
115 |
116 | This project is intended for demonstration purposes only. It is not intended for use in a production environment.
117 |
118 |
--------------------------------------------------------------------------------
/assets/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google-gemini/crewai-quickstart/5978d64a90e488f252601a6a63aabf67ada6a8a4/assets/demo.gif
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "github_resume_generator"
3 | version = "0.1.0"
4 | description = "Demo of Gemini 2.5 with Search Grounding using CrewAI to generate Resumes from GitHub" # Updated description
5 | authors = [{ name = "Mark McDonald", email = "macd@google.com" }]
6 | requires-python = ">=3.10,<3.13"
7 | dependencies = [
8 | "crewai[tools]>=0.119.0,<1.0.0",
9 | "fastapi>=0.115.12",
10 | "uvicorn>=0.34.2",
11 | ]
12 |
13 | [project.scripts]
14 | github_resume_generator = "github_resume_generator.main:run"
15 | run_crew = "github_resume_generator.main:run"
16 | train = "github_resume_generator.main:train"
17 | replay = "github_resume_generator.main:replay"
18 | test = "github_resume_generator.main:test"
19 |
20 | [build-system]
21 | requires = ["hatchling"]
22 | build-backend = "hatchling.build"
23 |
24 | [tool.hatch.build.targets.wheel]
25 | packages = ["src/github_resume_generator", "src/api", "src/static"]
26 |
27 |
28 | [tool.crewai]
29 | type = "crew"
30 |
--------------------------------------------------------------------------------
/src/api/service.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import asyncio
16 | import json
17 | import pathlib
18 | import re
19 | import traceback
20 |
21 | from crewai.agents.parser import AgentFinish
22 | from crewai.tasks.task_output import TaskOutput
23 | from fastapi import FastAPI
24 | from fastapi.responses import HTMLResponse, RedirectResponse, StreamingResponse
25 | from fastapi.staticfiles import StaticFiles
26 | import urllib.parse
27 |
28 | from github_resume_generator.crew import GithubResumeGenerator
29 |
30 |
31 | STATIC_DIR = pathlib.Path(__file__).parent.parent / "static"
32 | INDEX_HTML_PATH = STATIC_DIR / "index.html"
33 | KEEPALIVE_INTERVAL_SECS = 5
34 | MAX_KEEPALIVE_SECS = 120
35 |
36 | app = FastAPI()
37 | app.mount("/r", StaticFiles(directory=STATIC_DIR), name="static")
38 |
39 |
40 | async def _process_resume(username: str, output_queue: asyncio.Queue):
41 | """Starts the resume generation crew, pushing progress to the queue."""
42 | await output_queue.put({'event': 'progress_update',
43 | 'status': 'started'})
44 |
45 | resume_loop = asyncio.get_running_loop()
46 |
47 | def update_hook(msg: TaskOutput | AgentFinish) -> None:
48 | if isinstance(msg, AgentFinish):
49 | print(json.dumps({
50 | 'thought': msg.thought,
51 | 'output': msg.output,
52 | 'text': msg.text
53 | }))
54 | return
55 |
56 | resume_loop.call_soon_threadsafe(
57 | lambda: asyncio.create_task(output_queue.put({
58 | 'event': 'progress_update',
59 | 'task': msg.name,
60 | 'summary': msg.summary,
61 | 'status': 'task_done'
62 | }))
63 | )
64 |
65 | crew = GithubResumeGenerator().crew(task_callback=update_hook, step_callback=update_hook)
66 |
67 | result = await crew.kickoff_async(inputs=dict(username=username))
68 | await output_queue.put({'status': 'completed', 'output': result.raw})
69 |
70 |
71 | @app.get("/resume")
72 | async def process_resume_stream(username: str):
73 | """Handle resume API request, with streamed progress events."""
74 |
75 | username, *_ = re.split(r'\s+', username.strip())
76 | username = username[:128]
77 |
78 | async def generate_updates():
79 | update_queue = asyncio.Queue()
80 | resume_task = asyncio.create_task(_process_resume(username, update_queue))
81 | data_task = asyncio.create_task(update_queue.get())
82 | heartbeat_task = asyncio.create_task(asyncio.sleep(KEEPALIVE_INTERVAL_SECS))
83 |
84 | try:
85 | while True:
86 | done, pending = await asyncio.wait(
87 | [data_task, heartbeat_task],
88 | return_when=asyncio.FIRST_COMPLETED,
89 | timeout=MAX_KEEPALIVE_SECS,
90 | )
91 |
92 | if data_task in done:
93 | update = await data_task
94 | print(json.dumps(update))
95 |
96 | output = ''
97 | if event := update.pop('event', None):
98 | output += f'event: {event}\n'
99 |
100 | output += f"data: {json.dumps(update)}\n\n"
101 | yield output
102 | data_task = asyncio.create_task(update_queue.get())
103 |
104 | if update.get('status') == 'completed':
105 | break
106 |
107 | elif heartbeat_task in done:
108 | yield "event: ping\ndata: {}\n\n"
109 | heartbeat_task = asyncio.create_task(asyncio.sleep(KEEPALIVE_INTERVAL_SECS))
110 |
111 | elif not done and pending:
112 | raise asyncio.TimeoutError("Stream timed out.")
113 |
114 | except asyncio.TimeoutError:
115 | yield f"data: {json.dumps({'status': 'error', 'message': 'Stream timed out.'})}\n\n"
116 | print("Stream timed out: No updates received.")
117 |
118 | except Exception as e:
119 | yield f"data: {json.dumps({'status': 'error', 'message': f'An error occurred: {str(e)}'})}\n\n"
120 | print(f"Error during streaming: {e}")
121 | print(json.dumps({
122 | "type": type(e).__name__,
123 | "message": str(e),
124 | "traceback": traceback.format_exc()
125 | }))
126 |
127 | finally:
128 | if not resume_task.done():
129 | resume_task.cancel()
130 | if not heartbeat_task.done():
131 | heartbeat_task.cancel()
132 | if not data_task.done():
133 | data_task.cancel()
134 |
135 | await asyncio.gather(resume_task, heartbeat_task, return_exceptions=True)
136 |
137 | return StreamingResponse(generate_updates(), media_type="text/event-stream")
138 |
139 |
140 | @app.get("/")
141 | async def home_page(username: str | None = None):
142 | """Redirect to the index in the static dir."""
143 | with open(INDEX_HTML_PATH, 'r', encoding='utf-8') as f:
144 | html_content = f.read()
145 | return HTMLResponse(content=html_content, status_code=200)
146 |
--------------------------------------------------------------------------------
/src/github_resume_generator/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/google-gemini/crewai-quickstart/5978d64a90e488f252601a6a63aabf67ada6a8a4/src/github_resume_generator/__init__.py
--------------------------------------------------------------------------------
/src/github_resume_generator/config/agents.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | github_profile_researcher:
16 | role: GitHub Profile Analyst
17 | goal: >
18 | Analyze the GitHub user @{username}'s profile to identify key information
19 | relevant for a CV/Resume. This includes repositories, contributions,
20 | languages used, and profile information.
21 | backstory: >
22 | You are an expert at dissecting GitHub profiles to extract meaningful
23 | data for professional summaries. You can quickly identify a user's
24 | strengths, primary areas of focus, and notable projects.
25 |
26 | resume_writer:
27 | role: Technical Resume Generator
28 | goal: >
29 | Generate a concise and professional CV/Resume in Markdown format for
30 | GitHub user @{username}, based on the research data provided.
31 | The resume should highlight key skills, projects, and contributions.
32 | backstory: >
33 | You are a skilled writer specializing in creating impactful technical
34 | resumes. You know how to present technical information in a clear,
35 | compelling, and professional manner, tailored for a Markdown format.
36 |
--------------------------------------------------------------------------------
/src/github_resume_generator/config/tasks.yaml:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | profile_research_task:
16 | description: >
17 | Conduct a thorough analysis of GitHub user @{username}'s profile.
18 | Extract information about their public repositories (name, description,
19 | languages, stars, forks), contribution activity (commits, pull requests,
20 | issues to their own and other repos), and profile details (bio, location,
21 | website, organizations).
22 | expected_output: >
23 | A structured summary of the user's GitHub profile, including a list of
24 | key repositories with their details, contribution statistics, and relevant
25 | profile information.
26 | agent: github_profile_researcher
27 |
28 | resume_generation_task:
29 | description: >
30 | Using the GitHub profile research, generate a professional CV/Resume
31 | for @{username} in Markdown format. The resume should include sections like
32 | Summary/Objective, Skills (derived from languages and project descriptions),
33 | Projects (highlighting 2-3 key repositories), and Contributions.
34 | expected_output: >
35 | A well-formatted Markdown document representing the user's CV/Resume.
36 | The resume should be professional, concise, and accurately reflect the
37 | gathered data. DO NOT embed the output in a ```markdown block. Just raw markdown.
38 | Make sure there are no thoughts or planning in the output, just the resume.
39 | agent: resume_writer
40 |
--------------------------------------------------------------------------------
/src/github_resume_generator/crew.py:
--------------------------------------------------------------------------------
1 | # Copyright 2025 Google LLC
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import os
16 | from typing import Any
17 |
18 | from crewai import Agent, Crew, LLM, Process, Task
19 | from crewai.project import CrewBase, agent, crew, task
20 | from crewai.agents.agent_builder.base_agent import BaseAgent
21 |
22 | MODEL = 'gemini/gemini-2.5-flash-preview-04-17'
23 |
24 |
25 | class GeminiWithGoogleSearch(LLM):
26 | """A Gemini-specific LLM that has the 'google_search' tool enabled.
27 |
28 | This tool has some quota included on the "free tier" of the API, so you
29 | can use Google Search as a tool in your app without needing an additional
30 | service.
31 |
32 | Be sure to read the docs on using the Google Search grounding tool at
33 | https://ai.google.dev/gemini-api/docs/grounding.
34 | """
35 |
36 | def __init__(self, model: str | None = None, **kwargs):
37 | if not model:
38 | # Use a default Gemini model.
39 | model = os.getenv('MODEL', 'gemini/gemini-2.5-flash-preview-04-17')
40 |
41 | super().__init__(model, **kwargs)
42 |
43 | def call(
44 | self,
45 | messages: str | list[dict[str, str]],
46 | tools: list[dict] | None = None,
47 | callbacks: list[Any] | None = None,
48 | available_functions: dict[str, Any] | None = None,
49 | ) -> str | Any:
50 | if not tools:
51 | tools = []
52 |
53 | # LiteLLM will throw a warning if it sees `google_search`, so use camel case here.
54 | tools.insert(0, {'googleSearch': {}})
55 |
56 | return super().call(
57 | messages=messages,
58 | tools=tools,
59 | callbacks=callbacks,
60 | available_functions=available_functions
61 | )
62 |
63 |
64 | @CrewBase
65 | class GithubResumeGenerator:
66 | """GithubResumeGenerator crew"""
67 |
68 | agents: list[BaseAgent]
69 | tasks: list[Task]
70 |
71 | @agent
72 | def github_profile_researcher(self) -> Agent:
73 | gemini_with_search = GeminiWithGoogleSearch(model=MODEL)
74 | return Agent(
75 | config=self.agents_config['github_profile_researcher'],
76 | llm=gemini_with_search,
77 | verbose=True,
78 | )
79 |
80 | @agent
81 | def resume_writer(self) -> Agent:
82 | return Agent(
83 | config=self.agents_config['resume_writer'],
84 | verbose=True,
85 | llm=MODEL,
86 | )
87 |
88 | @task
89 | def profile_research_task(self) -> Task:
90 | return Task(
91 | config=self.tasks_config['profile_research_task'],
92 | )
93 |
94 | @task
95 | def resume_generation_task(self) -> Task:
96 | return Task(
97 | config=self.tasks_config['resume_generation_task'],
98 | # output_file='resume.md' # Optional: define output file for the resume
99 | )
100 |
101 | @crew
102 | def crew(self, **kwargs) -> Crew:
103 | """Creates the GithubResumeGenerator crew"""
104 | return Crew(
105 | agents=self.agents, # type: ignore[reportCallIssue]
106 | tasks=self.tasks, # type: ignore[reportCallIssue]
107 | process=Process.sequential,
108 | verbose=True,
109 | **kwargs,
110 | )
111 |
--------------------------------------------------------------------------------
/src/github_resume_generator/main.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # Copyright 2025 Google LLC
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 |
16 | import json
17 | import pathlib
18 | import sys
19 |
20 | from github_resume_generator.crew import GithubResumeGenerator
21 |
22 |
23 | def run(username: str = ''):
24 | """
25 | Run the crew.
26 | """
27 | if not username:
28 | username = sys.argv[1]
29 | if not username:
30 | # I volunteer as tribute.
31 | username = 'markmcd'
32 |
33 | inputs = {
34 | 'username': username,
35 | }
36 |
37 | try:
38 | result = GithubResumeGenerator().crew().kickoff(inputs=inputs)
39 |
40 | # Save the results.
41 | md_file = pathlib.Path(f'{username}_resume.md')
42 | md_file.write_text(result.raw)
43 | full_output = pathlib.Path(f'{username}_resume.json')
44 | full_output.write_text(json.dumps(
45 | [t.model_dump(exclude_none=True) for t in result.tasks_output]))
46 |
47 | except Exception as e:
48 | raise Exception(f"An error occurred while running the crew: {e}")
49 |
50 |
51 | def train():
52 | """
53 | Train the crew for a given number of iterations.
54 | """
55 | inputs = {
56 | 'username': 'markmcd',
57 | }
58 | try:
59 | GithubResumeGenerator().crew().train(n_iterations=int(sys.argv[1]), filename=sys.argv[2], inputs=inputs)
60 |
61 | except Exception as e:
62 | raise Exception(f"An error occurred while training the crew: {e}")
63 |
64 |
65 | def replay():
66 | """
67 | Replay the crew execution from a specific task.
68 | """
69 | try:
70 | GithubResumeGenerator().crew().replay(task_id=sys.argv[1])
71 |
72 | except Exception as e:
73 | raise Exception(f"An error occurred while replaying the crew: {e}")
74 |
75 |
76 | def test():
77 | """
78 | Test the crew execution and returns the results.
79 | """
80 | inputs = {
81 | 'username': 'markmcd',
82 | }
83 |
84 | try:
85 | GithubResumeGenerator().crew().test(n_iterations=int(sys.argv[1]), eval_llm=sys.argv[2], inputs=inputs)
86 |
87 | except Exception as e:
88 | raise Exception(f"An error occurred while testing the crew: {e}")
89 |
90 |
91 | if __name__ == '__main__':
92 | run(sys.argv[1])
93 |
--------------------------------------------------------------------------------
/src/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |