---
title: "Summarise Zendesk Tickets with CrewAI | EnConvert"
description: "Summarise Zendesk support tickets inside a CrewAI agent with EnConvert Distill, which returns schema-defined fields for up to 50 public page URLs in one call"
canonical: "https://www.enconvert.com/solutions/summarise-zendesk-tickets-with-crewai-enconvert"
locale: "en"
---

# How to Summarise Zendesk Tickets with CrewAI

A developer building a CrewAI agent that processes support tickets needs structured content from Zendesk pages before the agent can triage, categorise, or escalate. Zendesk support pages mix the ticket subject, conversation thread, status metadata, and sidebar navigation in a layout that returns no clean structured text when fetched directly, and the Zendesk API requires a service account with role-based permissions before ticket content can be read programmatically. EnConvert Distill accepts a publicly accessible Zendesk page URL and a schema the agent defines, and returns structured fields in one synchronous call. The agent gets schema-defined ticket content ready for downstream triage with no Zendesk API credentials.

## Example

```python
import os

import requests
from crewai import Agent, Crew, Process, Task
from crewai.tools import tool

# CrewAI reads OPENAI_API_KEY from the environment for the gpt-4.1 model
ZENDESK_PAGE_URLS = [url.strip() for url in os.environ["ZENDESK_PAGE_URLS"].split(",")]  # public Zendesk Help Centre articles or community posts

BASE_URL = "https://api.enconvert.com/v2"
headers = {
    "X-API-Key": os.environ["ENCONVERT_API_KEY"],
    "Content-Type": "application/json",
}

# The fields the agent receives. The response keys match these names exactly.
TICKET_SCHEMA = {
    "subject": "The subject or title of the support post or article",
    "summary": "A three sentence summary of the problem described, using only text on the page",
    "resolution": (
        "The accepted answer or stated resolution, in one or two sentences. "
        "Return an empty string if the page shows none."
    ),
    "category": "The topic, section, or category the page is filed under",
    "customer_sentiment": (
        "Only if the author states how they feel, such as frustrated or satisfied, give that "
        "word. Return an empty string otherwise. Do not infer a mood."
    ),
    "date_created": "The date the post or ticket was created, if the page shows one",
}

def as_text(value) -> str:
    return str(value) if value not in (None, "", []) else "not stated"

@tool("summarise_zendesk_tickets")
def summarise_zendesk_tickets(urls: list[str]) -> str:
    """Reads publicly accessible Zendesk pages such as Help Centre articles and community posts,
    and returns structured fields for each: subject, summary, resolution, category, sentiment,
    and date. Accepts up to 50 URLs. Private tickets behind a login cannot be read."""
    if len(urls) > 50:
        return "Too many URLs. Distill accepts at most 50 per call."

    # One synchronous call: no job_id, no polling, no download step
    response = requests.post(
        f"{BASE_URL}/distill",
        headers=headers,
        json={"urls": urls, "schema": TICKET_SCHEMA},
        timeout=300,
    )

    # Distill runs on paid plans only, and the free tier returns 402
    if response.status_code == 402:
        return "Distill requires a paid plan."
    response.raise_for_status()

    tickets = []
    for result in response.json()["results"]:
        if result["status"] != "completed":
            tickets.append(f"Source: {result['url']}\nCould not be read ({result['status']}).")
            continue

        render_quality = result.get("render_quality", 1.0)
        if render_quality < 0.5:
            tickets.append(
                f"Source: {result['url']}\nLow render quality ({render_quality}), "
                "likely a login page. Skipped."
            )
            continue

        data = result["data"]  # keys match TICKET_SCHEMA exactly
        tickets.append(
            f"Source: {result['url']}\n"
            f"Subject: {data['subject']}\n"
            f"Category: {as_text(data['category'])}\n"
            f"Created: {as_text(data['date_created'])}\n"
            f"Stated sentiment: {as_text(data['customer_sentiment'])}\n"
            f"Resolution: {as_text(data['resolution'])}\n"
            f"Summary: {data['summary']}"
        )
    return "\n\n---\n\n".join(tickets)

analyst = Agent(
    role="Support Analyst",
    goal="Triage support content accurately, and cite the page behind every statement",
    backstory="You read support threads closely and never state a resolution the page does not show.",
    tools=[summarise_zendesk_tickets],
    llm="gpt-4.1",
    verbose=True,
)

task = Task(
    description=(
        "Read these Zendesk pages: {ticket_urls}. Summarise each one, say whether it has a "
        "stated resolution, and group them by category. Cite the URL for every statement."
    ),
    expected_output="A short summary of each page, whether it is resolved, and the pages grouped by category.",
    agent=analyst,
)

crew = Crew(agents=[analyst], tasks=[task], process=Process.sequential, verbose=True)

result = crew.kickoff(inputs={"ticket_urls": ", ".join(ZENDESK_PAGE_URLS)})
print(result)
```

## Output

Distill returns schema-defined fields inline as structured JSON in the data object, with no polling and no job_id. The render_quality score lets the agent detect a login wall before reasoning over an empty result, and private tickets that require Zendesk authentication come back with a low render_quality and are skipped. Reading Zendesk tickets through the API requires a service account, role configuration, and separate endpoint calls for ticket fields and comments, while Distill returns schema-defined fields from the page URL in one call.

## Get started

[Get free API key — 500 ops per month, no card required. Note: Distill runs on paid plans. Free tier returns 402.](https://www.enconvert.com/auth?mode=signup)

## Related solutions

- [How to Summarise GitHub with Pydantic AI](https://www.enconvert.com/solutions/summarise-github-with-pydantic-ai-enconvert.md)
- [How to Summarise Google Docs with LangGraph](https://www.enconvert.com/solutions/summarise-google-docs-with-langgraph-enconvert.md)
- [How to Summarise GitHub with LlamaIndex](https://www.enconvert.com/solutions/summarise-github-with-llamaindex-enconvert.md)
- [How to Summarise Google Docs with Pydantic AI](https://www.enconvert.com/solutions/summarise-google-docs-with-pydantic-ai-enconvert.md)
- [How to Summarise YouTube Transcripts with LlamaIndex](https://www.enconvert.com/solutions/summarise-youtube-transcripts-with-llamaindex-enconvert.md)
- [How to Summarise GitHub Issues with CrewAI](https://www.enconvert.com/solutions/summarise-github-issues-with-crewai-enconvert.md)
