From be5542ca495dac3f0fe9c35822e43d75cd1fa0ae Mon Sep 17 00:00:00 2001 From: Kye Gomez <98760976+kyegomez@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:52:42 -0500 Subject: [PATCH] Initial commit --- .env.example | 3 + .github/FUNDING.yml | 13 ++ .github/ISSUE_TEMPLATE/bug_report.md | 27 +++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++ .github/PULL_REQUEST_TEMPLATE.md | 29 +++ .github/action.yml | 33 +++ .github/dependabot.yml | 12 ++ .github/labeler.yml | 34 +++ .github/workflows/RELEASE.yml | 47 +++++ .github/workflows/autofix.yml | 25 +++ .github/workflows/codacy.yml | 45 ++++ .github/workflows/codeql.yml | 41 ++++ .github/workflows/docs-preview.yml | 16 ++ .github/workflows/docs.yml | 24 +++ .github/workflows/label.yml | 20 ++ .github/workflows/lint.yml | 33 +++ .github/workflows/python-package.yml | 40 ++++ .github/workflows/stale.yml | 49 +++++ .github/workflows/test.yml | 60 ++++++ .github/workflows/welcome.yml | 22 ++ .gitignore | 224 ++++++++++++++++++++ LICENSE | 21 ++ README.md | 52 +++++ agents.yaml | 240 ++++++++++++++++++++++ main.py | 37 ++++ requirements.txt | 5 + 26 files changed, 1172 insertions(+) create mode 100644 .env.example create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/action.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/RELEASE.yml create mode 100644 .github/workflows/autofix.yml create mode 100644 .github/workflows/codacy.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/docs-preview.yml create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/label.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/stale.yml create mode 100644 .github/workflows/test.yml create mode 100644 .github/workflows/welcome.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 agents.yaml create mode 100644 main.py create mode 100644 requirements.txt diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..c959721 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +# Set your task in the .env file or pass it in the yaml file on the bottom `task:` +WORKSPACE_DIR="agent_workspace" +GROQ_API_KEY="" \ No newline at end of file diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..17d44f5 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +--- +# These are supported funding model platforms +github: [kyegomez] +# patreon: # Replace with a single Patreon username +# open_collective: # Replace with a single Open Collective username +# ko_fi: # Replace with a single Ko-fi username +# tidelift: # Replace with a single Tidelift platform-name/package-name +# community_bridge: # Replace with a single Community Bridge project-name +# liberapay: # Replace with a single Liberapay username +# issuehunt: # Replace with a single IssueHunt username +# otechie: # Replace with a single Otechie username +# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name +# custom: #Nothing diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..41ddcb3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[BUG] " +labels: bug +assignees: kyegomez + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..806abd7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: 'kyegomez' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..7dc861a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ +Thank you for contributing to Swarms! + +Replace this comment with: + - Description: a description of the change, + - Issue: the issue # it fixes (if applicable), + - Dependencies: any dependencies required for this change, + - Tag maintainer: for a quicker response, tag the relevant maintainer (see below), + - Twitter handle: we announce bigger features on Twitter. If your PR gets announced and you'd like a mention, we'll gladly shout you out! + +Please make sure your PR is passing linting and testing before submitting. Run `make format`, `make lint` and `make test` to check this locally. + +See contribution guidelines for more information on how to write/run tests, lint, etc: +https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md + +If you're adding a new integration, please include: + 1. a test for the integration, preferably unit tests that do not rely on network access, + 2. an example notebook showing its use. + + +Maintainer responsibilities: + - General / Misc / if you don't know who to tag: kye@apac.ai + - DataLoaders / VectorStores / Retrievers: kye@apac.ai + - swarms.models: kye@apac.ai + - swarms.memory: kye@apac.ai + - swarms.structures: kye@apac.ai + +If no one reviews your PR within a few days, feel free to email Kye at kye@apac.ai + +See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/kyegomez/swarms \ No newline at end of file diff --git a/.github/action.yml b/.github/action.yml new file mode 100644 index 0000000..4158bc8 --- /dev/null +++ b/.github/action.yml @@ -0,0 +1,33 @@ +--- +name: "Init Environment" +description: "Initialize environment for tests" +runs: + using: "composite" + steps: + - name: Checkout actions + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{hashFiles('**/poetry.lock') }} + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root --with test --with dev --all-extras + shell: bash + - name: Activate venv + run: | + source .venv/bin/activate + echo PATH=$PATH >> $GITHUB_ENV + shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3b36594 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +--- +# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..99dd5c2 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,34 @@ +--- +documentation: + - changed-files: + - any-glob-to-any-file: ["docs/**", "*.md"] +tests: + - changed-files: + - any-glob-to-any-file: "tests/**" +agents: + - changed-files: + - any-glob-to-any-file: "swarms/agents/**" +artifacts: + - changed-files: + - any-glob-to-any-file: "swarms/artifacts/**" +memory: + - changed-files: + - any-glob-to-any-file: "swarms/memory/**" +models: + - changed-files: + - any-glob-to-any-file: "swarms/models/**" +prompts: + - changed-files: + - any-glob-to-any-file: "swarms/prompts/**" +structs: + - changed-files: + - any-glob-to-any-file: "swarms/structs/**" +telemetry: + - changed-files: + - any-glob-to-any-file: "swarms/telemetry/**" +tools: + - changed-files: + - any-glob-to-any-file: "swarms/tools/**" +utils: + - changed-files: + - any-glob-to-any-file: "swarms/utils/**" diff --git a/.github/workflows/RELEASE.yml b/.github/workflows/RELEASE.yml new file mode 100644 index 0000000..059ec93 --- /dev/null +++ b/.github/workflows/RELEASE.yml @@ -0,0 +1,47 @@ +--- +name: release +on: + pull_request: + types: + - closed + branches: + - master + paths: + - "pyproject.toml" +env: + POETRY_VERSION: "1.4.2" +jobs: + if_release: + if: | + ${{ github.event.pull_request.merged == true }} + && ${{ contains(github.event.pull_request.labels.*.name, 'release') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION + - name: Set up Python 3.9 + uses: actions/setup-python@v5 + with: + python-version: "3.9" + cache: "poetry" + - name: Build project for distribution + run: poetry build + - name: Check Version + id: check-version + run: | + echo version=$(poetry version --short) >> $GITHUB_OUTPUT + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + generateReleaseNotes: true + tag: v${{ steps.check-version.outputs.version }} + commit: master + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} + run: |- + poetry publish diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..2112973 --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,25 @@ +name: autofix.ci + +on: + pull_request: + push: + branches: ["main"] +permissions: + contents: read + +jobs: + autofix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + - run: go install github.com/google/yamlfmt/cmd/yamlfmt@latest + - run: yamlfmt . + + - uses: actions/setup-python@v5 + - run: pip install ruff + - run: ruff format . + - run: ruff check --fix . + + - uses: autofix-ci/action@dd55f44df8f7cdb7a6bf74c78677eb8acd40cd0a diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml new file mode 100644 index 0000000..06d9d87 --- /dev/null +++ b/.github/workflows/codacy.yml @@ -0,0 +1,45 @@ +--- +name: Codacy +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + schedule: + - cron: "0 0 * * " + +permissions: + contents: read + +jobs: + codacy-security-scan: + permissions: + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + name: Codacy Security Scan + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis + - name: Run Codacy Analysis CLI + uses: codacy/codacy-analysis-cli-action@97bf5df3c09e75f5bcd72695998f96ebd701846e + with: + # Check https://github.com/codacy/codacy-analysis-cli#project-token to + # get your project token from your Codacy repository + # You can also omit the token and run the tools that support default configurations + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + verbose: true + output: results.sarif + format: sarif + # Adjust severity of non-security issues + gh-code-scanning-compat: true + # Force 0 exit code to allow SARIF file generation + # This will handover control about PR rejection to the GitHub side + max-allowed-issues: 2147483647 + # Upload the SARIF file generated in the previous step + - name: Upload SARIF results file + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..b93db34 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +--- +name: "CodeQL" +on: + push: + branches: ["master"] + pull_request: + # The branches below must be a subset of the branches above + branches: ["master"] + schedule: + - cron: "33 12 * * 5" +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ubuntu-latest + timeout-minutes: 360 + permissions: + actions: read + contents: read + security-events: write + strategy: + fail-fast: false + matrix: + language: ["python"] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml new file mode 100644 index 0000000..037fd35 --- /dev/null +++ b/.github/workflows/docs-preview.yml @@ -0,0 +1,16 @@ +name: Documentation Links +on: + pull_request_target: + types: + - opened + +permissions: + pull-requests: write + +jobs: + documentation-links: + runs-on: ubuntu-latest + steps: + - uses: readthedocs/actions/preview@v1 + with: + project-slug: "swarms" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..17e8b50 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,24 @@ +name: Documentation +on: + push: + branches: + - master + - main + - develop +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.11 + - run: pip install mkdocs-material + - run: pip install mkdocs-glightbox + - run: pip install "mkdocstrings[python]" + - run: pip3 install mkdocs-git-authors-plugin + - run: pip install mkdocs-jupyter==0.16.0 + - run: pip install --upgrade lxml_html_clean + - run: pip install mkdocs-git-committers-plugin + - run: pip3 install mkdocs-git-revision-date-localized-plugin + - run: mkdocs gh-deploy --force -f docs/mkdocs.yml diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 0000000..d8ab919 --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,20 @@ +--- +# This workflow will triage pull requests and apply a label based on the +# paths that are modified in the pull request. +# +# To use this workflow, you will need to set up a .github/labeler.yml +# file with configuration. For more information, see: +# https://github.com/actions/labeler + +name: Labeler +on: [pull_request_target] +jobs: + label: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/labeler@v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..f2295d0 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,33 @@ +--- +name: Lint +on: [push, pull_request] # yamllint disable-line rule:truthy +jobs: + yaml-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - run: pip install yamllint + - run: yamllint . + flake8-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - run: pip install flake8 + - run: flake8 . + ruff-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - run: pip install ruff + - run: ruff format . + - run: ruff check --fix . + pylint-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - run: pip install pylint + - run: pylint swarms --recursive=y diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..6e563af --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,40 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..a1ab3b3 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,49 @@ +--- +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Stale +on: + schedule: + # Scheduled to run at 1.30 UTC everyday + - cron: "0 0 * * *" +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-issue-stale: 14 + days-before-issue-close: 14 + stale-issue-label: "status:stale" + close-issue-reason: not_planned + any-of-labels: "status:awaiting user response,status:more data needed" + stale-issue-message: > + Marking this issue as stale since it has been open for 14 days with no + activity. This issue will be closed if no further activity occurs. + + close-issue-message: > + This issue was closed because it has been inactive for 28 days. Please + post a new issue if you need further assistance. Thanks! + + days-before-pr-stale: 14 + days-before-pr-close: 14 + stale-pr-label: "status:stale" + stale-pr-message: > + Marking this pull request as stale since it has been open for 14 days + with no activity. This PR will be closed if no further activity occurs. + + close-pr-message: > + This pull request was closed because it has been inactive for 28 days. + Please open a new pull request if you need further assistance. Thanks! + + # Label that can be assigned to issues to exclude them from being marked as stale + exempt-issue-labels: "override-stale" + # Label that can be assigned to PRs to exclude them from being marked as stale + exempt-pr-labels: "override-stale" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d5e053d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: Tests +on: + push: + schedule: + - cron: "0 0 * * *" +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Setup a local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v4 + name: Define a cache for the virtual environment + file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install + - name: Install OpenCV + run: sudo apt-get install python3-opencv + - name: Enter the virtual environment + run: source $VENV + - name: Run the tests + run: poetry run pytest --verbose + run-examples: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + - name: Install Poetry + uses: snok/install-poetry@v1 + - name: Setup a local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - uses: actions/cache@v4 + name: Define a cache for the virtual environment + file + with: + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install the project dependencies + run: poetry install + - name: Install OpenCV + run: sudo apt-get install python3-opencv + - name: Enter the virtual environment + run: source $VENV + - name: Make Script Executable and Run + run: |- + chmod +x ./scripts/run_examples.sh + ./scripts/run_examples.sh diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml new file mode 100644 index 0000000..dd16f9c --- /dev/null +++ b/.github/workflows/welcome.yml @@ -0,0 +1,22 @@ +--- +name: Welcome +on: + issues: + types: [opened] + pull_request_target: + types: [opened] +jobs: + build: + name: 👋 Welcome + permissions: write-all + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1.3.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: + "Hello there, thank you for opening an Issue ! 🙏🏻 The team + was notified and they will get back to you asap." + pr-message: + "Hello there, thank you for opening an PR ! 🙏🏻 The team was + notified and they will get back to you asap." diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..097d546 --- /dev/null +++ b/.gitignore @@ -0,0 +1,224 @@ +__pycache__/ +.venv/ + +.env + +image/ +audio/ +video/ +artifacts_three +dataframe/ +agent_workspace +static/generated +runs +Financial-Analysis-Agent_state.json +artifacts_five +encryption +errors +chroma +agent_workspace +.pt +Accounting Assistant_state.json +Unit Testing Agent_state.json +sec_agent +Devin_state.json +poetry.lock +hire_researchers +agent_workspace +json_logs +Medical Image Diagnostic Agent_state.json +flight agent_state.json +D_state.json +artifacts_six +artifacts_seven +swarms/__pycache__ +artifacts_once +transcript_generator.json +venv +.DS_Store +Cargo.lock +.DS_STORE +artifacts_logs +Cargo.lock +Medical Treatment Recommendation Agent_state.json +swarms/agents/.DS_Store +artifacts_two +logs +T_state.json +_build +conversation.txt +t1_state.json +stderr_log.txt +t2_state.json +.vscode +.DS_STORE +# Byte-compiled / optimized / DLL files +Transcript Generator_state.json +__pycache__/ +*.py[cod] +*$py.class +.grit +swarm-worker-01_state.json +error.txt +Devin Worker 2_state.json +# C extensions +*.so +.ruff_cache + + +errors.txt + +Autonomous-Agent-XYZ1B_state.json +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py +.DS_Store +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ +.vscode/settings.json diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ca69c7e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Eternal Reclaimer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c97b150 --- /dev/null +++ b/README.md @@ -0,0 +1,52 @@ + +# Swarms-Example-1-Click-Template + +[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb) + + +[![GitHub stars](https://img.shields.io/github/stars/The-Swarm-Corporation/Legal-Swarm-Template?style=social)](https://github.com/The-Swarm-Corporation/Legal-Swarm-Template) +[![Swarms Framework](https://img.shields.io/badge/Built%20with-Swarms-blue)](https://github.com/kyegomez/swarms) + + + +## 🚀 Quick Start + +```bash +# Clone the repository +git clone https://github.com/The-Swarm-Corporation/Swarms-Example-1-Click-Template.git + +# Install requirements +pip3 install -r requirements.txt + +# Set your task in the .env file or pass it in the yaml file on the bottom `task:` +export WORKSPACE_DIR="agent_workspace" +export GROQ_API_KEY="" + +# Run the swarm +python3 main.py +``` + + +## 🛠 Built With + +- [Swarms Framework](https://github.com/kyegomez/swarms) +- Python 3.10+ +- GROQ API Key or you can change it to use any model from [Swarm Models](https://github.com/The-Swarm-Corporation/swarm-models) + +## 📬 Contact + +Questions? Reach out: +- Twitter: [@kyegomez](https://twitter.com/kyegomez) +- Email: kye@swarms.world + +--- + +## Want Real-Time Assistance? + +[Book a call with here for real-time assistance:](https://cal.com/swarms/swarms-onboarding-session) + +--- + +⭐ Star us on GitHub if this project helped you! + +Built with ♥ using [Swarms Framework](https://github.com/kyegomez/swarms) diff --git a/agents.yaml b/agents.yaml new file mode 100644 index 0000000..3f751e4 --- /dev/null +++ b/agents.yaml @@ -0,0 +1,240 @@ +agents: + - agent_name: "Legal-Requirements-Analysis-Agent" + system_prompt: | + You are a legal requirements analysis specialist. Your role is to gather and analyze all necessary information before contract creation. Follow these steps: + + 1. Initial Consultation: + - Identify contract type and purpose + - Gather party information and requirements + - Determine jurisdiction and applicable laws + - Identify industry-specific regulations + - Document special requirements or conditions + + 2. Risk Assessment: + - Identify potential legal risks + - Analyze business implications + - Review regulatory requirements + - Assess compliance needs + - Document risk mitigation strategies + + 3. Requirements Documentation: + - Create detailed requirements checklist + - List mandatory clauses + - Identify optional provisions + - Document deal-specific terms + - Note jurisdiction-specific requirements + + Output Format: + - Comprehensive requirements document + - Risk assessment matrix + - Compliance checklist + - Jurisdiction-specific considerations + - Special instructions for contract generation + max_loops: 1 + autosave: true + verbose: true + context_length: 250000 + output_type: "str" + + - agent_name: "Legal-Contract-Generator-Agent" + system_prompt: | + You are a specialized contract generation agent. Create comprehensive legal documents based on requirements analysis. Follow these steps: + + 1. Contract Structure: + - Draft standard clauses + - Incorporate custom provisions + - Include jurisdiction-specific language + - Add industry-specific terms + - Structure document properly + + 2. Essential Components for All Contracts: + - Clear definitions section + - Detailed party information + - Rights and obligations + - Term and termination + - Payment terms (if applicable) + - Representations and warranties + - Indemnification provisions + - Limitation of liability + - Force majeure + - Governing law + - Dispute resolution + - Amendment procedures + - Notice requirements + - Entire agreement clause + - Severability provision + - Assignment rights + - Signature blocks + + 3. Specialized Provisions: + - Industry-specific clauses + - Regulatory compliance language + - Risk mitigation provisions + - Custom requirements + - Special conditions + + 4. Document Formatting: + - Professional layout + - Clear section numbering + - Consistent formatting + - Table of contents + - Page numbering + - Exhibit/Schedule references + + Always ensure: + - Plain language when possible + - Defined terms consistency + - Cross-reference accuracy + - Complete signature blocks + - Proper clause numbering + max_loops: 1 + autosave: true + verbose: true + context_length: 300000 + output_type: "str" + + - agent_name: "Legal-Review-and-Optimization-Agent" + system_prompt: | + You are a contract review and optimization specialist. Analyze and improve contract drafts following these steps: + + 1. Comprehensive Review: + - Legal compliance check + - Risk assessment + - Language clarity + - Internal consistency + - Defined terms usage + - Cross-reference accuracy + - Formatting consistency + + 2. Optimization Areas: + - Legal protection enhancement + - Risk mitigation improvements + - Language clarity + - Structural organization + - Redundancy elimination + - Gap identification + - Ambiguity resolution + + 3. Quality Control: + - Grammar and spelling + - Formatting consistency + - Definition completeness + - Cross-reference accuracy + - Exhibit/Schedule completeness + - Signature block verification + + 4. Documentation: + - Review summary + - Change recommendations + - Risk assessment report + - Compliance verification + - Improvement suggestions + + Always provide: + - Detailed review notes + - Specific recommendations + - Risk assessment matrix + - Compliance checklist + - Implementation guide + max_loops: 1 + autosave: true + verbose: true + context_length: 250000 + output_type: "str" + + - agent_name: "Legal-Compliance-Verification-Agent" + system_prompt: | + You are a legal compliance verification specialist. Ensure contracts meet all regulatory requirements following these steps: + + 1. Regulatory Analysis: + - Jurisdiction requirements + - Industry regulations + - International laws (if applicable) + - Local statutes and ordinances + - Recent legal updates + + 2. Compliance Verification: + - Mandatory clause check + - Regulatory language review + - Industry standard alignment + - Disclosure requirements + - Notice provisions + + 3. Documentation Requirements: + - Filing requirements + - Registration needs + - Notice obligations + - Record-keeping rules + - Reporting requirements + + 4. Compliance Report: + - Detailed compliance checklist + - Required modifications + - Documentation needs + - Filing instructions + - Ongoing compliance requirements + + Always include: + - Compliance summary + - Required actions list + - Timeline for compliance + - Documentation checklist + - Maintenance requirements + max_loops: 1 + autosave: true + verbose: true + context_length: 250000 + output_type: "str" + + - agent_name: "Legal-Plain-Language-Translator-Agent" + system_prompt: | + You are a legal document translation specialist focusing on converting complex legal language into clear, understandable terms. Follow these steps: + + 1. Document Analysis: + - Identify complex legal terms + - Mark technical language + - Note industry jargon + - Highlight difficult concepts + - List key provisions + + 2. Translation Process: + - Simplify complex terms + - Clarify technical concepts + - Explain legal requirements + - Maintain legal accuracy + - Ensure clarity + + 3. Documentation: + - Side-by-side comparison + - Term glossary + - Explanation notes + - Summary of key points + - FAQ section + + 4. Quality Control: + - Accuracy verification + - Meaning preservation + - Clarity check + - Consistency review + - Usability assessment + + Always provide: + - Plain language summary + - Key terms explained + - Important provisions highlighted + - Practical implications + - Action items list + max_loops: 1 + autosave: true + verbose: true + context_length: 200000 + output_type: "str" + +swarm_architecture: + name: "Legal-Team-Swarm" + description: "A comprehensive legal team swarm for contract creation and management" + max_loops: 1 + swarm_type: "SequentialWorkflow" + task: "Create, review, and optimize a legal contract to hire employees from India while being an American Delaware C Corp The Galactic Swarm Corporation [TGSC] while ensuring compliance and clarity" + autosave: true + return_json: false \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..53404dd --- /dev/null +++ b/main.py @@ -0,0 +1,37 @@ +import os + +from dotenv import load_dotenv +from loguru import logger +from swarm_models import OpenAIChat + +from swarms.agents.create_agents_from_yaml import ( + create_agents_from_yaml, +) + +# Load environment variables +load_dotenv() + +# Path to your YAML file +yaml_file = "agents.yaml" + + +# Get the OpenAI API key from the environment variable +api_key = os.getenv("GROQ_API_KEY") + +# Model +model = OpenAIChat( + openai_api_base="https://api.groq.com/openai/v1", + openai_api_key=api_key, + model_name="llama-3.1-70b-versatile", + temperature=0.1, +) + +try: + # Create agents and run tasks (using 'both' to return agents and task results) + task_results = create_agents_from_yaml( + model=model, yaml_file=yaml_file, return_type="run_swarm" + ) + + logger.info(f"Results from agents: {task_results}") +except Exception as e: + logger.error(f"An error occurred: {e}") diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6bdfb33 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +swarms +loguru +python-dotenv +pyyaml +swarm-models \ No newline at end of file