Skip to content

Move remaining AgentChat implementation into Rust under src - #22

Merged
ishaan-berri merged 2 commits into
mainfrom
feat/rust-only-implementation
Oct 13, 2026
Merged

ishaan-berri merged 2 commits into
mainfrom
feat/rust-only-implementation

Conversation

@ishaan-berri

@ishaan-berri ishaan-berri commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

The previous Rust-core PR still left AgentChat's provider and Python runtime implementations in Python. This change moves all AgentChat implementation code under src/ in Rust, including the public src/agentchat facade, and leaves python/agentchat as imports, compatible dataclasses/protocols, type declarations, and direct native exports.

Implementation

  • Port the Python runtime, context/state/activity/delivery helpers, OpenAI Agents integration, and all six Python channel adapters into Rust. Remove the Python fallback backend.
  • Share typed normalization, routing, rendering, validation and webhook policies through agentchat-core, agentchat-slack and the new agentchat-providers crate. Both Slack transports consume the same subscription, file-transfer and receipt policies.
  • Preserve Python SDK/client injection and await application callbacks on the original asyncio task. Third-party Python SDKs still perform I/O for that interface; AgentChat controls sequencing and lifecycle in Rust. Node and Rust retain the complete native Slack transport and the JS Claude Agent SDK example.
  • Preserve Python imports, dataclasses, decorators, custom constructors, subclass/instance overrides, mutable public fields, callback exceptions and cancellation. Add packaged .pyi declarations, py.typed, a typing check, and a guard preventing Python implementations from returning to the facade.
  • Update workspace/build paths, support documentation and package CI. The same abi3 wheel is smoke-tested on Python 3.11 and 3.14 across the five platform targets.

Review and validation

Independent implementation reviews checked shared policy ownership, Python compatibility, async cleanup and Rust coding standards. Review fixes include safe GC traversal during CPython object construction, REST-client session-cycle collection, subclass constructors, instance method overrides, working-status override dispatch, and synchronous callback failures.

Passed locally on macOS arm64:

  • 528 Python tests on Python 3.11 and 528 on Python 3.14 using the installed abi3 wheel for 3.14.
  • 67 Rust tests; workspace formatting and Clippy with warnings denied; no-default, Slack example and all-feature builds.
  • 10 Node tests and 4 Claude example tests, type checks and the packed npm smoke test.
  • Ruff, public-interface mypy smoke and workflow actionlint.
  • Built-wheel installation and independently rebuilt source-distribution installation in clean environments.

All 12 CI jobs pass on final commit 706457a: Python 3.11/3.14, Rust tests/strict Clippy, Rust 1.88, Node 22/24, source installation, and Python/Node packages on Linux x64/arm64, macOS x64/arm64 and Windows x64. The same abi3 wheel passed Python 3.11 and 3.14 smoke checks on each platform. CI’s newer Clippy required the standard-library no-op waker; that fix also passed 13 focused local coroutine/GC regressions. Successful CI run.

The branch is based on current main (bacf106) with no merge conflicts. Python 3.14 emits dependency deprecation warnings from pytest-asyncio plus existing aiohttp/Teams warnings.

Support boundaries

Python exposes all six channels; full Node/Rust channel transport remains Slack-first. Non-Slack portable policies are Rust-native, with full transport bindings for other languages still pending. Tests use local/injected Slack services and a simulated Claude stream; no live workspace or model credentials were used.

A pending native coroutine retained in a cycle through its own opaque arguments cannot currently be reclaimed by Python's cycle collector. Awaiting, task cancellation, or explicit close() releases captures; suspended close() also runs context-manager cleanup. This limitation and usage guidance are documented in docs/rust-core.md.

@ishaan-berri
ishaan-berri merged commit 3594414 into main Oct 13, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant