LarAgent v0.8 - ToolCall Tracing, Native Gemini Driver & Config Freedom

LarAgent v0.8 - ToolCall Tracing, Native Gemini Driver & Config Freedom

This release takes LarAgent one step further — with smarter observability, a native Gemini integration, and full control over your agent configurations.

⚡ Tool Execution Reimagined

LarAgent now brings complete visibility into every tool call.
The BeforeToolExecution and AfterToolExecution events now include the new ToolCall object.

What it means

  • Each tool call gets its own unique ID
  • You can trace arguments, inputs, and results
  • Ideal for debugging, logging, and auditing

Migration Example


// Before (v0.7)
protected function afterToolExecution(ToolInterface $tool, &$result)
protected function beforeToolExecution(ToolInterface $tool)

// After (v0.8)
protected function afterToolExecution(ToolInterface $tool, ToolCallInterface $toolCall, &$result)
protected function beforeToolExecution(ToolInterface $tool, ToolCallInterface $toolCall)

Hook callbacks follow the same change, with $toolCall added.

⚠️
If you were using these hooks, make sure to upgrade them, since it is a breaking change

🤖 Native Gemini Driver

Say hello to Gemini Native — a direct integration with Google’s Gemini API.
It replaces the old OpenAI-compatible wrapper for faster, cleaner performance.

Configuration:

'gemini_native' => [
  'label' => 'gemini',
  'api_key' => env('GEMINI_API_KEY'),
  'driver' => \LarAgent\Drivers\Gemini\GeminiDriver::class,
],

Usage:

class MyGeminiAgent extends Agent {
  protected $provider = 'gemini_native';
  protected $model = 'gemini-2.0-flash-latest';
}

🧩 Arbitrary Configuration Freedom

You can now set and control custom configuration values on any agent.
Pass them to the driver, merge, replace, or remove on the fly.

$agent->setConfig('timeout', 60);
$agent->withConfigs(['header' => 'X-Custom', 'mode' => 'debug']);

or even define them statically, in your agent classes:

protected $configs = ['reasoning_effort' => 'minimal'];

🌐 Enhanced MCP Server Setup

MCP server configuration is now more flexible with support for:

  • headers
  • id_type
  • startup_delay
  • poll_interval

Example with all possible configuration keys:

// config/laragent.php
'mcp_servers' => [

    'github' => [
        'type' => \Redberry\MCPClient\Enums\Transporters::SSE,
        'base_url' => 'https://api.githubcopilot.com/mcp',
        'timeout' => 30,
        'token' => env('GITHUB_API_TOKEN'),
        'headers' => [
            // Add custom headers here
        ],
        // 'string' or 'int' - controls JSON-RPC id type (default: 'int')
        'id_type' => 'int',
    ],
    
    'mcp_server_memory' => [
        'type' => \Redberry\MCPClient\Enums\Transporters::STDIO,
        'command' => 'npx',
        'args' => [
            '-y',
            '@modelcontextprotocol/server-memory',
        ],
        'timeout' => 30,
        'cwd' => base_path(),
        // milliseconds - delay after process start (default: 100)
        'startup_delay' => 100,
        // milliseconds - polling interval for response (default: 20)
        'poll_interval' => 20,
    ],
],

Perfect for complex MCP setups and custom server behavior.


🔧 Under the Hood

Streaming Upgrades

  • Claude, Groq, and Gemini all get smoother delta and chunk handling.

Configuration Cleanup

  • Core configs stay strict, custom keys are now neatly separated.

Error Handling

  • Safer Gemini initialization
  • Improved MCP client stability

Dependency Update

  • redberry/mcp-client-laravel upgraded to ^1.1

🧪 Tests & Quality

Added test suites for:

  • ToolCall object in execution events
  • Custom configuration behavior
  • Gemini agent and driver performance

👏 Contributors

Huge thanks to
@crathgeb - Arbitrary config support
@Yalasev903 - Gemini Native driver
@MaestroError - new MCP configs, ToolCalls, Fixes
and everyone improving LarAgent’s foundation!

Full changelog:
👉 v0.8.0 on GitHub

📘 Summary

v0.8 Highlights

  • 🧠 ToolCall event tracing for total observability
  • ⚙️ Native Gemini driver with full feature set
  • 🪶 Arbitrary configuration support
  • 🌐 Extended MCP server options
  • 🔧 Improved streaming, safety, and configuration logic

Happy coding! 🧩

Do I have to change my existing event listeners?

Yes — both BeforeToolExecution and AfterToolExecution events now receive a third $toolCall parameter. Simply update your method signatures or callbacks to include it.

What’s the difference between gemini_native and the old gemini driver?

gemini_native directly connects to Google’s Gemini API, giving faster responses, full streaming, and structured outputs.
The old wrapper remains for backward compatibility, but new projects should use gemini_native.

Will my existing tools or agents break after upgrading?

No — unless you’re using custom event listeners or hook callbacks. In that case, add the $toolCall parameter as shown in the migration guide.

How can I debug or log individual tool calls now?

Each tool call has a unique ID and full argument history through the new ToolCall object.
You can log or inspect it inside your afterToolExecution listener for complete visibility. Get details with getId, getToolName, & getArguments methods

Can I combine custom configs with default ones?

Yes. Use $agent->withConfigs() to merge or $agent->setConfigs() to replace.
Custom configs are automatically passed to the driver without overwriting core settings.

Does the new MCP configuration affect existing connections?

No changes required. The new fields (headers, id_type, startup_delay, poll_interval) are optional — add them only if you need advanced control.

Is the old Gemini wrapper deprecated?

Not yet — it’s still supported for backward compatibility, but it’s recommended to migrate to gemini_native for the best performance and feature set.

Where can I see migration examples or test updates?

Check the full changelog and tests in the GitHub release notes

Read more