WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: CI

on:
workflow_dispatch: {}
push:
branches: [ develop, main, 'feat/**' ]
pull_request:
branches: [ develop, main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Upgrade pip, setuptools, wheel
run: |
python -m pip install --upgrade pip setuptools wheel

- name: Install build backend (hatchling)
run: |
python -m pip install hatchling

- name: Install package (editable) with dev extras using constraints
run: |
python -m pip install -e '.[dev]' -c constraints.txt

- name: Run tests
run: |
python -m pytest -q

integration:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/feat/')
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Upgrade pip, setuptools, wheel
run: |
python -m pip install --upgrade pip setuptools wheel

- name: Install build backend (hatchling)
run: |
python -m pip install hatchling

- name: Install providers extra (constrained)
run: |
python -m pip install -e '.[providers]' -c constraints.txt

- name: Check for dependency issues
run: |
python -m pip check

- name: Provider smoke check
run: |
python -c "import sys, pkgutil; print('Providers installed:', [m.name for m in pkgutil.iter_modules() if m.name.startswith(('anthropic','google','e2b'))])"

- name: Write Google service account file (from secret)
if: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON != '' }}
env:
SA_JSON: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
run: |
# write the multi-line JSON from the secret into a file
printf '%s' "$SA_JSON" > $GITHUB_WORKSPACE/gcloud_sa.json
chmod 600 $GITHUB_WORKSPACE/gcloud_sa.json
shell: bash

- name: Run provider integration tests (guarded)
env:
# enable guarded integration tests in pytest
RUN_PROVIDERS_INTEGRATION: '1'
# point Google auth to the written service account file (if present)
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcloud_sa.json
# provider API keys (set these in repository secrets if needed)
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
run: |
python -m pytest tests/integration -q
60 changes: 60 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## Contributing & Provider Integrations

Thanks for contributing! This file contains a short note about the optional provider integrations and how CI handles them.

### Provider integrations (`providers` extra)

Some integrations (Google APIs, Anthropic, e2b code interpreter, and related libraries) are heavy and pull many transitive dependencies. To keep everyday development, contributor onboarding, and CI runs fast and deterministic these are provided as an optional extra named `providers`.

When to opt into `providers`:
- If you are developing or testing code that interacts with those provider APIs (e.g., Google GenAI, Anthropic, e2b), install the `providers` extra locally.
- If you are working on core features, UI, or small tools that don't call external providers, you do not need to install `providers`.

How to install locally (recommended with constraints):

```powershell
# Install only providers (use the repo constraints for deterministic resolution)
python -m pip install -e "[.providers]" -c constraints.txt

# Or install dev and providers when running tests that require providers
python -m pip install -e ".[dev]" -c constraints.txt
python -m pip install -e ".[providers]" -c constraints.txt
```

Notes:
- `constraints.txt` is included to pin heavy dependencies and avoid pip resolver backtracking. Use it in CI and locally when installing the `providers` extra.
- Provider integrations may require credentials or API keys. Do NOT add secrets to the repo. Use repository secrets in CI or local environment variables.

### CI behavior

- The default `test` job runs lightweight unit tests and installs the `dev` extras using `constraints.txt` to keep runs fast and deterministic.
- A separate `integration` job installs the `providers` extra (also using `constraints.txt`) and performs a quick smoke check and `pip check`. This job runs after `test` and is intended to verify provider installs in CI without running long integration suites by default.

If you are adding provider-specific integration tests that require credentials, please:

1. Add tests under `tests/integration/` (or a similar directory). Keep them separate from unit tests.
2. Guard tests that rely on external credentials with markers or environment checks so they are skipped when credentials are not present.
3. Add instructions in this file for any required secrets and which GitHub Actions secrets to set.

Thanks for keeping the repo tidy — small, focused installs make the project easier for everyone to contribute to.

## Repository secrets

If you want the guarded provider integration tests to run in CI, add the following repository secrets (recommended names) in GitHub:

- `GOOGLE_SERVICE_ACCOUNT_JSON` — the full multi-line service account JSON value. The CI job will write this into a file at runtime and set `GOOGLE_APPLICATION_CREDENTIALS` to point at it.
- `ANTHROPIC_API_KEY` — your Anthropic API key used by the Anthropic integration tests.
- `E2B_API_KEY` — your e2b/related provider API key used by e2b tests.

How to add secrets (GitHub UI):

1. Go to your repository on GitHub → `Settings` → `Secrets and variables` → `Actions`.
2. Click `New repository secret`.
3. Enter the **Name** (one of the names above) and paste the secret value (for `GOOGLE_SERVICE_ACCOUNT_JSON` paste the full JSON content).
4. Click `Add secret`.

Notes and safety:
- Never commit credentials or service account files into the repository.
- Only enable provider integration runs in CI on protected branches or from trusted PRs, since these tests require secrets and network access.
- The CI `integration` job will only run provider tests if the secrets are present and `RUN_PROVIDERS_INTEGRATION=1` is set in the job environment.

19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ II-Agent Chat also feature within II-Agent that lets you work across multiple mo
For the latest installation and deployment instructions, please refer to our [official guide](https://intelligent-internet.github.io/ii-agent-prod/)

[![Installation Guide](https://img.youtube.com/vi/wPpeJMbdGi4/maxresdefault.jpg)](https://www.youtube.com/watch?v=wPpeJMbdGi4)

## Optional provider integrations

Some integrations (Google APIs, Anthropic, e2b code interpreter, etc.) are heavy and have many transitive dependencies. To keep development and CI installs fast and deterministic, these are provided as an optional extra named `providers`.

To install the providers extra locally (recommended when you need provider integrations), use the `constraints.txt` included in the repository to avoid pip resolver backtracking:

```powershell
python -m pip install -e "[.providers]" -c constraints.txt
```

Or install both dev and providers when you need tests and provider integrations:

```powershell
python -m pip install -e ".[dev]" -c constraints.txt
python -m pip install -e ".[providers]" -c constraints.txt
```

If you prefer not to install providers, the project will still work for most development tasks without them.
14 changes: 14 additions & 0 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Constraints to limit pip resolver backtracking for heavy deps
# Pin commonly large, interdependent packages to known-compatible versions
# Adjust versions if CI or local environments require different pins.
google-api-python-client==2.186.0
google-api-core==2.28.1
google-auth==2.42.1
google-auth-httplib2==0.2.0
google-auth-oauthlib==1.2.3
googleapis-common-protos==1.72.0
proto-plus==1.26.1
protobuf==4.25.8
uritemplate==4.2.0
e2b-code-interpreter==1.2.0b5
e2b==1.2.0b5
3 changes: 3 additions & 0 deletions modules/sbll_knowledge_chain/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .tool_wrapper import KnowledgeChainTool

__all__ = ["KnowledgeChainTool"]
Loading