Releases: AmritaBot/AmritaCore
V0.8.6
Release v0.8.6
This patch release refactors the internal matcher execution logic for improved clarity and performance. Runtime dependency resolution has been moved from _simple_run to the public trigger_event method, making the internal API stricter and easier to reason about.
🚀 Improvements
- Dependency injection refinement: Runtime
Dependsfactories are now resolved exclusively intrigger_event._simple_runno longer handles them and will raise a clearValueErrorif any are passed. - Simplified method signature:
_simple_runremoved theeventandconfigparameters, reducing coupling and unnecessary argument passing. - Better type annotation:
extra_argsnow usesIterable[Any]for more flexibility.
🧪 Testing
- Updated unit tests to align with the new
_simple_runsignature. - Removed obsolete test for runtime dependency injection inside
_simple_run(now covered bytrigger_event).
🧰 Maintenance
- Version bumped to
0.8.6. - Lockfile regenerated.
No breaking changes for public APIs.
Full Changelog: 0.8.5...0.8.6
V0.8.5
Release Abstract – amrita_core v0.8.5
This release delivers important concurrency and lifecycle improvements, critical bug fixes, and expanded test coverage. The main focus is on making the event handling and chat manager more robust under concurrent use, adding connection management for MCP tools, and fixing a streaming output bug in model adapters.
🔧 Bug Fixes
- Adapter Streaming: Fixed missing text yield in
OpenAIAdapterandAnthropicAdapterstreaming responses. The raw text content (text_resp.getvalue()) is now explicitly yielded before the finalUniResponse, ensuring downstream consumers receive text before the response wrapper (fixes #…). - Agent Tool Loop: Corrected the exit logic in
_execute_tool_loopso that a single failed tool call no longer prematurely aborts the entire loop; the agent now correctly processes remaining tools and returns an aggregated result. - ChatManager Thread Safety: Replaced the global
LOCKwith a per-instance_lockfield, preventing contention across separateChatManagerinstances.ChatObjectnow accepts an optionalchat_manparameter to bind to a specific manager instead of always relying on the module-level global.
✨ New Features
- MCP Client Connection TTL: MCP clients now support an automatic connection close after an idle timeout (
connection_ttl). The newclose()method schedules a graceful shutdown, whileclose_no_wait()allows immediate closure. This prevents resource leaks in long-lived sessions. - Matcher Deadlines: Matchers can now be created with a
dead_attimestamp; expired matchers are automatically skipped and cleaned up during event processing, enabling time‑limited event handlers. - WeakLRU Cache: Introduced
WeakValueLRUCache– a thread‑safe, weak‑reference‑based LRU cache with optional “loose mode” that allows temporary oversizing. Used internally for matcher lock pools, preventing memory leaks from accumulating locks.
🧱 Architecture & Refactoring
- Matcher System:
FunctionDataconverted from PydanticBaseModelto a standarddataclassfor lower overhead.Matcheris now hashable (usingUUID) and supports equality checks.- Event processing uses per‑event‑type locks (
MatcherFactory._repo_lock) backed by the new weak‑reference cache, replacing global locking and improving parallelism. - Dead matchers are removed from handler lists during execution, avoiding memory growth from stale entries.
- Chat Manager Binding:
ChatObjectcan now be explicitly associated with a specificChatManager, enabling easier testing and multi‑context deployments.
🧪 Testing & CI
- CI Matrix: Expanded CI to test against Python 3.10, 3.11, 3.12, and 3.13 with
fail‑fast: false. A newall-matrix-jobs-passedgate ensures all combinations succeed before merge. - Test Coverage:
- Added comprehensive tests for
AnthropicAdapter(streaming, non‑streaming, tool conversion). - Brand‑new test suite for
WeakValueLRUCachecovering all operations, edge cases, and garbage‑collection behaviour. - Updated existing adapter tests to align with the updated streaming logic.
- Added comprehensive tests for
📦 Dependencies & Packaging
- Version bumped to
0.8.5. uv.lockrefreshed to reflect the new version and dependency changes.
Upgrade Notes: This release maintains backward compatibility for most public APIs. The global LOCK removal in ChatManager and the new chat_man parameter are entirely opt‑in. Users who rely on MCP clients will benefit from the new TTL feature, but existing code continues to work unchanged.
Full Changelog: 0.8.4.1...0.8.5
V0.8.4.1
What's Changed
- Refine chat cleanup, streaming suspend, and fallback handling by @JohnRichard4096 in #60
Full Changelog: 0.8.4...0.8.4.1
V0.8.4
Update Summary
- Version bump:
amrita_coreupdated from0.8.3.1to0.8.4(pyproject.toml). - Agent module (
builtins/agent.py):- Reordered and clarified abstract methods (
_append_reasoning,_append_tool_result_to_context) with improved docstrings. - Expanded
__all__to export additional strategy classes:AmritaAgentStrategy,BaseReActAgentStrategy,HybridReActAgentStrategy,NoActionAgentStrategy,ReActAgentStrategy.
- Reordered and clarified abstract methods (
- Hook system:
- Removed
BlockException(no longer used) fromexception.py. - Refactored
MatcherFactory:_simple_runnow takesconfigas an optional last argument (defaultNone), with clearer keyword‑only parameters.trigger_eventoverloads and implementation updated:configis no longer a mandatory positional argument, can be omitted or passed asNone.- Removed the check that required a config; improved argument passing to
_simple_run.
- Removed
- Chat library (
libchat.py):_call_with_reflectionno longer forwards arbitrary*args, **kwargsto the adapter call (only preset, call_func, config).call_completionnow accepts**kwargsand forwards them to the adapter.- Added
call_embeddingfunction to support embedding requests, returning a sequence ofEmbeddingChunk.
- MCP tools: Removed unused
NOT_GIVENsentinel class. - Tests:
- Removed outdated test for
_call_with_reflection(due to signature change). - Updated
test_matcher.pycalls to_simple_runto match the new parameter order. - Removed
NOT_GIVENimport and its test intest_mcp.py.
- Removed outdated test for
Full Changelog: 0.8.3.1...0.8.4
V0.8.3.1
What's Changed
- Prefer Pydantic model docstrings for tool schema descriptions by @JohnRichard4096 in #57
Full Changelog: 0.8.3...0.8.3.1
V0.8.3
Release v0.8.3
Highlights
- Anthropic Tool Calling – The Anthropic adapter is now fully supported and includes complete tool/function calling capabilities.
- Richer
@simple_tool– The decorator now infers JSON Schema from Pydantic models,List[T], andOptional[T]; unsupported types are rejected with clear errors. - Developer Experience – New and improved helper scripts with check/fix flags, plus a docs linter.
New Features
-
Anthropic Adapter (
src/amrita_core/builtins/adapter.py)- Added
call_tools()method with full Anthropic tool-use support. - Automatic conversion of internal messages, tool definitions, and tool choice parameters.
- Removed experimental status; now supports streaming and tool calling.
- Added
-
Enhanced
@simple_toolDecorator- Automatic schema generation for Pydantic BaseModel parameters (including nested models).
- Support for
List[T](single-level) andOptional[T]. - Validation that rejects unsupported types:
Dict, nested containers, multi-typeUnion, andAny. - Return values of
list/dictare now JSON-serialized for consistent output.
Improvements
-
Scripts & Workflow
format.shnow supports--checkfor dry-run formatting.lint.shsupports--fixfor auto-fixing issues.- New
docs-lint.shscript using Prettier for documentation formatting. clean.shnow also removes__pycache__directories and rootbuild/folder.- CONTRIBUTING.md updated with detailed script descriptions and recommended pre‑PR checks.
-
Documentation
- Both English and Chinese docs updated to reflect the new Anthropic capabilities and tool system improvements.
- Clarified tool registration behaviour: decorators register to the global container; use
ToolsManagerfor per-session tools. - Added note on supported types and limitations of
@simple_tool. - Community channel now includes QQ group.
- Fixed formatting issues (markdown syntax, italics for abstract methods, etc.).
-
Code Quality
- Fixed indentation in
chatmanager.py. FunctionParametersSchema.propertiesnow defaults to an empty dict instead ofNone, simplifying usage.- Updated existing tests and added comprehensive test suite for the new
@simple_tooltypes.
- Fixed indentation in
Changes from Unstable
README.mdnow lists Built-in Anthropic support as a stable feature.- Removed “Anthropic Supporting” from the Unstable Features section (now fully implemented).
Summary
v0.8.3 brings first-class Anthropic tool calling, a significantly smarter @simple_tool decorator, and a smoother developer workflow. Documentation and community channels have been expanded, and the codebase continues to mature with improved consistency and testing.
Full Changelog: 0.8.2.1...0.8.3
V0.8.2.1
What's Changed
- Fix: wrong link by @JohnRichard4096 in #53
- Expose runtime/session metadata and document ModelAdapter & suspend by @JohnRichard4096 in #54
- Docs: clarify ChatObject suspend usage and callback/iterator modes by @JohnRichard4096 in #55
Full Changelog: 0.8.2...0.8.2.1
V0.8.2
🚀 AmritaCore v0.8.2
This release focuses on architectural refactoring, enhanced streaming control, improved validation for tool schemas, and significant updates to the built-in reasoning system.
Major Features & Refactoring
-
New Base Class:
SuspendObjectStream- Introduced a new generic base class
SuspendObjectStream[ObjectTypeT]insrc/amrita_core/streaming.py. - Encapsulates all suspend/resume logic and streaming queue management (AnyIO memory object streams).
- Impact:
ChatObjectnow inherits fromSuspendObjectStream, centralizing the streaming and flow-control mechanisms previously embedded directly in the chat manager.
- Introduced a new generic base class
-
Enhanced Tool Schema Validation (
FunctionPropertySchema)- Added comprehensive JSON Schema constraint support:
- Numeric:
minimum,maximum,exclusiveMinimum,exclusiveMaximum,multipleOf. - String:
minLength,maxLength,pattern,format. - Array:
minItems,maxItems,uniqueItems. - Object:
additionalProperties,const,default.
- Numeric:
- Added strict type-specific validation to ensure schemas are well-formed.
- Added comprehensive JSON Schema constraint support:
-
Refined Reasoning Loop (
think_and_reason)- Schema Update: The
think_and_reasontool parameters changed fromcontenttolast_stepandsummary. - Behavior Change: The agent now makes a secondary completion call to generate a full reasoning paragraph based on the summary, rather than using the tool response directly as the reasoning content.
- Templates: Updated
REASONING_TEMPLATEand addedREASONING_CONTENT_TEMPLATEto support the new two-step reasoning generation process.
- Schema Update: The
API & Documentation Updates
-
get_last_responseEnhancement:- Added
yield_toandyield_to_wrapperparameters to allow streaming intermediate chunks to a target stream while capturing the finalUniResponse.
- Added
-
Python Version Support:
- Documentation updated to officially support Python 3.10 to 3.13 (previously stated up to 3.14).
-
Comprehensive Documentation Added:
- Added new documentation files for
SuspendObjectStreamin both English and Chinese guides. - Updated
ChatObjectdocumentation to reflect inheritance fromSuspendObjectStreamand removal ofoverflow_queue_sizeparameter.
- Added new documentation files for
Internal Improvements & Fixes
- Code Organization: Moved streaming logic (
_put_to_queue,get_response_generator, etc.) out ofchatmanager.pyand into the newSuspendObjectStreamclass. - Usage Tracking: Added
extra_usageproperty toChatObjectandgather_usageutility to aggregate token usage from internal operations (e.g., memory limiting, reasoning calls). - Test Restructuring: Moved suspend-related tests from
test_chatobject.pyto a dedicatedtest_object_stream.py. - Configuration: Bumped version in
pyproject.tomlto0.8.2.
What's Changed
- Introduce SuspendObjectStream and expand tool schema validation by @JohnRichard4096 in #52
Full Changelog: 0.8.1...0.8.2
V0.8.1
Release Summary: amrita_core v0.8.1
We are pleased to announce the release of amrita_core 0.8.1 – a maintenance update focusing on thread safety improvements, a critical bug fix in agent reasoning, and better CI reliability.
Highlights
- Thread‑safe asynchronous locks – Replaced
asyncio.Lockwithaiologic.Lockthroughout the codebase (chatmanager,threadsafe,mcp). This provides more robust, context‑aware locking for concurrent operations. - Reasoning tool fix – The
REASONING_TOOLis now added only whenagent_thought_modestarts with"reasoning"during tool‑calling execution, instead of unconditionally at initialization. This eliminates unnecessary tool exposure and aligns with expected behaviour. - CI pipeline hardening – Added a 30‑minute timeout to GitHub Actions workflows to prevent hung jobs.
- Singleton initialisation –
AdapterManagernow uses an__initedflag to avoid re‑initialising the singleton instance. - Documentation & testing – Improved docstring for
ContextThreadsafeand added a comprehensive test for lock contention.
Dependency update
- Added
aiologic>=0.16.0as a new dependency (transitively bringswraptandsniffio).
Version
0.8.0 → 0.8.1
Upgrade via uv or pip as usual. For full details, see the changelog and the diff above.
What's Changed
- Refine async thread safety with aiologic locks and reasoning tools by @JohnRichard4096 in #50
Full Changelog: 0.8.0...0.8.1
V0.8.0
🚀 AmritaCore v0.8.0
We're excited to announce AmritaCore v0.8.0! This release marks a significant step forward as a lightweight, infrastructure‑level agent framework. We've focused on improving core stability, introducing new capabilities, and refining the developer experience with better tooling and safety mechanisms.
✨ Highlights
- 🧩 Embedding Support: Added
EmbeddingChunkand"embed"adapter type for standardized embedding generation. - ⏸️ Standardized Breakpoints: Introduced
SuspendEnumwith built‑in tags (MEMORY,SINGLE_TOOL,PRECOMPLE,COMPLE) for precise control over execution flow. - 🌊 Streaming Overhaul: Replaced the dual‑queue overflow system with an AnyIO memory object stream providing automatic backpressure, simpler logic, and better memory efficiency.
- 🔌 MCP Client Binding: Added
bound_to()method toMCPClientfor atomic, safe registration with the client manager. - 🧵 Thread‑Safety: Introduced
ContextThreadsafebase class to ensure thread‑safe operations across shared managers.
💥 Breaking Changes
- ChatObject: The
overflow_queue_sizeparameter has been removed. Backpressure is now handled automatically via the new stream mechanism. - ChatObject: The signature of
wait_to_suspendhas changed from(timeout, tag)to(*tags, timeout). Please update your external controller code accordingly. - AgentStrategy: The default
on_exceptionmethod no longer raises an exception. It now passes silently. Custom strategies that relied onNoExceptionHandlermust override this method explicitly. - Logging: Internal logger initialization has been refactored. If you were relying on specific
loguruinternals, verify your logging setup.
🎉 New Features
- Adapter Type Validation:
call_completionnow checks that the adapter type matches the intended use ("text-gen"vs"embed"), preventing silent misuse. - Template Security: User input in the default Jinja2 template now uses the
|escapefilter automatically to prevent prompt injection. - Monitoring Decorator: Added
@monitoringto track the last call time of critical methods inChatObject. - New API Documentation: Added dedicated pages for
EmbeddingChunkandSuspendEnumin both English and Chinese docs.
🔧 Improvements
- Backpressure: The new AnyIO stream eliminates the need for complex overflow logic and improves reliability under load.
- Exception Handling: The silent default in
AgentStrategy.on_exceptionprevents unexpected crashes in production; custom logic can be added as needed. - Python 3.14+ Readiness: Updated
requires-pythonto<3.15to allow testing with the upcoming no‑GIL version of Python. - Tooling: Added a full suite of quality scripts (
format,lint,typecheck,release) to streamline development and contributions.
🐛 Fixes
- Fixed potential race conditions in MCP client registration via
bound_to(). - Corrected docstring inconsistencies and outdated queue size references.
📚 Documentation
- Extensive updates to reflect new features, security enhancements (template escaping, adapter validation), and revised API signatures.
- VitePress configuration updated with new pages and adjusted theme colors.
🔗 Full Changelog & Upgrade Guide
-
Upgrade Steps:
- Update any code that sets
overflow_queue_sizeinChatObject(remove the argument). - Update
wait_to_suspendcalls to usewait_to_suspend(*tags, timeout). - If you relied on
NoExceptionHandlerbeing raised, overrideon_exceptionin your custom strategy. - Run
pip install -U amrita_coreto get the latest dependencies.
- Update any code that sets
-
Release 0.8.0 with embedding adapters and streaming refactor by @JohnRichard4096 in #48
-
Full Changelog: 0.7.3...0.8.0
This release is the result of contributions from the AmritaCore community. Thank you for your continued support!