From d6d04717c264c6ee7895beccbe30353501bd2f4c Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Tue, 21 Apr 2026 03:15:06 +0800 Subject: [PATCH 1/2] fix: serialize Task class-reference fields for checkpointing Task fields that store class references (output_pydantic, output_json, response_model, converter_cls) caused PydanticSerializationError when RuntimeState serialized Crew entities during checkpointing. Serialize to model_json_schema() and hydrate back via create_model_from_schema. --- lib/crewai/src/crewai/task.py | 49 ++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/lib/crewai/src/crewai/task.py b/lib/crewai/src/crewai/task.py index 1cac87cb89..04bbf3718d 100644 --- a/lib/crewai/src/crewai/task.py +++ b/lib/crewai/src/crewai/task.py @@ -32,6 +32,7 @@ field_validator, model_validator, ) +from pydantic.functional_serializers import PlainSerializer from pydantic_core import PydanticCustomError from typing_extensions import Self @@ -86,6 +87,22 @@ def get_supported_content_types(provider: str, api: str | None = None) -> list[s from crewai.utilities.string_utils import interpolate_only +def _serialize_model_class(v: type[BaseModel] | None) -> dict[str, Any] | None: + """Serialize a Pydantic model class reference to its JSON schema.""" + return v.model_json_schema() if v else None + + +def _deserialize_model_class(v: Any) -> type[BaseModel] | None: + """Hydrate a model class reference from checkpoint data.""" + if v is None or isinstance(v, type): + return v + if isinstance(v, dict): + from crewai.utilities.pydantic_schema_utils import create_model_from_schema + + return create_model_from_schema(v) + return None + + class Task(BaseModel): """Class that represents a task to be executed. @@ -141,15 +158,33 @@ class Task(BaseModel): description="Whether the task should be executed asynchronously or not.", default=False, ) - output_json: type[BaseModel] | None = Field( + output_json: Annotated[ + type[BaseModel] | None, + BeforeValidator(_deserialize_model_class), + PlainSerializer( + _serialize_model_class, return_type=dict | None, when_used="json" + ), + ] = Field( description="A Pydantic model to be used to create a JSON output.", default=None, ) - output_pydantic: type[BaseModel] | None = Field( + output_pydantic: Annotated[ + type[BaseModel] | None, + BeforeValidator(_deserialize_model_class), + PlainSerializer( + _serialize_model_class, return_type=dict | None, when_used="json" + ), + ] = Field( description="A Pydantic model to be used to create a Pydantic output.", default=None, ) - response_model: type[BaseModel] | None = Field( + response_model: Annotated[ + type[BaseModel] | None, + BeforeValidator(_deserialize_model_class), + PlainSerializer( + _serialize_model_class, return_type=dict | None, when_used="json" + ), + ] = Field( description="A Pydantic model for structured LLM outputs using native provider features.", default=None, ) @@ -189,7 +224,13 @@ class Task(BaseModel): description="Whether the task should instruct the agent to return the final answer formatted in Markdown", default=False, ) - converter_cls: type[Converter] | None = Field( + converter_cls: Annotated[ + type[Converter] | None, + BeforeValidator(lambda v: v if v is None or isinstance(v, type) else None), + PlainSerializer( + _serialize_model_class, return_type=dict | None, when_used="json" + ), + ] = Field( description="A converter class used to export structured output", default=None, ) From 874405b825845cbc1f23b5de646ecf65e4b02529 Mon Sep 17 00:00:00 2001 From: iris-clawd Date: Mon, 20 Apr 2026 20:09:37 -0300 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20Add=20'Build=20with=20AI'=20page=20?= =?UTF-8?q?=E2=80=94=20AI-native=20docs=20for=20coding=20agents=20(#5558)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: add Build with AI page for coding agents and AI assistants * docs: add Build with AI section to README * docs: trim README Build with AI section to skills install only * docs: add skills.sh reference link for npx install * docs: add coding agent logos to Build with AI page --------- Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com> --- README.md | 17 ++ docs/docs.json | 33 ++- docs/en/guides/coding-tools/build-with-ai.mdx | 206 ++++++++++++++++++ 3 files changed, 245 insertions(+), 11 deletions(-) create mode 100644 docs/en/guides/coding-tools/build-with-ai.mdx diff --git a/README.md b/README.md index c832d00259..bcb6634aa3 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ intelligent automations. ## Table of contents +- [Build with AI](#build-with-ai) - [Why CrewAI?](#why-crewai) - [Getting Started](#getting-started) - [Key Features](#key-features) @@ -101,6 +102,22 @@ intelligent automations. - [Telemetry](#telemetry) - [License](#license) +## Build with AI + +Using an AI coding agent? Teach it CrewAI best practices in one command: + +**Claude Code:** +```shell +/plugin marketplace add crewAIInc/skills +``` + +**Cursor, Codex, Windsurf, and others ([skills.sh](https://skills.sh/crewaiinc/skills)):** +```shell +npx skills add crewaiinc/skills +``` + +This installs the official [CrewAI Skills](https://github.com/crewAIInc/skills) — structured instructions that teach coding agents how to scaffold Flows, configure Crews, design agents and tasks, and follow CrewAI patterns. + ## Why CrewAI?
diff --git a/docs/docs.json b/docs/docs.json index f727c3e844..af0854be11 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -127,7 +127,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -601,7 +602,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -1075,7 +1077,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -1549,7 +1552,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -2023,7 +2027,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -2497,7 +2502,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -2969,7 +2975,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -3441,7 +3448,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -3914,7 +3922,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -4388,7 +4397,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { @@ -4860,7 +4870,8 @@ "group": "Coding Tools", "icon": "terminal", "pages": [ - "en/guides/coding-tools/agents-md" + "en/guides/coding-tools/agents-md", + "en/guides/coding-tools/build-with-ai" ] }, { diff --git a/docs/en/guides/coding-tools/build-with-ai.mdx b/docs/en/guides/coding-tools/build-with-ai.mdx new file mode 100644 index 0000000000..744ad1bf47 --- /dev/null +++ b/docs/en/guides/coding-tools/build-with-ai.mdx @@ -0,0 +1,206 @@ +--- +title: "Build with AI" +description: "Everything AI coding agents need to build, deploy, and scale with CrewAI — skills, machine-readable docs, deployment, and enterprise features." +icon: robot +mode: "wide" +--- + +# Build with AI + +CrewAI is AI-native. This page brings together everything an AI coding agent needs to build with CrewAI — whether you're Claude Code, Codex, Cursor, Gemini CLI, or any other assistant helping a developer ship crews and flows. + +### Supported Coding Agents + + + + + + + + + + + This page is designed to be consumed by both humans and AI assistants. If you're a coding agent, start with **Skills** to get CrewAI context, then use **llms.txt** for full docs access. + + +--- + +## 1. Skills — Teach Your Agent CrewAI + +**Skills** are instruction packs that give coding agents deep CrewAI knowledge — how to scaffold Flows, configure Crews, use tools, and follow framework conventions. + + + + Anthropic + CrewAI skills are available in the **Claude Code plugin marketplace** — the same distribution channel used by top AI-native companies: + ``` + /plugin marketplace add crewAIInc/skills + ``` + + + Works with Claude Code, Codex, Cursor, Gemini CLI, or any coding agent: + ```shell + npx skills add crewaiinc/skills + ``` + Pulls from the [skills.sh registry](https://skills.sh/crewaiinc/skills). + + + + + + Use either method above — the Claude Code plugin marketplace or `npx skills add`. Both install the official [crewAIInc/skills](https://github.com/crewAIInc/skills) pack. + + + The skill pack teaches your agent: + - **Flows** — stateful apps, steps, and crew kickoffs + - **Crews & Agents** — YAML-first patterns, roles, tasks, delegation + - **Tools & Integrations** — search, APIs, MCP servers, and common CrewAI tools + - **Project layout** — CLI scaffolds and repo conventions + - **Up-to-date patterns** — tracks current CrewAI docs and best practices + + + Your agent can now scaffold and build CrewAI projects without you re-explaining the framework each session. + + + + + + How skills work in CrewAI agents — injection, activation, and patterns. + + + Overview of the crewAIInc/skills pack and what it includes. + + + Set up AGENTS.md for Claude Code, Codex, Cursor, and Gemini CLI. + + + Official listing — skills, install stats, and audits. + + + +--- + +## 2. llms.txt — Machine-Readable Docs + +CrewAI publishes an `llms.txt` file that gives AI assistants direct access to the full documentation in a machine-readable format. + +``` +https://docs.crewai.com/llms.txt +``` + + + + [`llms.txt`](https://llmstxt.org/) is an emerging standard for making documentation consumable by large language models. Instead of scraping HTML, your agent can fetch a single structured text file with all the content it needs. + + CrewAI's `llms.txt` is **already live** — your agent can use it right now. + + + Point your coding agent at the URL when it needs CrewAI reference docs: + + ``` + Fetch https://docs.crewai.com/llms.txt for CrewAI documentation. + ``` + + Many coding agents (Claude Code, Cursor, etc.) can fetch URLs directly. The file contains structured documentation covering all CrewAI concepts, APIs, and guides. + + + - **No scraping required** — clean, structured content in one request + - **Always up-to-date** — served directly from docs.crewai.com + - **Optimized for LLMs** — formatted for context windows, not browsers + - **Complements skills** — skills teach patterns, llms.txt provides reference + + + +--- + +## 3. Deploy to Enterprise + +Go from a local crew to production on **CrewAI AMP** (Agent Management Platform) in minutes. + + + + Scaffold and test your crew or flow: + ```bash + crewai create crew my_crew + cd my_crew + crewai run + ``` + + + Ensure your project structure is ready: + ```bash + crewai deploy --prepare + ``` + See the [preparation guide](/en/enterprise/guides/prepare-for-deployment) for details on project structure and requirements. + + + Push to the CrewAI AMP platform: + ```bash + crewai deploy + ``` + You can also deploy via [GitHub integration](/en/enterprise/guides/deploy-to-amp) or [Crew Studio](/en/enterprise/guides/enable-crew-studio). + + + Your deployed crew gets a REST API endpoint. Integrate it into any application: + ```bash + curl -X POST https://app.crewai.com/api/v1/crews//kickoff \ + -H "Authorization: Bearer $CREWAI_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{"inputs": {"topic": "AI agents"}}' + ``` + + + + + + Full deployment guide — CLI, GitHub, and Crew Studio methods. + + + Platform overview — what AMP provides for production crews. + + + +--- + +## 4. Enterprise Features + +CrewAI AMP is built for production teams. Here's what you get beyond deployment. + + + + Detailed execution traces, logs, and performance metrics for every crew run. Monitor agent decisions, tool calls, and task completion in real time. + + + No-code/low-code interface to create, customize, and deploy crews visually — then export to code or deploy directly. + + + Stream real-time events from crew executions to your systems. Integrate with Slack, Zapier, or any webhook consumer. + + + SSO, RBAC, and organization-level controls. Manage who can create, deploy, and access crews across your team. + + + Publish and share custom tools across your organization. Install community tools from the registry. + + + Run CrewAI AMP on your own infrastructure. Full platform capabilities with data residency and compliance controls. + + + + + + AMP is for teams that need to move AI agent workflows from prototypes to production — with observability, access controls, and scalable infrastructure. Whether you're a startup or enterprise, AMP handles the operational complexity so you can focus on building agents. + + + - **Cloud (app.crewai.com)** — managed by CrewAI, fastest path to production + - **Factory (self-hosted)** — run on your own infrastructure for full data control + - **Hybrid** — mix cloud and self-hosted based on sensitivity requirements + + + Sign up at [app.crewai.com](https://app.crewai.com) to see current plans. Enterprise and Factory pricing is available on request. + + + + + Sign up and deploy your first crew to production. +