VOOZH about

URL: https://docs.inspector.dev/guides/neuron-ai

⇱ Neuron AI | Inspector


For the complete documentation index, see llms.txt. This page is also available as Markdown.

The Problem With AI Systems

Integrating AI Agents into your application you're not working only with functions and deterministic code, you program your agent also influencing probability distributions. Same input ≠ output. That means reproducibility, versioning, and debugging become real problems.

Many of the Agents you build with Neuron will contain multiple steps with multiple invocations of LLM calls, tool usage, access to external memories, etc. As these applications get more and more complex, it becomes crucial to be able to inspect what exactly your agent is doing and why.

Why is the model making certain decisions? What data is the model reacting to? Prompting is not programming in the common sense. No static types, small changes break output, long prompts cost latency, and no two models behave exactly the same with the same prompt.

Install

You need to install the Inspector PHP package only if you are not already using other inspector libraries like inspector-laravel, inspector-symfony, and others.

composerrequireinspector-apm/inspector-php

If you are building with Neuron AI inside a web framework, we strongly recommend to use the framework specific package in order to have a complete integration.

Get Started

First add the INSPECTOR_INGESTION_KEY variable in your application environment file. Authenticate on app.inspector.dev to create a new one.

.env
INSPECTOR_INGESTION_KEY=nwse877auxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The second step is to register the InspectorObserver in your Agent, RAG, or Workflow. You can do it in the constructor:

use Inspector\Neuron\InspectorObserver;
classMyAgentextendsAgent
{
publicfunction__construct()
{
parent::__construct();
 // Register the InspectorObserver
$this->observe(InspectorObserver::instance());
}
...
}

When your agents are being executed, you will see the details of their inference steps, tool calls, and more.

Create An Ingestion Key

To create an Ingestion key head to the Inspector dashboard and create a new app.

For any additional support drop in a live chat in the dashboard. We are happy to listen from your experience, find new possible improvements, and make the tool better overtime.

Configure Observer

If your application already works with environment files, it is very likely that Neuron can automatically instrument itself if you add the INSPECTOR_INGESTION_KEY . If you have no access to environment variables, or you just want to customize the InspectorObserver configuration you can register it manually in your agent.

Background Workers

If you are running your agent into a long running process like a queue worker or systems like Swoole, or Roadrunner, you need to explicitly configure the auto-flush of events:

Add The Framework Specific Package

If you are integrating Neuron in an already existing application built on top of a framework like Laravel, Symfony, or simialr, we strongly recommend to add the framework specific package for a better data collection.

It's not required, just recommended. You can continue to monitor Neuron without the framework specific package.

Laravel / LumenSymfonyCodeIgniterSlim

Last updated

use Inspector\Neuron\InspectorObserver;
class MyAgent extends Agent
{
 public function __construct()
 {
 parent::__construct();
 // Register the InspectorObserver
 $this->observe(
 InspectorObserver::instance('INSPECTOR_INGESTION_KEY')
 );
 }
 ...
}
// Register Inspector
$this->observe(
 InspectorObserver::instance(
 key: 'INSPECTOR_INGESTION_KEY',
 autoFlush: true
 )
);