pdro-lucas/filament-ai-writer
A reusable Filament Action that adds AI-powered text generation to any form field, supporting Anthropic Claude, OpenAI, and Google Gemini. Configure an API key, attach the action to a field, and generate content via an interactive modal or silent mode using other form fields as context.
Architecture fit. The package is a thin, well-scoped Filament 4 Action (AiWriterAction) that attaches to any form field via hintAction()/suffixAction(). That is the correct integration seam for Filament: it is additive, requires no schema changes, no custom page controllers, and no changes to existing form definitions beyond a fluent chain. Internally it is a clean three-layer design — action (UI + orchestration) → AiProvider contract → concrete drivers (Anthropic/OpenAI/Gemini) — with configuration, a published config file, and a service provider resolved through Laravel auto-discovery. Two extension points matter commercially: AiProvider can be rebound to an internal gateway (Azure OpenAI, Bedrock, LiteLLM, a proxy that logs and meters), and AiTextGenerated plus beforeGenerate/globalBeforeGenerate provide hooks for entitlement checks, rate limiting, and credit debiting without forking.
Integration feasibility. Installation is a single composer require, .env keys, and optional config publish. No migrations, no queue workers, no external services beyond the chosen provider. A competent Laravel developer can have a working pilot on one form field in under a day. The hard gates are narrow but real: Filament 4.x only (not 3.x) and PHP 8.1+/Laravel 10–12. Any application still on Filament 3 is blocked outright.
Technical risk.
src/Providers/ list only Anthropic, OpenAI, and Gemini. One of the two is wrong.gemini-3.1-flash-lite are unverified model identifiers; a bad default means first-run failures that look like integration bugs. Confirm each default against live provider model lists, or set models explicitly per environment.AI_WRITER_TIMEOUT=60. That holds a PHP-FPM worker for up to a minute and routinely exceeds 30s gateway/LB idle timeouts. There is no queued/async mode; adding one is custom work.AI_WRITER_RETRY_TIMES=2 on a non-idempotent, billed operation can double or triple spend if retries fire on timeouts rather than only on connect errors, 429s, and 5xx. Verify the retry predicate in source.AiTextGenerated to persist anything). GDPR/DPA, data residency, and PII handling are entirely your responsibility.valueMap/allowedValues filtering is a genuine strength — hallucinated select keys and off-list tags are dropped rather than persisted — but free-text modes write model output straight into a database-bound field with no diff, preview, or undo. Silent mode is a one-click mutation of business data.Key questions for the maintainer / spike.
result in AiTextGenerated? Cost attribution needs usage counts, not just text.Stack fit. Strong for a greenfield or recently upgraded Laravel 11/12 + Filament 4 admin panel that already has an AI budget and an approved vendor. Weak for a regulated environment without an internal AI gateway, and blocked for Filament 3 estates.
Migration path. Purely additive — no data migration, no backfill. The realistic path is: install → publish config → rebind AiProvider to an internal gateway so all traffic, keys, logging, metering, and provider failover are owned by you rather than the package → wire globalBeforeGenerate for permission/entitlement → listen to AiTextGenerated for audit and credit decrement → attach the action to one low-risk field. Vendor-side, the only lock-in is the config key names and the action's fluent API; both are small enough to shim if you later replace the package with in-house code.
Compatibility. Pin an exact version (avoid ^ on a 0.x beta), commit the lockfile, and record the Filament/PHP constraint in your dependency policy. Verify the package's tests run in your CI matrix before adoption; if there are none, add a smoke test that hits a mocked provider.
Sequencing.
Textarea in interactive mode, confirm the provider call, event dispatch, and error notifications. Validate default model IDs against each vendor.globalBeforeGenerate entitlement check, AiTextGenerated listener writing an audit row (user, field, provider, model, tokens/cost, timestamp), key management via secrets manager not .env in production.slug and tags where deterministic outputs are safe; keep interactive mode for anything customer-facing.Maintenance. The dominant cost is ownership risk, not code. A 9-star, zero-dependent, single-maintainer beta means you should assume you may be the maintainer: pin the version, keep a fork or vendored copy in your org, and treat upgrades as deliberate PRs. Budget roughly a few days per year for dependency currency (Filament major versions, provider API changes such as OpenAI's max_tokens → max_completion_tokens rename already visible in 0.5.1) plus unplanned breakage when a vendor deprecates a model. Changelog hygiene is good, which lowers the cost of tracking changes.
Support. Community-only, no SLA, no commercial backing. Escalation path is a GitHub issue. For internal tooling that is acceptable with a documented fallback (disable the action via globalBeforeGenerate returning false); for revenue-affecting workflows it is not sufficient on its own.
Scaling. Cost and load scale linearly with clicks, not with users. Each click is one synchronous HTTP call holding a worker for up to 60s. At modest volume (hundreds of generations/day) this is irrelevant; at thousands, worker exhaustion during provider slowness becomes a self-inflicted outage. Mitigations: reduce AI_WRITER_TIMEOUT to ~25–30s, cap prompt size, and — the real fix — move generation to a queue, which requires custom workaround since the package has no async mode. Provider rate limits and per-user quotas must be enforced by you in beforeGenerate. Track spend from AiTextGenerated; without token counts in the payload you will need to add usage capture at the provider/gateway layer.
Failure modes and blast radius.
TextInputs; array/select paths are filtered, but only against the allowlist — empty arrays and wrong-but-valid keys still get written..env replicated across environments; a leaked key has direct financial impact and is invisible without usage alerting.AiTextGenerated listener, there is no record of who generated what — a compliance gap in most enterprises.Ramp-up. Developer learning curve is near zero: the README is complete, the API is fluent and self-documenting, and the extension contract is one interface. Realistic onboarding is a half-day for an engineer and under an hour for an editor. Editor onboarding is the bigger lift: users need to learn that prompts are configuration, not magic, and that outputs require review. Non-technical costs concentrate in prompt engineering ownership (who owns the prompts, where are they versioned, who audits output quality) and in governance (vendor approval, data classification for fields the action is allowed to touch). Assign a prompt owner per form and an explicit allowlist of fields eligible for AI generation — otherwise adoption sprawls faster than oversight.
How can I help you explore Laravel packages today?