> For the complete documentation index, see [llms.txt](https://ai.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai.ortusbooks.com/introduction/release-history/2.3.0.md).

# 2.3.0

BoxLang AI Module v2.3.0 Release Notes - Pipeline System Variables, Enhanced Transformers, and Tool Calling Improvements

This release enhances pipeline composition with automatic variable injection, improves transformer flexibility, and strengthens tool calling reliability with better error handling and streaming support.

## 🎁 New Features

### Pipeline `_input` System Variable

Automatic injection of previous stage output into message templates, enabling clean multi-stage AI pipelines without manual transformation steps.

**Auto-Inject Previous Output:**

```javascript
// Previous stage output automatically available as ${_input}
var pipeline = aiModel( provider: "openai" )
    .transform( response => ({ summary: response, wordCount: len( response ) }) )
    .to( aiModel( provider: "openai", input: "Translate this summary: ${_input_summary}" ) )

var result = pipeline.run( "Explain quantum computing in 50 words" )
// First model generates summary
// Struct output flattened: { summary: "...", wordCount: 50 }
// Second model receives: "Translate this summary: [actual summary text]"
```

**Key Features:**

* Simple string outputs: Access via `${_input}`
* Struct outputs: Individual fields flattened as `${_input_fieldName}`
* Eliminates manual transformation boilerplate
* Enables declarative pipeline composition

### Enhanced Transformer Support

The `aiTransform()` BIF now processes instances of `AiTransformRunnable` and `BaseTransformer` classes directly, allowing for more flexible and reusable transformation logic.

**Reusable Transformer Instances:**

```javascript
// Create reusable transformer instance
var jsonExtractor = new JSONExtractorTransformer().configure({
    stripMarkdown: true,
    strictMode: false
})

// Use in multiple pipelines
var pipeline1 = aiModel( provider: "openai" ).to( aiTransform( jsonExtractor ) )
var pipeline2 = aiModel( provider: "claude" ).to( aiTransform( jsonExtractor ) )
```

## 🔧 Enhancements

### Stricter Tool Calling

Enhanced defensive coding for tool execution prevents errors when tools are called with invalid arguments or when tool execution fails. Includes:

* Argument validation before tool invocation
* Graceful error handling with detailed error messages
* Prevention of chain-breaking failures during multi-tool execution

## 🐛 Bug Fixes

* **Tool Calling with Streaming** - Fixed context issue where tools executed during streaming didn't have access to the request object. Tools now receive proper request context during streaming execution, enabling seamless tool calling in real-time conversations.
* **Agent Streaming Tool Context** - Corrected `Agent.stream()` to pass the correct request object to tools during streaming execution, fixing scoping issues that prevented tools from accessing request-level data.
* **BaseMemory `getRecent()` Limit** - Fixed bug where the `limit` parameter was ignored, causing all messages to be returned instead of the requested number. Now properly respects the limit for retrieving recent messages.
* **SummaryMemory Trimming Logic** - Resolved infinite recursion issue when summary threshold was exceeded. Previously, messages weren't trimmed before summarization, causing recursive summarization attempts. Now properly:
  * Trims messages until under threshold
  * Generates summary
  * Adds summary message back to conversation
  * Prevents infinite recursion
* **BaseTransformer Constructor** - Added missing internal constructor initialization, fixing instantiation issues when creating custom transformer classes.
* **BaseTransformer Default Config** - Fixed missing default value for `config` property across all `BaseTransformer` classes, preventing null reference errors during transformer initialization.
* **aiTransform() BIF Validation** - Fixed invalid `throw()` call when non-string or non-closure arguments were passed. Now properly validates input types and provides clear error messages.

## 🚀 Upgrade Notes

This release is backward compatible. Pipeline `_input` variables are available immediately for new pipelines. Tool calling improvements are automatic, with all streaming and context bugs resolved. No breaking changes.

**Recommended Actions:**

* Simplify existing pipelines using `${_input}` variable injection
* Replace manual transformation closures with declarative templates
* Test tool execution in streaming contexts to verify improved reliability

## 🙏 Thank You

Thank you to all contributors and users who reported issues and helped improve BoxLang AI's reliability and composability!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ai.ortusbooks.com/introduction/release-history/2.3.0.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
