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

laravel/agent-detector

Lightweight PHP utility for detecting whether your Laravel/PHP app is running inside an AI agent or automated dev environment. Identifies known agents (e.g., Cursor, Gemini, Codex, Claude) via env vars, with a simple API and helper function.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • AI/Automation Guardrails: Enables conditional logic to restrict or modify behavior when code is executed by AI agents (e.g., disabling sensitive operations, enforcing manual review, or logging agent interactions).
  • Developer Experience (DX) Enhancements: Powers features like AI-assisted debugging, custom tooling, or IDE integrations (e.g., flagging AI-generated code in CI/CD pipelines).
  • Security & Compliance: Supports audit trails for automated environments (e.g., blocking AI agents from accessing production-like data or enforcing "human-in-the-loop" validation).
  • Build vs. Buy: Justifies buying this lightweight, maintained package over custom solutions for agent detection, reducing dev effort and technical debt.
  • Roadmap Priorities:
    • Phase 1: Integrate into CI/CD pipelines to flag AI-generated test runs or automated deployments.
    • Phase 2: Extend to user-facing features (e.g., "This response was generated with [Agent Name]" in support tools).
    • Phase 3: Leverage for dynamic pricing or feature gating (e.g., "AI agents get a limited API tier").

When to Consider This Package

  • Adopt if:
    • Your PHP/Laravel stack interacts with AI agents (e.g., Copilot, Claude, Cursor) or automated dev tools (e.g., Replit, Devin).
    • You need lightweight, environment-variable-based detection (no browser/HTTP headers to parse).
    • Your use case requires agent-specific logic (e.g., "If Copilot, suggest human review").
    • You’re building tools for developers, DevOps, or AI-assisted workflows (e.g., IDE plugins, CLI tools).
  • Look elsewhere if:
    • You need browser-based agent detection (e.g., for web apps; use user-agent parsing libraries like Mobile-Detect).
    • Your environment lacks PHP 8.2+ (package requires this).
    • You’re detecting non-AI automated tools (e.g., cron jobs, web scrapers; consider custom env vars or ps checks).
    • You need deep integration with AI APIs (e.g., rate-limiting by agent; use API-specific SDKs).

How to Pitch It (Stakeholders)

For Executives: *"This package lets us automatically detect AI agents (like GitHub Copilot or Claude) in our PHP/Laravel apps. We can use it to:

  • Improve security by blocking automated access to sensitive data.
  • Enhance developer tools (e.g., flag AI-generated code in PRs).
  • Future-proof our stack as AI tools evolve—no custom maintenance needed. It’s a 5-minute integration with zero runtime cost, and it’s maintained by Laravel’s team. Let’s pilot it in our CI/CD pipeline first."*

For Engineers: *"Agent Detector is a batteries-included way to check if code runs in an AI environment. Key perks:

  • Zero dependencies: Just composer require laravel/agent-detector.
  • Extensible: Supports 15+ agents (Copilot, Cursor, Replit, etc.) via env vars or filesystem checks.
  • Flexible API: Use AgentDetector::detect() for broad checks or knownAgent() === KnownAgent::Claude for specific logic.
  • Future-safe: Community-driven (MIT license) with active updates. Proposal: Add a middleware to log agent activity in /admin/audit and gate sensitive endpoints (e.g., /data/export)."*
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.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle