Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Agent Detector Laravel Package

shipfastlabs/agent-detector

Lightweight PHP/Laravel utility to detect when your code runs inside an AI agent or automated dev environment. Checks common agent-specific environment variables (e.g., Cursor, Gemini, Codex, or custom) and returns agent status and name.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • AI/Automation-Aware Feature Flags: Enable/disable features (e.g., experimental APIs, rate limits, or UI elements) when detected in AI-driven environments (e.g., Copilot, Claude, or custom agents). Example: Disable sensitive admin panels for automated testing.
  • Dynamic Rate Limiting: Adjust API or service quotas for AI agents (e.g., higher limits for development tools like Replit or lower limits for scraping agents).
  • Personalized Developer Experiences: Tailor IDE hints, documentation, or error messages for specific agents (e.g., Copilot vs. Claude). Example: Provide agent-specific CLI commands or templates.
  • Security Hardening: Block or log interactions from unauthorized agents (e.g., custom agents without explicit AI_AGENT whitelisting).
  • Cost Optimization: Route AI-generated traffic to cheaper tiers (e.g., serverless functions) while prioritizing human users for premium features.
  • Roadmap for AI Integration: Build a foundation for future AI-native workflows (e.g., auto-generating tests, docs, or migrations) by identifying agent contexts early.
  • Build vs. Buy: Avoid reinventing agent detection logic (e.g., parsing env vars or filesystem checks) when this package offers maintained, extensible coverage for 15+ agents.
  • Use Cases:
    • Developer Tools: Flag AI-assisted code in CI/CD pipelines (e.g., "This PR was authored with Copilot").
    • SaaS Platforms: Differentiate between human users and bots for analytics or support routing.
    • Marketplaces: Detect AI-generated content (e.g., listings, reviews) to enforce policies.

When to Consider This Package

Adopt if:

  • Your PHP/Laravel app interacts with AI agents, IDEs, or automated dev tools (e.g., Copilot, Claude, Replit) and needs to behave differently based on context.
  • You require lightweight, maintainable detection (no heavy dependencies or complex setup).
  • Your team uses multiple AI tools (this package supports 15+ agents out of the box).
  • You need to extend detection for custom agents via AI_AGENT env vars.
  • Your PHP version is 8.2+ (required for the package).

Look elsewhere if:

  • You need cross-language support (this is PHP-only).
  • Your use case requires deep behavioral analysis (e.g., parsing agent-generated code) beyond environment detection.
  • You’re using non-PHP environments (e.g., Node.js, Python) where this package isn’t applicable.
  • Your agents rely on non-standard detection methods (e.g., network headers, cookies) not covered by env vars/filesystem checks.
  • You prioritize real-time detection over periodic checks (this is a runtime utility, not a streaming service).

How to Pitch It (Stakeholders)

For Executives: *"This lightweight PHP package lets us intelligently differentiate between human users and AI agents in our Laravel apps—without heavy engineering lift. For example:

  • Protect sensitive features from automated scraping or testing.
  • Optimize costs by routing AI traffic to cheaper infrastructure.
  • Enhance developer tools with agent-aware hints or templates. It’s like adding a ‘bot detector’ for AI—maintained by the Laravel team, supporting 15+ tools (Copilot, Claude, Replit, etc.), and extensible for our own needs. The MIT license and active development make it a low-risk, high-reward addition to our tech stack."*

For Engineers: *"Agent Detector solves a growing pain point: how to reliably identify AI agents in PHP/Laravel apps. Here’s why it’s a no-brainer:

  • Zero setup: Install via Composer (composer require laravel/agent-detector), drop in a single line of code (detectAgent()), and start routing logic.
  • Broad coverage: Detects Copilot, Claude, Replit, and 12+ other agents via env vars or filesystem checks—no regex or manual parsing.
  • Extensible: Add custom agents by setting AI_AGENT=your-tool in your environment.
  • Lightweight: ~500 lines of code, no dependencies, and PHP 8.2+ compatible. Use cases:
    • Feature flags: Disable admin panels for bots.
    • Rate limiting: Adjust quotas for AI tools vs. humans.
    • Dev experience: Tailor IDE hints or docs for specific agents. It’s maintained by Laravel, so we get updates for new agents (e.g., v0, Kiro) without lifting a finger. Let’s prototype this in [X] sprint to validate use cases like [Y]."*

For Data/Analytics Teams: *"This package helps us segment AI-generated traffic from human users, enabling:

  • Accurate usage metrics: Distinguish between Copilot-assisted and manual code changes.
  • Policy enforcement: Flag or block AI-generated content (e.g., listings, reviews) that violates guidelines.
  • A/B testing: Compare user behavior between AI-assisted and unaided workflows. Example: If we detect KnownAgent::Claude, we can log it as an ‘AI-assisted session’ in our analytics pipeline."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope