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/Laravel utility to detect when your code runs inside an AI agent or automated dev environment. Detect via AgentDetector::detect() or detectAgent(), identify known agents like Cursor, Gemini, Codex, Claude, or custom via env vars.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • AI/Automation-Aware Feature Flags: Enable or disable features (e.g., rate limits, UI hints) based on whether the request originates from an AI agent (e.g., Copilot, Claude) vs. a human user.
  • Developer Experience (DX) Enhancements: Customize IDE tooltips, CLI suggestions, or error messages for AI-assisted workflows (e.g., "This warning is safe to ignore in Copilot-generated code").
  • Security & Compliance: Restrict sensitive operations (e.g., API key exposure, data exports) when detected in automated environments like Replit or Devin.
  • Analytics & Telemetry: Differentiate between human and AI-driven interactions to refine metrics (e.g., "Copilot-assisted commits reduced bug rates by X%").
  • Build vs. Buy: Avoid reinventing agent detection logic (e.g., parsing env vars or filesystem checks) when this package offers maintained, extensible coverage.
  • Roadmap Prioritization: Justify investment in AI-integrated workflows by leveraging detection to measure adoption (e.g., "30% of PRs use Copilot—prioritize DX improvements").

When to Consider This Package

  • Adopt if:

    • Your PHP/Laravel app interacts with AI agents (e.g., Copilot, Claude) or automated dev tools (Replit, Devin).
    • You need lightweight, environment-variable-based detection (no browser fingerprinting or complex parsing).
    • Your use case requires extensibility (e.g., adding custom agents via AI_AGENT env var).
    • You’re building developer tools, CLI apps, or APIs where agent context matters (e.g., rate limiting, UI/UX tweaks).
  • Look elsewhere if:

    • You need browser-side detection (this is server-side only).
    • Your agents lack standard env vars/filesystem markers (e.g., proprietary tools).
    • You require real-time agent behavior analysis (e.g., tracking Copilot’s token usage patterns).
    • Your stack isn’t PHP/Laravel (though the logic could be ported).

How to Pitch It (Stakeholders)

For Executives:

*"This package lets us automatically detect AI agents (like Copilot or Claude) in our Laravel apps with zero code changes. We can use it to:

  • Improve developer productivity by tailoring tooling to AI-assisted workflows (e.g., suppressing false positives in Copilot-generated code).
  • Enhance security by blocking sensitive actions in automated environments (e.g., API key leaks in Replit).
  • Measure AI adoption to prioritize features that reduce friction for developers using AI tools. It’s lightweight, open-source, and maintained by Laravel—no vendor lock-in."*

For Engineers:

*"This solves a growing pain point: distinguishing between human and AI-driven interactions in PHP/Laravel. Key benefits:

  • Plug-and-play: Detects 15+ agents (Copilot, Claude, Replit, etc.) via env vars or filesystem checks.
  • Extensible: Add custom agents by setting AI_AGENT=your-tool—no forks needed.
  • Performance: Zero runtime overhead; detection happens via static env var checks.
  • Use cases:
    • Feature flags: Disable rate limits for AI agents.
    • DX: Show Copilot-specific hints in error messages.
    • Security: Block SECRET_KEY logs in automated environments.
  • Example:
    if (detectAgent()->knownAgent() === KnownAgent::Copilot) {
        // Customize UI/CLI for Copilot users
    }
    

No reinventing the wheel—just drop it into composer.json and start detecting."*

For Data/Analytics Teams:

*"This enables us to segment AI vs. human interactions in our telemetry. For example:

  • Track how often Copilot/Claude users trigger specific features.
  • Measure the impact of AI tools on developer efficiency (e.g., 'Copilot users submit PRs 20% faster').
  • Correlate agent usage with bug rates or support tickets. Lightweight, server-side, and ready to integrate with existing analytics pipelines."
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle