Laravel AI SDK 1.2: Agent Skills, Cohere & Smarter AI Workflows
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Laravel AI SDK 1.2: Agent Skills, Cohere & Smarter AI Workflows
Laravel AI SDK 1.2: Agent Skills, Cohere & Smarter AI Workflows Artificial intelligence is becoming a practical part of modern web development. From customer support assistants and intelligent search to automated workflows and content generation, developers are finding new ways to integrate AI into everyday applications. For Laravel developers, the official Laravel AI SDK provides a framework-native approach to building these features without manually managing a different integration for every AI provider. The SDK reached version 1.0 in September 2026, followed by versions 1.1 and 1.2 in early October. These releases introduce improvements to agent skills, provider integrations, tool approvals, and classification capabilities. In this article, we’ll explore the important changes and how they can influence real-world Laravel projects.
人工智能正逐渐成为现代 Web 开发中不可或缺的一部分。从客户支持助手和智能搜索,到自动化工作流和内容生成,开发人员正在寻找各种新方法将人工智能集成到日常应用程序中。对于 Laravel 开发人员而言,官方的 Laravel AI SDK 提供了一种框架原生的方法来构建这些功能,而无需为每个 AI 提供商手动管理不同的集成。该 SDK 于 2026 年 9 月发布了 1.0 版本,随后在 10 月初发布了 1.1 和 1.2 版本。这些版本在代理技能、提供商集成、工具审批和分类能力方面进行了改进。在本文中,我们将探讨这些重要变化及其对实际 Laravel 项目的影响。
What Is the Laravel AI SDK? The Laravel AI SDK is an official Laravel package that provides a consistent interface for integrating AI capabilities into PHP applications. Instead of building separate integrations for each model provider, developers can use the SDK’s Laravel-oriented APIs to work with supported capabilities such as text generation, AI agents, structured output, embeddings, and other AI tasks. You can install the package using Composer: composer require laravel/ai After installation, follow the official documentation to configure your provider credentials and implement the features your application needs. The main advantage is developer productivity: AI functionality can fit into familiar Laravel patterns, including classes, configuration, queues, and application services.
什么是 Laravel AI SDK?Laravel AI SDK 是一个官方的 Laravel 软件包,为将 AI 功能集成到 PHP 应用程序中提供了一致的接口。开发人员无需为每个模型提供商构建单独的集成,而是可以使用 SDK 面向 Laravel 的 API 来处理文本生成、AI 代理、结构化输出、嵌入以及其他 AI 任务等受支持的功能。你可以使用 Composer 安装该软件包:composer require laravel/ai。安装完成后,请按照官方文档配置你的提供商凭据并实现应用程序所需的功能。其主要优势在于开发人员的生产力:AI 功能可以融入熟悉的 Laravel 模式中,包括类、配置、队列和应用程序服务。
What’s New in Laravel AI SDK 1.1? Version 1.1 introduced several improvements that make AI agents more flexible and easier to integrate into applications. 1. Agent Skills Support One of the notable additions is support for the Agent Skills standard. An AI agent may need different instructions and procedures depending on the task it is performing. For example, an agent working in an ecommerce application might need one set of instructions for order lookup and another for generating product descriptions. Agent Skills provide a structured way to package task-specific instructions so compatible agents can load them when needed. This can help developers organize AI behavior into reusable units instead of placing every instruction into one large prompt.
Laravel AI SDK 1.1 有哪些新功能?1.1 版本引入了多项改进,使 AI 代理更加灵活且更易于集成到应用程序中。1. 代理技能支持:其中一个显著的增加是对“代理技能”(Agent Skills)标准的支持。AI 代理可能需要根据其执行的任务采用不同的指令和程序。例如,在电子商务应用程序中工作的代理可能需要一套用于订单查询的指令,而另一套则用于生成产品描述。代理技能提供了一种结构化的方式来打包特定任务的指令,以便兼容的代理可以在需要时加载它们。这可以帮助开发人员将 AI 行为组织成可重用的单元,而不是将所有指令都塞进一个巨大的提示词中。
Potential use cases include: Customer support workflows, Documentation assistance, Product content generation, Code review and development tasks, Internal business process automation. The key benefit is modularity. As an application grows, skills can help keep AI instructions organized and easier to maintain.
潜在的用例包括:客户支持工作流、文档辅助、产品内容生成、代码审查和开发任务、内部业务流程自动化。其核心优势在于模块化。随着应用程序的增长,技能有助于保持 AI 指令的条理性,并使其更易于维护。
-
Cohere Text Generation Support: Laravel AI SDK 1.1 also added Cohere as a text-generation provider. Provider choice matters because applications have different requirements for cost, response quality, latency, data handling, and supported features. With additional provider options, developers have more flexibility when designing their AI architecture. For example, a project might use one provider for conversational responses and another for search-related tasks, depending on capability and cost. However, provider compatibility is not universal. Always check which features and tools are supported by the particular model and integration you intend to use.
-
Cohere 文本生成支持:Laravel AI SDK 1.1 还增加了 Cohere 作为文本生成提供商。选择提供商至关重要,因为应用程序对成本、响应质量、延迟、数据处理和支持的功能有不同的要求。有了更多的提供商选择,开发人员在设计 AI 架构时就有了更大的灵活性。例如,一个项目可能会根据能力和成本,使用一个提供商来处理对话响应,而使用另一个提供商来处理与搜索相关的任务。然而,提供商的兼容性并非通用。请务必检查你打算使用的特定模型和集成所支持的功能和工具。
-
Approval Controls for Built-in Tools: AI agents can do more than generate text. Depending on their available tools, they may interact with files, services, and application workflows. That makes permissions and human oversight important. Version 1.1 introduced the ability to require approval for built-in tools. This can help developers add an approval step before an agent performs certain actions. Consider a business application where an AI assistant prepares a report or proposes a file change. Reading information may be acceptable automatically, while modifying important files or triggering a sensitive operation could require confirmation.
-
内置工具的审批控制:AI 代理的功能不仅仅是生成文本。根据其可用的工具,它们可能会与文件、服务和应用程序工作流进行交互。这使得权限和人工监督变得非常重要。1.1 版本引入了对内置工具进行审批的功能。这可以帮助开发人员在代理执行某些操作之前增加一个审批步骤。考虑一个 AI 助手准备报告或提议文件更改的业务应用程序。读取信息可能是自动允许的,而修改重要文件或触发敏感操作则可能需要确认。
A good production design should distinguish between: Read-only operations: Actions that retrieve information. Low-risk operations: Actions that can be performed automatically under controlled conditions. Sensitive operations: Actions that require authorization or explicit approval. Tool approval is one part of a larger security strategy. Authentication, authorization, input validation, audit logs, and server-side permission checks are still essential.
一个良好的生产设计应该区分以下几点:只读操作:检索信息的操作。低风险操作:可以在受控条件下自动执行的操作。敏感操作:需要授权或明确批准的操作。工具审批是更广泛安全策略的一部分。身份验证、授权、输入验证、审计日志和服务器端权限检查仍然是必不可少的。
What’s New in Laravel AI SDK 1.2? Version 1.2, released on October 7, 2026, continued improving the SDK’s reliability and supported AI workflows. 1. Image-Based Classification: The release adds support for OpenAI Decisions classification with image attachments. Classification is useful when an application needs to categorize input rather than generate a long response. For example, an application could classify a submitted request, identify a workflow category, or help route incoming content to the correct process. With image attachments supported for this classification capability, developers can explore workflows where visual input contributes to the classification decision. As with any AI-based classification system, test against representative data and define what should happen when the model returns an uncertain or unexpected result.
Laravel AI SDK 1.2 有哪些新功能?于 2026 年 10 月 7 日发布的 1.2 版本继续提高了 SDK 的可靠性并支持了更多 AI 工作流。1. 基于图像的分类:该版本增加了对带有图像附件的 OpenAI Decisions 分类的支持。当应用程序需要对输入进行分类而不是生成长篇响应时,分类非常有用。例如,应用程序可以对提交的请求进行分类、识别工作流类别或帮助将传入的内容路由到正确的流程。由于此分类功能支持图像附件,开发人员可以探索视觉输入有助于分类决策的工作流。与任何基于 AI 的分类系统一样,请针对代表性数据进行测试,并定义当模型返回不确定或意外结果时应采取的措施。
-
Improvements to Structured Output: Structured output is important when an application needs machine-readable data rather than free-form text. Imagine an AI feature that extracts information from a request and returns fields such as: Category, Priority, Summary, Recommended next step. Your application can then validate and process the result using normal PHP code. Version 1.2 includes fixes related to preserving structured output configuration when certain provider options are set, as well as a fix for structured output with Bedrock models when forced tool choice is not used. These are targeted improvements, but they matter in production systems where downstream code.
-
结构化输出的改进:当应用程序需要机器可读的数据而非自由文本时,结构化输出非常重要。想象一个 AI 功能,它从请求中提取信息并返回如下字段:类别、优先级、摘要、建议的下一步。然后,你的应用程序可以使用普通的 PHP 代码来验证和处理结果。1.2 版本包括了在设置某些提供商选项时保留结构化输出配置的相关修复,以及在不使用强制工具选择时针对 Bedrock 模型结构化输出的修复。这些都是针对性的改进,但它们在下游代码的生产系统中至关重要。