glean-agent-toolkit 0.2.0__tar.gz → 0.3.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.
- glean_agent_toolkit-0.3.0/.cz.toml +8 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/.github/workflows/publish.yml +1 -1
- glean_agent_toolkit-0.3.0/.markdown-coderc.json +14 -0
- glean_agent_toolkit-0.3.0/.pre-commit-config.yaml +23 -0
- glean_agent_toolkit-0.3.0/AGENTS.md +55 -0
- glean_agent_toolkit-0.3.0/CHANGELOG.md +16 -0
- glean_agent_toolkit-0.3.0/COMMIT_LINTING.md +166 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/PKG-INFO +150 -35
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/README.md +146 -32
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/RELEASE.md +7 -3
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/Taskfile.yml +41 -2
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/pyproject.toml +16 -6
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-01.bash +1 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-01.py +41 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-02.bash +4 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-02.py +1 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-03.bash +1 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-03.py +22 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-04.bash +2 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-04.py +43 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-05.bash +2 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-05.py +36 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-06.bash +2 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-06.py +9 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-07.bash +11 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-07.py +9 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-08.py +10 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-09.py +10 -0
- glean_agent_toolkit-0.3.0/snippets/readme/snippet-10.py +38 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/decorators.py +134 -64
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/_common.py +78 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/tools/ai_web_search.py +28 -5
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/calendar_search.py +49 -0
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/code_search.py +51 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/tools/employee_search.py +31 -6
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/glean_search.py +50 -0
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/gmail_search.py +47 -0
- glean_agent_toolkit-0.3.0/src/glean/agent_toolkit/tools/outlook_search.py +47 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/tools/web_search.py +25 -5
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_common.py +5 -2
- glean_agent_toolkit-0.3.0/tests/test_enhanced_schemas.py +171 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_schema_generation.py +28 -16
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_ai_web_search.py +6 -12
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_calendar_search.py +10 -17
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_code_search.py +5 -11
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_employee_search.py +10 -17
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_glean_search.py +2 -6
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_gmail_search.py +6 -12
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_outlook_search.py +5 -10
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/test_web_search.py +6 -13
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/uv.lock +372 -248
- glean_agent_toolkit-0.2.0/.cz.toml +0 -5
- glean_agent_toolkit-0.2.0/CHANGELOG.md +0 -5
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/_common.py +0 -36
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/calendar_search.py +0 -18
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/code_search.py +0 -29
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/glean_search.py +0 -26
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/gmail_search.py +0 -23
- glean_agent_toolkit-0.2.0/src/glean/agent_toolkit/tools/outlook_search.py +0 -23
- glean_agent_toolkit-0.2.0/workflows/python-package.yml +0 -46
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/.env.template +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/.github/workflows/ci.yml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/.gitignore +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/.vscode/settings.json +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/CODEOWNERS +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/CONTRIBUTING.md +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/LICENSE +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/mise.toml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/pyrightconfig.json +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/__init__.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/__init__.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/adk.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/base.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/crewai.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/langchain.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/adapters/openai.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/py.typed +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/registry.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/spec.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/src/glean/agent_toolkit/tools/__init__.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/__init__.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_complex_query.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_no_results.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_various_queries[blockchain applications].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_various_queries[cloud computing trends].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_various_queries[cybersecurity best practices].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_various_queries[machine learning frameworks 2025].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_ai_web_search_various_queries[sustainable technology solutions].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_by_attendee.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_by_date_range.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_no_results.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_various_queries[client demo presentation].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_various_queries[conference room bookings].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_various_queries[one-on-one meetings].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_various_queries[quarterly business review].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_calendar_search_various_queries[sprint planning meeting].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_complex_query.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_empty_query.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_various_queries[API endpoint security].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_various_queries[class UserManager].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_various_queries[database connection pool].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_various_queries[error handling middleware].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_code_search_various_queries[function login validation].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_by_department.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_by_role.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_no_results.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_various_queries[Sarah Johnson product manager].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_various_queries[UX designer mobile apps].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_various_queries[data scientist machine learning].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_various_queries[frontend developer React].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_employee_search_various_queries[security engineer DevOps].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_glean_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_glean_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_no_emails_found.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_various_queries[invoice from vendor].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_various_queries[meeting invitations].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_various_queries[password reset emails].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_various_queries[security alerts].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_various_queries[urgent emails from manager].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_with_filters[before:2025/01/01].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_with_filters[from:boss@company.com].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_with_filters[has:attachment].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_with_filters[label:important].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_gmail_search_with_filters[subject:urgent].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_calendar_events.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_no_results.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_various_queries[all-hands meeting].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_various_queries[budget review meeting].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_various_queries[client presentation tomorrow].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_various_queries[project deadline reminder].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_outlook_search_various_queries[team standup calendar].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_api_error.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_news_query.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_no_results.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_specific_domain.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_success.yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_various_queries[API design patterns].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_various_queries[Docker container deployment].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_various_queries[JavaScript frameworks comparison].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_various_queries[database optimization techniques].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/cassettes/test_web_search_various_queries[mobile app development].yaml +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/conftest.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_adapters.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_decorators.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_registry.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/test_toolspec.py +0 -0
- {glean_agent_toolkit-0.2.0 → glean_agent_toolkit-0.3.0}/tests/tools/__init__.py +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/commitizen-tools/commitizen
|
|
3
|
+
rev: v4.4.1
|
|
4
|
+
hooks:
|
|
5
|
+
- id: commitizen
|
|
6
|
+
stages: [commit-msg]
|
|
7
|
+
|
|
8
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
9
|
+
rev: v4.5.0
|
|
10
|
+
hooks:
|
|
11
|
+
- id: trailing-whitespace
|
|
12
|
+
- id: end-of-file-fixer
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
- id: check-added-large-files
|
|
15
|
+
- id: check-merge-conflict
|
|
16
|
+
- id: debug-statements
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
19
|
+
rev: v0.5.0
|
|
20
|
+
hooks:
|
|
21
|
+
- id: ruff
|
|
22
|
+
args: [--fix]
|
|
23
|
+
- id: ruff-format
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Agent Guidelines
|
|
2
|
+
|
|
3
|
+
This project contains the **Glean Agent Toolkit**, a Python package used to integrate Glean's search and discovery tools with various agent frameworks.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Install the prerequisites:
|
|
8
|
+
- [uv](https://github.com/astral-sh/uv)
|
|
9
|
+
- [go-task](https://taskfile.dev/)
|
|
10
|
+
2. Run `task setup` to create the `.venv` and install all development, test, lint and typing dependencies via `uv`.
|
|
11
|
+
|
|
12
|
+
Environment variables `GLEAN_API_TOKEN` and `GLEAN_INSTANCE` must be set to interact with Glean or regenerate VCR cassettes.
|
|
13
|
+
|
|
14
|
+
## Development Tasks
|
|
15
|
+
|
|
16
|
+
The repository uses **go-task**. Key commands from `Taskfile.yml` include:
|
|
17
|
+
|
|
18
|
+
| Task | Description |
|
|
19
|
+
|------|-------------|
|
|
20
|
+
| `task test` | Run unit tests |
|
|
21
|
+
| `task test:watch` | Run tests in watch mode |
|
|
22
|
+
| `task test:cov` | Run tests with coverage |
|
|
23
|
+
| `task test:all` | Run tests, apply lint fixes, and run pyright |
|
|
24
|
+
| `task lint` | Run Ruff, formatting checks and pyright |
|
|
25
|
+
| `task lint:diff` | Lint only changed files |
|
|
26
|
+
| `task lint:fix` | Apply Ruff fixes and formatting |
|
|
27
|
+
| `task format` | Format code using Ruff formatter |
|
|
28
|
+
| `task spell:check` | Check spelling |
|
|
29
|
+
| `task clean` | Remove build artifacts |
|
|
30
|
+
| `task build` | Build the package |
|
|
31
|
+
| `task release` | Bump version and generate the changelog |
|
|
32
|
+
|
|
33
|
+
Special tasks exist to manage VCR cassettes used in tests:
|
|
34
|
+
|
|
35
|
+
- `task test:vcr:regenerate` – Re-record all HTTP interactions (requires `GLEAN_API_TOKEN` and `GLEAN_INSTANCE`).
|
|
36
|
+
- `task test:vcr:clean` – Delete cassettes so the next test run regenerates them.
|
|
37
|
+
|
|
38
|
+
## Coding Guidelines
|
|
39
|
+
|
|
40
|
+
- Python **>=3.10** is required. The project enforces formatting with Ruff. Line length is limited to **100** characters and double quotes are used by default.
|
|
41
|
+
- Docstrings follow the **Google** style as configured in `pyproject.toml`.
|
|
42
|
+
- Type checking is performed with **pyright**.
|
|
43
|
+
- Tools should be implemented using the `@tool_spec` decorator found in `glean.agent_toolkit.decorators`. See existing tools under `src/glean/agent_toolkit/tools` for examples.
|
|
44
|
+
|
|
45
|
+
## Contribution Process
|
|
46
|
+
|
|
47
|
+
1. Fork the repository and create a branch from `main`.
|
|
48
|
+
2. Make your changes and ensure all tasks run cleanly (`task test` and `task lint`).
|
|
49
|
+
3. Update or add documentation when necessary.
|
|
50
|
+
4. Submit a pull request.
|
|
51
|
+
5. Be respectful and follow the project's code of conduct.
|
|
52
|
+
|
|
53
|
+
## Additional Notes
|
|
54
|
+
|
|
55
|
+
Check the [README](README.md) for feature descriptions and basic usage. The package is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## 0.3.0 (2025-07-21)
|
|
2
|
+
|
|
3
|
+
### Feat
|
|
4
|
+
|
|
5
|
+
- Add enhanced parameter schemas with Field metadata support
|
|
6
|
+
|
|
7
|
+
### Fix
|
|
8
|
+
|
|
9
|
+
- Adds newline to .cz.toml
|
|
10
|
+
- Fixes type errors during task:lint
|
|
11
|
+
|
|
12
|
+
## 0.2.0 (2025-06-05)
|
|
13
|
+
|
|
14
|
+
### Feat
|
|
15
|
+
|
|
16
|
+
- Implements Agent Builder tools as defaults
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Commit Linting Setup
|
|
2
|
+
|
|
3
|
+
This project uses conventional commits with pre-commit hooks to ensure all commits follow the proper format.
|
|
4
|
+
|
|
5
|
+
## What is Conventional Commits?
|
|
6
|
+
|
|
7
|
+
Conventional Commits is a specification for commit messages that provides a standardized way to write commit messages. This makes it easier to:
|
|
8
|
+
|
|
9
|
+
- Automatically generate changelogs
|
|
10
|
+
- Determine semantic version bumps
|
|
11
|
+
- Communicate the nature of changes to teammates
|
|
12
|
+
|
|
13
|
+
Format: `<type>(<scope>): <description>`
|
|
14
|
+
|
|
15
|
+
Examples:
|
|
16
|
+
|
|
17
|
+
- `feat: add new search functionality`
|
|
18
|
+
- `fix(auth): resolve login issue`
|
|
19
|
+
- `docs: update README with new examples`
|
|
20
|
+
- `refactor(api): simplify response handling`
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
### 1. Install Dependencies
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Install all dependencies including pre-commit
|
|
28
|
+
task setup
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This will:
|
|
32
|
+
|
|
33
|
+
- Install Python dependencies with `uv`
|
|
34
|
+
- Install pre-commit hooks automatically
|
|
35
|
+
|
|
36
|
+
### 2. Manual Pre-commit Setup (if needed)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Install pre-commit hooks
|
|
40
|
+
task pre-commit:install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Available Tools
|
|
44
|
+
|
|
45
|
+
### Pre-commit Hooks
|
|
46
|
+
|
|
47
|
+
Pre-commit hooks run automatically before each commit and will:
|
|
48
|
+
|
|
49
|
+
- Validate commit message format using Commitizen
|
|
50
|
+
- Run code formatting and linting with Ruff
|
|
51
|
+
- Check for common issues (trailing whitespace, merge conflicts, etc.)
|
|
52
|
+
|
|
53
|
+
**Commands:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Run pre-commit hooks on all files
|
|
57
|
+
task pre-commit:run
|
|
58
|
+
|
|
59
|
+
# Run pre-commit hooks on changed files only
|
|
60
|
+
task pre-commit:run:diff
|
|
61
|
+
|
|
62
|
+
# Update pre-commit hooks to latest versions
|
|
63
|
+
task pre-commit:update
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Making Commits
|
|
67
|
+
|
|
68
|
+
### Option 1: Use Commitizen (Recommended)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Interactive commit creation
|
|
72
|
+
uv run python -m commitizen commit
|
|
73
|
+
|
|
74
|
+
# Or use the shorthand
|
|
75
|
+
uv run cz commit
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
This will guide you through creating a conventional commit interactively.
|
|
79
|
+
|
|
80
|
+
### Option 2: Manual Commits
|
|
81
|
+
|
|
82
|
+
You can write commits manually, but they must follow the conventional commit format:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git commit -m "feat: add new feature"
|
|
86
|
+
git commit -m "fix(auth): resolve login issue"
|
|
87
|
+
git commit -m "docs: update API documentation"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Option 3: Use Pre-commit with Conventional Commits
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Write your commit message
|
|
94
|
+
git add .
|
|
95
|
+
git commit -m "your message here"
|
|
96
|
+
|
|
97
|
+
# Pre-commit will validate and potentially fix issues
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Note:** Pre-commit hooks will automatically run and validate your commit message format.
|
|
101
|
+
|
|
102
|
+
## Commit Types
|
|
103
|
+
|
|
104
|
+
- `feat`: A new feature
|
|
105
|
+
- `fix`: A bug fix
|
|
106
|
+
- `docs`: Documentation only changes
|
|
107
|
+
- `style`: Changes that do not affect the meaning of the code
|
|
108
|
+
- `refactor`: A code change that neither fixes a bug nor adds a feature
|
|
109
|
+
- `perf`: A code change that improves performance
|
|
110
|
+
- `test`: Adding missing tests or correcting existing tests
|
|
111
|
+
- `build`: Changes that affect the build system or external dependencies
|
|
112
|
+
- `ci`: Changes to CI configuration files and scripts
|
|
113
|
+
- `chore`: Other changes that don't modify src or test files
|
|
114
|
+
- `revert`: Reverts a previous commit
|
|
115
|
+
|
|
116
|
+
## Troubleshooting
|
|
117
|
+
|
|
118
|
+
### Pre-commit Hook Not Running
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Reinstall pre-commit hooks
|
|
122
|
+
task pre-commit:install
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Commit Message Validation Failing
|
|
126
|
+
|
|
127
|
+
1. Use Commitizen for interactive commit creation:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
uv run python -m commitizen commit
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. Check the conventional commit format:
|
|
134
|
+
|
|
135
|
+
- Must start with a type: `feat`, `fix`, `docs`, etc.
|
|
136
|
+
- Optional scope in parentheses: `(auth)`, `(api)`, etc.
|
|
137
|
+
- Colon and space: `: `
|
|
138
|
+
- Description: `add new feature`
|
|
139
|
+
|
|
140
|
+
3. Examples of valid commits:
|
|
141
|
+
```bash
|
|
142
|
+
git commit -m "feat: add new search functionality"
|
|
143
|
+
git commit -m "fix(auth): resolve login timeout issue"
|
|
144
|
+
git commit -m "docs: update installation instructions"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Skipping Validation (Emergency Only)
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Skip pre-commit hooks (not recommended)
|
|
151
|
+
git commit -m "your message" --no-verify
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Configuration Files
|
|
155
|
+
|
|
156
|
+
- `.pre-commit-config.yaml`: Pre-commit hooks configuration
|
|
157
|
+
- `.cz.toml`: Commitizen configuration
|
|
158
|
+
- `pyproject.toml`: Project dependencies including pre-commit
|
|
159
|
+
|
|
160
|
+
## Benefits
|
|
161
|
+
|
|
162
|
+
1. **Consistent History**: All commits follow the same format
|
|
163
|
+
2. **Automated Changelogs**: Commitizen can generate changelogs automatically
|
|
164
|
+
3. **Semantic Versioning**: Automatic version bumping based on commit types
|
|
165
|
+
4. **Better Collaboration**: Clear communication about what each commit does
|
|
166
|
+
5. **Local Validation**: Immediate feedback before commits are made
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: glean-agent-toolkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: AI Agent toolkit for adapting Glean's enterprise tools across multiple frameworks
|
|
5
5
|
Project-URL: Source Code, https://github.com/gleanwork/glean-agent-toolkit
|
|
6
6
|
Author-email: Steve Calvert <steve.calvert@glean.com>
|
|
@@ -10,7 +10,7 @@ Requires-Python: <4.0,>=3.10
|
|
|
10
10
|
Requires-Dist: glean-api-client<1.0,>=0.6.0
|
|
11
11
|
Requires-Dist: pydantic<3.0,>=2.7
|
|
12
12
|
Provides-Extra: adk
|
|
13
|
-
Requires-Dist: google-adk<
|
|
13
|
+
Requires-Dist: google-adk<2.0,>=1.7.0; extra == 'adk'
|
|
14
14
|
Provides-Extra: codespell
|
|
15
15
|
Requires-Dist: codespell<3.0,>=2.2.6; extra == 'codespell'
|
|
16
16
|
Provides-Extra: crewai
|
|
@@ -18,6 +18,7 @@ Requires-Dist: crewai<1.0,>=0.28.0; extra == 'crewai'
|
|
|
18
18
|
Provides-Extra: dev
|
|
19
19
|
Requires-Dist: commitizen<5.0,>=4.4.1; extra == 'dev'
|
|
20
20
|
Requires-Dist: pip-audit<3.0,>=2.6.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pre-commit<4.0,>=3.6.0; extra == 'dev'
|
|
21
22
|
Requires-Dist: vcrpy<7.0,>=6.0.2; extra == 'dev'
|
|
22
23
|
Provides-Extra: langchain
|
|
23
24
|
Requires-Dist: langchain<1.0,>=0.1.0; extra == 'langchain'
|
|
@@ -28,7 +29,7 @@ Requires-Dist: openai-agents<1.0,>=0.0.11; extra == 'openai'
|
|
|
28
29
|
Requires-Dist: openai<2.0,>=1.0.0; extra == 'openai'
|
|
29
30
|
Provides-Extra: test
|
|
30
31
|
Requires-Dist: crewai<1.0,>=0.28.0; extra == 'test'
|
|
31
|
-
Requires-Dist: google-adk<
|
|
32
|
+
Requires-Dist: google-adk<2.0,>=1.7.0; extra == 'test'
|
|
32
33
|
Requires-Dist: langchain<1.0,>=0.1.0; extra == 'test'
|
|
33
34
|
Requires-Dist: openai-agents<1.0,>=0.0.11; extra == 'test'
|
|
34
35
|
Requires-Dist: openai<2.0,>=1.0.0; extra == 'test'
|
|
@@ -54,13 +55,13 @@ The Glean Agent Toolkit makes it easy to integrate Glean's powerful search and k
|
|
|
54
55
|
|
|
55
56
|
Install the base toolkit:
|
|
56
57
|
|
|
57
|
-
```bash
|
|
58
|
+
```bash snippet=readme/snippet-01.bash
|
|
58
59
|
pip install glean-agent-toolkit
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
To include support for specific agent frameworks, install the relevant extras:
|
|
62
63
|
|
|
63
|
-
```bash
|
|
64
|
+
```bash snippet=readme/snippet-02.bash
|
|
64
65
|
pip install glean-agent-toolkit[openai]
|
|
65
66
|
pip install glean-agent-toolkit[adk]
|
|
66
67
|
pip install glean-agent-toolkit[langchain]
|
|
@@ -69,7 +70,7 @@ pip install glean-agent-toolkit[crewai]
|
|
|
69
70
|
|
|
70
71
|
You can also install all extras:
|
|
71
72
|
|
|
72
|
-
```bash
|
|
73
|
+
```bash snippet=readme/snippet-03.bash
|
|
73
74
|
pip install glean-agent-toolkit[all]
|
|
74
75
|
```
|
|
75
76
|
|
|
@@ -81,11 +82,112 @@ Before using any Glean tools, you'll need:
|
|
|
81
82
|
|
|
82
83
|
1. **Glean API credentials**: Obtain these from your Glean administrator
|
|
83
84
|
2. **Environment variables**:
|
|
85
|
+
|
|
84
86
|
```bash
|
|
85
87
|
export GLEAN_API_TOKEN="your-api-token"
|
|
86
88
|
export GLEAN_INSTANCE="your-instance-name"
|
|
87
89
|
```
|
|
88
90
|
|
|
91
|
+
## Quickstart Example: Company Assistant with Google ADK
|
|
92
|
+
|
|
93
|
+
Here's a complete example that demonstrates the power of the Glean Agent Toolkit. We'll build a "Company Assistant" using Google's Agent Development Kit (ADK) that can help employees find information, discover colleagues, and search company resources.
|
|
94
|
+
|
|
95
|
+
### Step 1: Create Project Directory
|
|
96
|
+
|
|
97
|
+
First, create the project structure:
|
|
98
|
+
|
|
99
|
+
```bash snippet=readme/snippet-04.bash
|
|
100
|
+
export GLEAN_API_TOKEN="your-api-token"
|
|
101
|
+
export GLEAN_INSTANCE="your-instance-name"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Step 2: Create the Agent File
|
|
105
|
+
|
|
106
|
+
Create `company_assistant/agent.py` with your agent definition:
|
|
107
|
+
|
|
108
|
+
```python snippet=readme/snippet-01.py
|
|
109
|
+
import os
|
|
110
|
+
|
|
111
|
+
from google.adk.agents import Agent
|
|
112
|
+
|
|
113
|
+
from glean.agent_toolkit.tools import calendar_search, employee_search, glean_search, gmail_search
|
|
114
|
+
|
|
115
|
+
# Ensure environment variables are set
|
|
116
|
+
required_env_vars = ["GLEAN_API_TOKEN", "GLEAN_INSTANCE"]
|
|
117
|
+
for var in required_env_vars:
|
|
118
|
+
if not os.getenv(var):
|
|
119
|
+
raise ValueError(f"{var} environment variable must be set")
|
|
120
|
+
|
|
121
|
+
# For Google ADK, you also need authentication
|
|
122
|
+
# Either set GOOGLE_API_KEY for Google AI Studio, or use gcloud auth for Vertex AI
|
|
123
|
+
if not os.getenv("GOOGLE_API_KEY") and not os.getenv("GOOGLE_CLOUD_PROJECT"):
|
|
124
|
+
raise ValueError("Either GOOGLE_API_KEY or GOOGLE_CLOUD_PROJECT must be set for ADK")
|
|
125
|
+
|
|
126
|
+
# Convert Glean tools to Google ADK format
|
|
127
|
+
company_search = glean_search.as_adk_tool()
|
|
128
|
+
people_finder = employee_search.as_adk_tool()
|
|
129
|
+
meeting_search = calendar_search.as_adk_tool()
|
|
130
|
+
email_search = gmail_search.as_adk_tool()
|
|
131
|
+
|
|
132
|
+
# Create a Company Assistant agent
|
|
133
|
+
root_agent = Agent(
|
|
134
|
+
name="company_assistant",
|
|
135
|
+
model="gemini-2.0-flash",
|
|
136
|
+
description="""Company Assistant that helps employees find information, people, and resources
|
|
137
|
+
within the organization.""",
|
|
138
|
+
instruction="""You are a helpful company assistant that helps employees find information,
|
|
139
|
+
people, and resources within the organization. You have access to:
|
|
140
|
+
|
|
141
|
+
- Company knowledge base and documents (use glean_search)
|
|
142
|
+
- Employee directory and contact information (use employee_search)
|
|
143
|
+
- Calendar and meeting information (use calendar_search)
|
|
144
|
+
- Email search capabilities (use gmail_search)
|
|
145
|
+
|
|
146
|
+
Always be helpful, professional, and respect privacy. When searching for people,
|
|
147
|
+
only share appropriate business contact information.""",
|
|
148
|
+
tools=[company_search, people_finder, meeting_search, email_search],
|
|
149
|
+
)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Step 3: Create Package Init File
|
|
153
|
+
|
|
154
|
+
Create `company_assistant/__init__.py` to import your agent:
|
|
155
|
+
|
|
156
|
+
```python snippet=readme/snippet-02.py
|
|
157
|
+
from . import agent
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Step 4: Configure Environment Variables
|
|
161
|
+
|
|
162
|
+
Create `company_assistant/.env` with your credentials:
|
|
163
|
+
|
|
164
|
+
```bash snippet=readme/snippet-05.bash
|
|
165
|
+
export GLEAN_API_TOKEN="your-api-token"
|
|
166
|
+
export GLEAN_INSTANCE="your-instance-name"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Step 5: Run Your Agent
|
|
170
|
+
|
|
171
|
+
From the parent directory (outside `company_assistant/`), run your Company Assistant:
|
|
172
|
+
|
|
173
|
+
```bash snippet=readme/snippet-06.bash
|
|
174
|
+
mkdir company_assistant/
|
|
175
|
+
cd company_assistant/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Real-World Queries You Can Handle
|
|
179
|
+
|
|
180
|
+
Once set up, your Company Assistant can handle requests like:
|
|
181
|
+
|
|
182
|
+
- *"Find our security guidelines for handling customer data"*
|
|
183
|
+
- *"Who's the product manager for the mobile app team?"*
|
|
184
|
+
- *"Show me emails about the budget planning meeting from last week"*
|
|
185
|
+
- *"I need the engineering team's architecture docs for the payment system"*
|
|
186
|
+
- *"Find all the design review meetings scheduled for this month"*
|
|
187
|
+
- *"Who worked on the API authentication project? I need to ask them some questions"*
|
|
188
|
+
|
|
189
|
+
This type of assistant can dramatically improve employee productivity by making company knowledge instantly accessible through natural conversation.
|
|
190
|
+
|
|
89
191
|
## Available Tools
|
|
90
192
|
|
|
91
193
|
The toolkit comes with a suite of production-ready tools that connect to various Glean functionalities:
|
|
@@ -105,11 +207,13 @@ The toolkit comes with a suite of production-ready tools that connect to various
|
|
|
105
207
|
|
|
106
208
|
#### OpenAI Agents SDK
|
|
107
209
|
|
|
108
|
-
```python
|
|
210
|
+
```python snippet=readme/snippet-03.py
|
|
109
211
|
import os
|
|
110
|
-
|
|
212
|
+
|
|
111
213
|
from agents import Agent, Runner
|
|
112
214
|
|
|
215
|
+
from glean.agent_toolkit.tools import glean_search
|
|
216
|
+
|
|
113
217
|
# Ensure environment variables are set
|
|
114
218
|
assert os.getenv("GLEAN_API_TOKEN"), "GLEAN_API_TOKEN must be set"
|
|
115
219
|
assert os.getenv("GLEAN_INSTANCE"), "GLEAN_INSTANCE must be set"
|
|
@@ -118,8 +222,9 @@ assert os.getenv("OPENAI_API_KEY"), "OPENAI_API_KEY must be set"
|
|
|
118
222
|
# Create an agent with the Glean search tool
|
|
119
223
|
agent = Agent(
|
|
120
224
|
name="KnowledgeAssistant",
|
|
121
|
-
instructions="You help users find information from the company knowledge base using
|
|
122
|
-
|
|
225
|
+
instructions="""You help users find information from the company knowledge base using
|
|
226
|
+
Glean search.""",
|
|
227
|
+
tools=[glean_search], # Use the tool function directly
|
|
123
228
|
)
|
|
124
229
|
|
|
125
230
|
# Run a search query
|
|
@@ -129,12 +234,14 @@ print(f"Search results: {result.final_output}")
|
|
|
129
234
|
|
|
130
235
|
#### LangChain
|
|
131
236
|
|
|
132
|
-
```python
|
|
237
|
+
```python snippet=readme/snippet-04.py
|
|
133
238
|
import os
|
|
134
|
-
|
|
135
|
-
from langchain_openai import ChatOpenAI
|
|
239
|
+
|
|
136
240
|
from langchain.agents import AgentExecutor, create_react_agent
|
|
137
241
|
from langchain_core.prompts import ChatPromptTemplate
|
|
242
|
+
from langchain_openai import ChatOpenAI
|
|
243
|
+
|
|
244
|
+
from glean.agent_toolkit.tools import glean_search
|
|
138
245
|
|
|
139
246
|
# Ensure environment variables are set
|
|
140
247
|
assert os.getenv("GLEAN_API_TOKEN"), "GLEAN_API_TOKEN must be set"
|
|
@@ -175,10 +282,12 @@ print(result["output"])
|
|
|
175
282
|
|
|
176
283
|
#### CrewAI
|
|
177
284
|
|
|
178
|
-
```python
|
|
285
|
+
```python snippet=readme/snippet-05.py
|
|
179
286
|
import os
|
|
287
|
+
|
|
288
|
+
from crewai import Agent, Crew, Task
|
|
289
|
+
|
|
180
290
|
from glean.agent_toolkit.tools import glean_search
|
|
181
|
-
from crewai import Agent, Task, Crew
|
|
182
291
|
|
|
183
292
|
# Ensure environment variables are set
|
|
184
293
|
assert os.getenv("GLEAN_API_TOKEN"), "GLEAN_API_TOKEN must be set"
|
|
@@ -191,16 +300,19 @@ crewai_tool = glean_search.as_crewai_tool()
|
|
|
191
300
|
researcher = Agent(
|
|
192
301
|
role="Corporate Knowledge Researcher",
|
|
193
302
|
goal="Find and summarize relevant company information",
|
|
194
|
-
backstory="You are an expert at navigating company knowledge bases to find accurate,
|
|
303
|
+
backstory="""You are an expert at navigating company knowledge bases to find accurate,
|
|
304
|
+
up-to-date information.""",
|
|
195
305
|
tools=[crewai_tool],
|
|
196
|
-
verbose=True
|
|
306
|
+
verbose=True,
|
|
197
307
|
)
|
|
198
308
|
|
|
199
309
|
# Create a research task
|
|
200
310
|
research_task = Task(
|
|
201
|
-
description="Find information about our company's remote work policy and summarize the key
|
|
202
|
-
|
|
203
|
-
|
|
311
|
+
description="""Find information about our company's remote work policy and summarize the key
|
|
312
|
+
points.""",
|
|
313
|
+
expected_output="""A clear summary of the remote work policy including eligibility,
|
|
314
|
+
expectations, and guidelines.""",
|
|
315
|
+
agent=researcher,
|
|
204
316
|
)
|
|
205
317
|
|
|
206
318
|
# Execute the research
|
|
@@ -213,7 +325,7 @@ print(result)
|
|
|
213
325
|
|
|
214
326
|
#### Employee Directory Search
|
|
215
327
|
|
|
216
|
-
```python
|
|
328
|
+
```python snippet=readme/snippet-06.py
|
|
217
329
|
from glean.agent_toolkit.tools import employee_search
|
|
218
330
|
|
|
219
331
|
# Find engineering team members
|
|
@@ -227,7 +339,7 @@ engineering_team = employee_search.as_langchain_tool()
|
|
|
227
339
|
|
|
228
340
|
#### Code Discovery
|
|
229
341
|
|
|
230
|
-
```python
|
|
342
|
+
```python snippet=readme/snippet-07.py
|
|
231
343
|
from glean.agent_toolkit.tools import code_search
|
|
232
344
|
|
|
233
345
|
# Search company codebases
|
|
@@ -241,8 +353,8 @@ code_tool = code_search.as_langchain_tool()
|
|
|
241
353
|
|
|
242
354
|
#### Email and Calendar Integration
|
|
243
355
|
|
|
244
|
-
```python
|
|
245
|
-
from glean.agent_toolkit.tools import
|
|
356
|
+
```python snippet=readme/snippet-08.py
|
|
357
|
+
from glean.agent_toolkit.tools import calendar_search, gmail_search
|
|
246
358
|
|
|
247
359
|
# Search emails and meetings
|
|
248
360
|
gmail_tool = gmail_search.as_langchain_tool()
|
|
@@ -256,8 +368,8 @@ calendar_tool = calendar_search.as_langchain_tool()
|
|
|
256
368
|
|
|
257
369
|
#### Web Research with Context
|
|
258
370
|
|
|
259
|
-
```python
|
|
260
|
-
from glean.agent_toolkit.tools import
|
|
371
|
+
```python snippet=readme/snippet-09.py
|
|
372
|
+
from glean.agent_toolkit.tools import ai_web_search, web_search
|
|
261
373
|
|
|
262
374
|
# External information gathering
|
|
263
375
|
web_tool = web_search.as_langchain_tool()
|
|
@@ -273,10 +385,14 @@ ai_web_tool = ai_web_search.as_langchain_tool()
|
|
|
273
385
|
|
|
274
386
|
Define your own tools that work across all supported frameworks:
|
|
275
387
|
|
|
276
|
-
```python
|
|
277
|
-
|
|
278
|
-
|
|
388
|
+
```python snippet=readme/snippet-10.py
|
|
389
|
+
import os
|
|
390
|
+
|
|
279
391
|
import requests
|
|
392
|
+
from pydantic import BaseModel
|
|
393
|
+
|
|
394
|
+
from glean.agent_toolkit import tool_spec
|
|
395
|
+
|
|
280
396
|
|
|
281
397
|
class WeatherResponse(BaseModel):
|
|
282
398
|
temperature: float
|
|
@@ -284,10 +400,11 @@ class WeatherResponse(BaseModel):
|
|
|
284
400
|
humidity: int
|
|
285
401
|
city: str
|
|
286
402
|
|
|
403
|
+
|
|
287
404
|
@tool_spec(
|
|
288
405
|
name="get_current_weather",
|
|
289
406
|
description="Get current weather information for a specified city",
|
|
290
|
-
output_model=WeatherResponse
|
|
407
|
+
output_model=WeatherResponse,
|
|
291
408
|
)
|
|
292
409
|
def get_weather(city: str, units: str = "celsius") -> WeatherResponse:
|
|
293
410
|
"""Fetch current weather for a city."""
|
|
@@ -297,14 +414,12 @@ def get_weather(city: str, units: str = "celsius") -> WeatherResponse:
|
|
|
297
414
|
f"https://api.weather.com/v1/current?key={api_key}&q={city}&units={units}"
|
|
298
415
|
)
|
|
299
416
|
data = response.json()
|
|
300
|
-
|
|
417
|
+
|
|
301
418
|
return WeatherResponse(
|
|
302
|
-
temperature=data["temp"],
|
|
303
|
-
condition=data["condition"],
|
|
304
|
-
humidity=data["humidity"],
|
|
305
|
-
city=city
|
|
419
|
+
temperature=data["temp"], condition=data["condition"], humidity=data["humidity"], city=city
|
|
306
420
|
)
|
|
307
421
|
|
|
422
|
+
|
|
308
423
|
# Use across frameworks
|
|
309
424
|
openai_weather = get_weather.as_openai_tool()
|
|
310
425
|
langchain_weather = get_weather.as_langchain_tool()
|