diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml
new file mode 100644
index 0000000000..61363f98aa
--- /dev/null
+++ b/.github/workflows/build-docs.yml
@@ -0,0 +1,68 @@
+name: Build docs
+
+on:
+ workflow_call:
+ inputs:
+ python-version:
+ description: 'Python version to use'
+ required: true
+ default: '3.10'
+ type: string
+ node-version:
+ description: 'Node version to use'
+ required: true
+ default: '18.x'
+ type: string
+
+jobs:
+ build-docs:
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: website
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ lfs: true
+ fetch-depth: 0
+ - uses: astral-sh/setup-uv@v5
+ with:
+ version: "latest"
+ - uses: actions/setup-node@v4
+ with:
+ node-version: ${{ github.event.inputs.node-version }}
+ - name: setup python
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ github.event.inputs.python-version }}
+
+ - name: Install quarto
+ uses: quarto-dev/quarto-actions/setup@v2
+
+ - name: Build documentation
+ run: |
+ uv venv
+ . .venv/bin/activate
+ uv pip install -e ".[docs]"
+ ./scripts/docs_build.sh
+ working-directory: .
+
+ - name: Prepare website content
+ if: github.ref == 'refs/heads/main'
+ run: |
+ # Create a temporary directory for filtered content
+ mkdir -p temp_website
+
+ # Navigate to build directory
+ cd build
+
+ # Copy files except .ipynb, node_modules, .quarto, .gitignore, temp_website, _blogs, use-cases, user-guide and talks
+ find . -type f -not -path "*/node_modules/*" -not -path "*/.quarto/*" -not -path "./_blogs/*" -not -path "./use-cases/*" -not -path "./user-guide/*" -not -path "./talks/*" -not -name "*.ipynb" -not -name ".gitignore" -exec cp --parents {} ../temp_website/ \;
+
+ - name: Deploy to Mintlify
+ if: github.ref == 'refs/heads/main'
+ uses: peaceiris/actions-gh-pages@v4
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ publish_branch: mintlify-pages
+ publish_dir: ./website/temp_website
diff --git a/.github/workflows/contrib-llm-test.yml b/.github/workflows/contrib-llm-test.yml
index e8d86e12fa..32cffb41d0 100644
--- a/.github/workflows/contrib-llm-test.yml
+++ b/.github/workflows/contrib-llm-test.yml
@@ -14,6 +14,10 @@ on:
- "test/agentchat/contrib/**"
- ".github/workflows/contrib-llm-test.yml"
- "pyproject.toml"
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
+ cancel-in-progress: true
permissions:
{}
diff --git a/.github/workflows/contrib-test.yml b/.github/workflows/contrib-test.yml
index c8687bc3f8..229afb3633 100644
--- a/.github/workflows/contrib-test.yml
+++ b/.github/workflows/contrib-test.yml
@@ -29,6 +29,7 @@ permissions:
jobs:
RetrieveChatTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -71,6 +72,7 @@ jobs:
RetrieveChatTest-Ubuntu:
runs-on: ubuntu-latest
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -194,6 +196,7 @@ jobs:
os: [ubuntu-latest]
python-version: ["3.10"]
runs-on: ${{ matrix.os }}
+ environment: permit-tests
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
@@ -222,6 +225,7 @@ jobs:
GPTAssistantAgent:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -261,6 +265,7 @@ jobs:
TeachableAgent:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -300,6 +305,7 @@ jobs:
WebSurfer:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -339,6 +345,7 @@ jobs:
LMMTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -384,6 +391,7 @@ jobs:
GeminiTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -394,8 +402,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -428,6 +434,7 @@ jobs:
TransformMessages:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -467,6 +474,7 @@ jobs:
LlamaIndexAgent:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -501,6 +509,7 @@ jobs:
AnthropicTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -509,8 +518,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -545,6 +552,7 @@ jobs:
CerebrasTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -555,8 +563,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -589,6 +595,7 @@ jobs:
MistralTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -599,8 +606,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -633,6 +638,7 @@ jobs:
TogetherTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -643,8 +649,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -677,6 +681,7 @@ jobs:
GroqTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -687,8 +692,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -721,14 +724,13 @@ jobs:
CohereTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -761,6 +763,7 @@ jobs:
OllamaTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -771,8 +774,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -805,6 +806,7 @@ jobs:
BedrockTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -815,8 +817,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -849,6 +849,7 @@ jobs:
SwarmTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -859,8 +860,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
@@ -893,6 +892,7 @@ jobs:
ReasoningTest:
runs-on: ${{ matrix.os }}
+ environment: permit-tests
strategy:
fail-fast: false
matrix:
@@ -903,8 +903,6 @@ jobs:
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- with:
- lfs: true
- uses: astral-sh/setup-uv@v5
with:
version: "latest"
diff --git a/.github/workflows/core-llm-test.yml b/.github/workflows/core-llm-test.yml
index c49c029c63..649fccc173 100644
--- a/.github/workflows/core-llm-test.yml
+++ b/.github/workflows/core-llm-test.yml
@@ -17,6 +17,10 @@ on:
- "notebook/agentchat_groupchat_finite_state_machine.ipynb"
- ".github/workflows/core-llm-test.yml"
- "pyproject.toml"
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
+ cancel-in-progress: true
permissions:
{}
diff --git a/.github/workflows/core-test.yml b/.github/workflows/core-test.yml
index 3a36101e8e..7f8ea8a291 100644
--- a/.github/workflows/core-test.yml
+++ b/.github/workflows/core-test.yml
@@ -51,6 +51,7 @@ jobs:
needs: paths-filter
if: needs.paths-filter.outputs.hasChanges == 'true'
runs-on: ${{ matrix.os }}
+ environment: permit-tests
env:
AUTOGEN_USE_DOCKER: ${{ matrix.os != 'ubuntu-latest' && 'False' }}
strategy:
diff --git a/.github/workflows/deploy-website-mintlify.yml b/.github/workflows/deploy-website-mintlify.yml
index ebc50eb10d..a0827487b6 100644
--- a/.github/workflows/deploy-website-mintlify.yml
+++ b/.github/workflows/deploy-website-mintlify.yml
@@ -1,17 +1,6 @@
name: mintlify docs
on:
- pull_request:
- branches: [main]
- paths:
- - "autogen/**"
- - "website/**"
- - ".github/workflows/deploy-website-mintlify.yml"
- - ".github/workflows/docs-check-broken-links.yml"
- - "scripts/broken-links-check.sh"
- - "scripts/docs_build.sh"
- - "scripts/docs_serve.sh"
- - ".muffet-excluded-links.txt"
push:
branches: [main]
paths:
@@ -29,82 +18,8 @@ on:
permissions:
contents: write
jobs:
- checks:
- if: github.event_name != 'push'
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: website
- steps:
- - uses: actions/checkout@v4
- with:
- lfs: true
- fetch-depth: 0
- - uses: astral-sh/setup-uv@v5
- with:
- version: "latest"
- - uses: actions/setup-node@v4
- with:
- node-version: 18.x
- - name: setup python
- uses: actions/setup-python@v5
- with:
- python-version: "3.10"
-
- - name: Install quarto
- uses: quarto-dev/quarto-actions/setup@v2
-
- - name: Build documentation
- run: |
- uv pip install --system -e ".[docs]"
- ./scripts/docs_build.sh
- working-directory: .
-
mintlify-release:
- if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
- runs-on: ubuntu-latest
- defaults:
- run:
- working-directory: website
- steps:
- - uses: actions/checkout@v4
- with:
- lfs: true
- fetch-depth: 0
- - uses: astral-sh/setup-uv@v5
- with:
- version: "latest"
- - uses: actions/setup-node@v4
- with:
- node-version: 18.x
- - name: setup python
- uses: actions/setup-python@v5
- with:
- python-version: "3.10"
-
- - name: Install quarto
- uses: quarto-dev/quarto-actions/setup@v2
-
- - name: Build documentation
- run: |
- uv pip install --system -e ".[docs]"
- ./scripts/docs_build.sh
- working-directory: .
-
- - name: Prepare website content
- run: |
- # Create a temporary directory for filtered content
- mkdir -p temp_website
-
- # Navigate to build directory
- cd build
-
- # Copy files except .ipynb, node_modules, .quarto, .gitignore, temp_website, _blogs, use-cases, user-guide and talks
- find . -type f -not -path "*/node_modules/*" -not -path "*/.quarto/*" -not -path "./_blogs/*" -not -path "./use-cases/*" -not -path "./user-guide/*" -not -path "./talks/*" -not -name "*.ipynb" -not -name ".gitignore" -exec cp --parents {} ../temp_website/ \;
-
- - name: Deploy to Mintlify
- uses: peaceiris/actions-gh-pages@v4
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_branch: mintlify-pages
- publish_dir: ./website/temp_website
+ uses: ./.github/workflows/build-docs.yml
+ with:
+ python-version: "3.10"
+ node-version: "18.x"
diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.yml
index c0feffc27a..f0e9767410 100644
--- a/.github/workflows/deploy-website.yml
+++ b/.github/workflows/deploy-website.yml
@@ -27,7 +27,19 @@ jobs:
-
+
+
+
+
Page Redirection
@@ -42,6 +54,14 @@ jobs:
+
+
+
Page Redirection
diff --git a/.github/workflows/lfs-check.yml b/.github/workflows/lfs-check.yml
index 4baae925de..104abb6b0d 100644
--- a/.github/workflows/lfs-check.yml
+++ b/.github/workflows/lfs-check.yml
@@ -1,6 +1,10 @@
name: "Git LFS Check"
on: pull_request
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
+ cancel-in-progress: true
permissions: {}
jobs:
lfs-check:
diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml
new file mode 100644
index 0000000000..33a103886b
--- /dev/null
+++ b/.github/workflows/pr-checks.yml
@@ -0,0 +1,167 @@
+name: PR checks
+
+on:
+ pull_request:
+ merge_group:
+ types: [checks_requested]
+ workflow_dispatch: # allows manual triggering of the workflow
+
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
+ cancel-in-progress: true
+permissions: {}
+
+jobs:
+ pre-commit-check:
+ runs-on: ubuntu-latest
+ env:
+ SKIP: "mypy"
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ lfs: true
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.9"
+ - name: Set $PY environment variable
+ run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
+ - uses: actions/cache@v4
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
+ - uses: pre-commit/action@v3.0.1
+
+ type-check:
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: astral-sh/setup-uv@v5
+ with:
+ version: "latest"
+ - uses: actions/setup-python@v5
+ with:
+ python-version: "3.9"
+ - run: uv pip install --system ".[types]"
+ # Any additional configuration for mypy should be defined in pyproject.toml under the [tool.mypy] section
+ - run: |
+ mypy
+
+ test-paths-filter:
+ runs-on: ubuntu-latest
+ outputs:
+ hasChanges: ${{ steps.filter.outputs.autogen == 'true' || steps.filter.outputs.test == 'true' || steps.filter.outputs.workflows == 'true' || steps.filter.outputs.setup == 'true' }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dorny/paths-filter@v3
+ id: filter
+ with:
+ filters: |
+ autogen:
+ - "autogen/**"
+ test:
+ - "test/**"
+ workflows:
+ - ".github/workflows/**"
+ setup:
+ - "pyproject.toml"
+
+ core-test-without-llm:
+ needs: test-paths-filter
+ if: needs.test-paths-filter.outputs.hasChanges == 'true'
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: astral-sh/setup-uv@v5
+ with:
+ version: "latest"
+ - name: Set up Python 3.11
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.11"
+ - name: Install packages and dependencies
+ run: |
+ uv pip install --system -e .[test,cosmosdb,interop,redis,websockets]
+ - name: Install optional dependencies for code executors
+ run: |
+ uv pip install --system -e ".[jupyter-executor]"
+ python -m ipykernel install --user --name python3
+ - name: Test with pytest skipping openai tests
+ run: |
+ bash scripts/test-core-skip-llm.sh
+ - name: Show coverage report
+ run: bash scripts/show-coverage-report.sh
+ - name: Upload coverage to Codecov
+ if: ${{ !contains(github.ref, 'gh-readonly-queue/') }}
+ uses: codecov/codecov-action@v5
+ with:
+ files: ./coverage.xml
+ flags: core-without-llm, ubuntu-latest, 3.11
+ fail_ci_if_error: true
+ token: ${{ secrets.CODECOV_TOKEN }}
+
+ docs-paths-filter:
+ runs-on: ubuntu-latest
+ outputs:
+ hasChanges: ${{ steps.filter.outputs.autogen == 'true' || steps.filter.outputs.website == 'true' || steps.filter.outputs.workflows == 'true' || steps.filter.outputs.setup == 'true' || steps.filter.outputs.scripts == 'true' }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: dorny/paths-filter@v3
+ id: filter
+ with:
+ filters: |
+ autogen:
+ - "autogen/**"
+ website:
+ - "website/**"
+ workflows:
+ - ".github/workflows/pr-checks.yml"
+ setup:
+ - "pyproject.toml"
+ - ".muffet-excluded-links.txt"
+ scripts:
+ - "scripts/broken-links-check.sh"
+ - "scripts/docs_build.sh"
+ - "scripts/docs_serve.sh"
+
+ build-docs:
+ needs: docs-paths-filter
+ if: needs.docs-paths-filter.outputs.hasChanges == 'true'
+ uses: ./.github/workflows/build-docs.yml
+ with:
+ python-version: "3.10"
+ node-version: "18.x"
+
+ pr-check:
+ if: always()
+ runs-on: ubuntu-latest
+ needs: [pre-commit-check, type-check, core-test-without-llm, build-docs]
+ steps:
+ - name: Get Date
+ shell: bash
+ run: |
+ echo "date=$(date +'%m/%d/%Y %H:%M:%S')" >> "$GITHUB_ENV"
+
+ - name: Run Type is ${{ github.event_name }}
+ if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'}}
+ shell: bash
+ run: |
+ echo "run_type=${{ github.event_name }}" >> "$GITHUB_ENV"
+
+ - name: Fail workflow if build failed
+ id: check_build_failed
+ if: contains(join(needs.*.result, ','), 'failure')
+ uses: actions/github-script@v7
+ with:
+ script: core.setFailed('Build Failed!')
+
+ - name: Fail workflow if build cancelled
+ id: check_build_cancelled
+ if: contains(join(needs.*.result, ','), 'cancelled')
+ uses: actions/github-script@v7
+ with:
+ script: core.setFailed('Build Cancelled!')
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
deleted file mode 100644
index cade2fcaaf..0000000000
--- a/.github/workflows/pre-commit.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-name: Code formatting
-
-# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
-on: # Trigger the workflow on pull request or merge
- pull_request:
- merge_group:
- types: [checks_requested]
-
-defaults:
- run:
- shell: bash
-permissions: {}
- # actions: read
- # checks: read
- # contents: read
- # deployments: read
-jobs:
-
- pre-commit-check:
- runs-on: ubuntu-latest
- env:
- SKIP: "mypy"
- steps:
- - uses: actions/checkout@v4
- with:
- lfs: true
- - uses: actions/setup-python@v5
- - name: Set $PY environment variable
- run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- - uses: actions/cache@v4
- with:
- path: ~/.cache/pre-commit
- key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
- - uses: pre-commit/action@v3.0.1
diff --git a/.github/workflows/test-with-optional-deps.yml b/.github/workflows/test-with-optional-deps.yml
index 29335a9529..3c84c46654 100644
--- a/.github/workflows/test-with-optional-deps.yml
+++ b/.github/workflows/test-with-optional-deps.yml
@@ -53,6 +53,7 @@ jobs:
needs: paths-filter
if: needs.paths-filter.outputs.hasChanges == 'true'
runs-on: ${{ matrix.os }}
+ environment: permit-tests
env:
AUTOGEN_USE_DOCKER: ${{ matrix.os != 'ubuntu-latest' && 'False' }}
strategy:
diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml
index 61b21abdc2..36a4a041a2 100644
--- a/.github/workflows/type-check.yml
+++ b/.github/workflows/type-check.yml
@@ -9,6 +9,10 @@ on: # Trigger the workflow on pull request or merge
defaults:
run:
shell: bash
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
+ cancel-in-progress: true
permissions: {}
jobs:
@@ -60,6 +64,7 @@ jobs:
- python-version: "3.10"
optional-dependencies: "browser-use"
runs-on: ubuntu-latest
+ environment: permit-tests
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
diff --git a/RFCs/000/RFC-000-global-run-function.ipynb.txt b/RFCs/000/RFC-000-global-run-function.ipynb.txt
deleted file mode 100644
index 606713ab2e..0000000000
--- a/RFCs/000/RFC-000-global-run-function.ipynb.txt
+++ /dev/null
@@ -1,129 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "from typing import Any, Protocol, runtime_checkable\n",
- "\n",
- "from autogen import Agent\n",
- "\n",
- "\n",
- "class RunResponse:\n",
- " pass\n",
- "\n",
- "\n",
- "class Cost:\n",
- " def __init__(self, **kwargs: Any):\n",
- " self._cost: dict[str, Any] = kwargs.copy()\n",
- "\n",
- " @staticmethod\n",
- " def _add_elements(key: str, x: dict[str, Any], y: dict[str, Any]) -> Any:\n",
- " if key in x and key in y:\n",
- " return x[key] + y[key]\n",
- " elif key in x:\n",
- " return x[key]\n",
- " elif key in y:\n",
- " return y[key]\n",
- " else:\n",
- " raise KeyError(f\"Key {key} not found in either dictionary\")\n",
- "\n",
- " def __add__(self, other: \"Cost\") -> \"Cost\":\n",
- " keys = set(self._cost.keys()) | set(other._cost.keys())\n",
- " return Cost(**{key: self._add_elements(key, self._cost, other._cost) for key in keys})\n",
- "\n",
- "\n",
- "@runtime_checkable\n",
- "class EventProtocol(Protocol):\n",
- " @property\n",
- " def cost(self) -> Cost:\n",
- " return Cost()\n",
- "\n",
- "\n",
- "class RunResponse:\n",
- " @property\n",
- " def events(self) -> list[EventProtocol]:\n",
- " pass\n",
- "\n",
- "\n",
- "def run(\n",
- " *agents: Agent,\n",
- ") -> RunResponse:\n",
- " return RunResponse"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "agents: list[Agent] = []\n",
- "\n",
- "response = run(*agents, message=\"What is the meaning of life?\")\n",
- "\n",
- "total_cost = Cost(0)\n",
- "for m in response.events:\n",
- " total_cost += m.cost\n",
- " if isinstance(m, InputRequest):\n",
- " s = input(m.prompt)\n",
- " m.respond(s)\n",
- " elif isinstance(m, OutputMessage):\n",
- " print(m.message)\n",
- " elif isinstance(m, ToolRequest):\n",
- " tool = m.tool"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": ".venv-3.10-core",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.10.10"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
-}
diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py
index a53f7b7b1c..3465bcff86 100644
--- a/autogen/agentchat/conversable_agent.py
+++ b/autogen/agentchat/conversable_agent.py
@@ -1334,7 +1334,7 @@ async def a_receive(
self._process_received_message(message, sender, silent)
if request_reply is False or (request_reply is None and self.reply_at_receive[sender] is False):
return
- reply = await self.a_generate_reply(sender=sender)
+ reply = await self.a_generate_reply(messages=self.chat_messages[sender], sender=sender)
if reply is not None:
await self.a_send(reply, sender, silent=silent)
diff --git a/autogen/coding/jupyter/local_jupyter_server.py b/autogen/coding/jupyter/local_jupyter_server.py
index 10140c6bde..f7ad196385 100644
--- a/autogen/coding/jupyter/local_jupyter_server.py
+++ b/autogen/coding/jupyter/local_jupyter_server.py
@@ -71,12 +71,13 @@ def __init__(
"Jupyter gateway server is not installed. Please install it with `pip install jupyter_kernel_gateway`."
)
- self.ip = ip
+ self.ip: str = ip
if isinstance(token, LocalJupyterServer.GenerateToken):
token = secrets.token_hex(32)
- self.token = token
+ self.token: str = token
+ self._subprocess: subprocess.Popen[str]
logging_config = {
"handlers": {
"file": {
@@ -134,7 +135,7 @@ def __init__(
# Jupyter Kernel Gateway 3.0.0 is available at http://127.0.0.1:8890
if port is None:
port = int(line.split(":")[-1])
- self.port = port
+ self.port: int = port
break