neuron-core/neuron-ai
Neuron is a PHP framework for building agentic apps: create and orchestrate AI agents, integrate LLM providers, load data, run multi-agent workflows, and monitor/debug behavior. Works well with Laravel and Symfony.
Support OpenAILikeEmbeddings custom http client - PR #599 by @pcastellazzi
Support Gemini citations when streaming
Support mistral image content block for base64 format - Fix #596
Introducing the Regex validation rule for structured output:
namespace App\Neuron\Output;
use NeuronAI\StructuredOutput\Validation\Rules\Regex;
class Coupon
{
#[Regex('/^[A-Z]{2}\d{4}$/')]
public string $code;
}
Check it out in the documentation: https://docs.neuron-ai.dev/agent/structured-output#regex
improve doc-block in agent class
Make Gemini baseUri customizable
Make zai url customizable - PR #589 by @rafaelchavesfreitas
Deprecate the InspectorObserver, use the new observer from the Inspector PHP package - Inspector/Neuron/InspectorObserver
Fix MeilisearchVectorStore - PR #590 by @bytestream
Fix AGUIAdapter event format
Collect Cached Input Tokens, Reasoning Tokens across providers - PR #572 by @mattmilesi
Fix Qdrant async ops
Improve streaming performance for Guzzle and Amp stream adapters
Improve streaming performance for Guzzle and Amp stream adapters
Improve streaming performance
Fix tracking request ID on MCP tool call
HttpException::networkError()SseHttpTransportSseHttpTransport::buildHeaderString()HttpRequestreadLine() in stream adaptersSseHttpTransportAmpHttpClient multipart pathcatch block in AmpStream::readLine()Optimize and secure RAG components (Vector similarity, text splitters)
Fix tool array in ToolCallMessage
More efficient tool search with fuzzy and tokenized keywords
Tool search inject system prompt to ensure the agent behave as expected
By default every time the provider is invoked all tools are loaded and transmitted to the backend LLM. Complex production agents connected to email, calendar, drive, CRM, and and multiple MCP servers can easily reach hundreds of tools, each carrying its name, description, parameter schema, and usage hints.
This release introduces the global middleware ToolSearchMiddleware that you can attach to your agent:
class MyAgent extends Agennt
{
...
/**
* Define the global middleware.
*/
protected function globalMiddleware(): array
{
return [
new ToolSearchMiddleware([
MyCustomTool::make(),
...CalculatorToolkit::make()->tools()
...MCPConnector::make([...])->tools()
]),
];
}
/**
* Provide core tools to the agent.
*/
protected function tools(): array
{
return [
// A list of core tools that the model always has available
TavilySearchTool::make(...),
];
}
}
Here is the full documentation: https://docs.neuron-ai.dev/agent/middleware#tool-search
Added new Gemini models with support for structured output with tools
support reasoning content in Deepseek and Alibaba providers - PR #573 - by @tw2066
fix Gemini function call with custom tools - PR #574 by @marceloandrader
Custom Tool Call Tracking for Max Runs - PR #566 by @tryvin
class MyCustomTool extends Tool implements HasRunKey
{
...
public function getRunKey(): string
{
return $this->name . ':' . json_encode($this->inputs);
}
}
Add Alibaba dash scope model platform provider - PR #560 by @tw2066
Improve the Workflow Executor design
This release introduce the ability of the workflow component to run parallel branches: https://docs.neuron-ai.dev/workflow/loops-and-branches#parallel-branches
When you want to call the execution of multiple branches in parallel, you need to return the special event ParallelEvent from your node.
use NeuronAI\Workflow\Events\ParallelEvent;
class DocumentProcessing extends Node
{
public function __invoke(StartEvent $event, WorkflowState $state): ParallelEvent
{
// Node logic here...
// Finally return a ParallelEvent
return new ParallelEvent([
'text' => new TextProcessEvent(),
'image' => new ImageProcessEvent(),
]);
}
}
Several improvements and fixes to the AWS Bedrock provider - PR #562 by @vitaliiivanovspryker
Make Http clients implementations ready for extension - Fix #557 #558
Fix Tavily search tool - PR #561 by @AlexTr
Fix #554
Fix tool content deserialization in chat history - Fix #550 Add options argument to GuzzleHttpClient - Fix #551
Improve components serialization to better support workflow interruption - PR #543 by @tryvin
Fix #544 - get schema in SQL Tools
Fix Mistral token usage reporting
fix eloquent chat history
MissingCallbackParameterIn the process of fixing a bug ( #523 ) we worked on a more efficient algorithm to manage the cut of the message history if it goes out of the context window. The intent was to minimize the context loss when cutting.
The context window cut must be considered the last resort to prevent fatal errors with provider APIs. Before reaching the limit of the context window you should use summarization to compact the context into a single message as a new starting point.
In order to handle all edge cases, the internal trimmer can identify a cutting point slightly less aggressive than the initially identified. To make sure the agent conversation stays in the limit, you should configure the context window limit in the agent chat history with a margin of 5%-10% from the actual limit of the underlying model.
If your model works with a 200K context window, you should instantiate your chat history with 190K for example.
We introduced a couple of built-in rules for Ai as a judge assertions:
Evaluation score tracking
PR #482 by @hudhaifas
class MyAgent extends Agent
{
protected function provider(): AIProviderInterface
{
return new Anthropic(
key: 'ANTHROPIC_KEY',
model: 'ANTHROPIC_MODEL'
)->systemPromptBlocks([
['type' => 'text', 'text' => 'Static instructions...', 'cache_control' => ['type' => 'ephemeral']],
['type' => 'text', 'text' => 'Dynamic context...']
]);
}
}
How can I help you explore Laravel packages today?