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 Laravel/PHP utility to detect when your code is running inside an AI agent or automated dev environment. Supports multiple known agents (e.g., Cursor, Gemini, Codex, Claude) via environment-variable detection. Requires PHP 8.2+.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • AI/Automation-Aware Feature Flags: Enable/disable features (e.g., rate limits, experimental APIs) when running in AI environments (e.g., Copilot, Claude) to prevent misuse or unintended behavior.
  • Dynamic Content Personalization: Serve AI-generated vs. human-optimized content (e.g., tutorials, docs) based on the detected agent.
  • Security & Compliance: Block or log AI agent interactions for sensitive operations (e.g., admin panels, payment flows) to mitigate automation risks.
  • Developer Tooling: Integrate with IDEs (e.g., Replit, Kiro) to provide agent-specific hints, debugging, or optimizations (e.g., "This code was generated by Claude—review for edge cases").
  • Cost Optimization: Route AI-generated requests to cheaper endpoints or mock services during development.
  • Roadmap Prioritization: Justify investment in AI tooling (e.g., Copilot plugins) by quantifying adoption via detection metrics.
  • Build vs. Buy: Replace custom agent-detection scripts with a maintained, Laravel-ecosystem package to reduce tech debt.

When to Consider This Package

Adopt if:

  • Your PHP/Laravel app interacts with AI agents, CLI tools, or automated environments (e.g., Copilot, Replit, Codex) and needs to differentiate behavior.
  • You require lightweight, environment-variable-based detection (no browser fingerprinting or heavy parsing).
  • Your team uses multiple AI tools (e.g., Claude, Gemini, v0) and needs consistent identification.
  • You’re building developer tools, IDE plugins, or CI/CD integrations where agent context matters.
  • You want to future-proof for emerging agents (e.g., custom AI_AGENT support).

Look elsewhere if:

  • You need browser-based agent detection (e.g., for web apps; use User-Agent parsers like Mobile Detect).
  • Your use case requires deep behavioral analysis (e.g., mouse movements, typing patterns) beyond env vars.
  • You’re constrained to PHP < 8.2 (package requires PHP 8.2+).
  • You prefer vendor-locked solutions (e.g., GitHub Copilot’s native APIs) over open-source tools.

How to Pitch It (Stakeholders)

For Executives: *"This package lets us automatically detect AI agents (like GitHub Copilot, Claude, or Replit) in our Laravel apps using simple environment variables. We can use this to:

  • Protect sensitive features from automated misuse (e.g., block AI-generated admin actions).
  • Personalize developer experiences (e.g., serve AI-optimized docs or hints).
  • Reduce costs by routing AI traffic to mock services during testing.
  • Stay ahead as AI tooling evolves—it’s maintained by Laravel’s team and supports 15+ agents. No code changes needed for basic detection; integrates in minutes. ROI: Immediate security/compliance wins + long-term flexibility for AI integrations."

For Engineers: *"This is a zero-dependency, PHP 8.2+ library to detect AI agents via env vars (e.g., COPILOT_MODEL, CLAUDE_CODE). Key perks:

  • Plug-and-play: One-liner to check AgentDetector::detect()->isAgent.
  • Extensible: Add custom agents via AI_AGENT env var or extend the KnownAgent enum.
  • Lightweight: No external APIs or heavy parsing—just env var checks.
  • Laravel-native: Uses the same namespace/style as other Laravel packages. Use cases: Feature gating, logging, or tooling that needs to know if code is AI-generated. Example:
if (AgentDetector::detect()->knownAgent() === KnownAgent::Claude) {
    // Enable Claude-specific optimizations
}
```*
*Alternatives*: Rolling your own env var checks or using heavier libraries like `browser-detect` (overkill for this use case)."*
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata