How Cobli Built an AI Assistant for a Fleet Platform Tracking 250K+ Vehicles

With Mastra, Cobli has grown from five specialized agents to more than 30 in production, supporting fleet operations and internal workflows.

30+

Agents in production

22 / 120+

Workflows / Tools

Cobli is the largest fleet management platform in Brazil, used by over 5,000 companies. It collects millions of telemetry events per day from 250K+ tracked cars, trucks and motorcycles.

For fleet managers, the challenge is knowing what to do with all that information. They used to navigate 154 screens to track vehicles, review driver safety, and manage fuel and costs. Now they can just talk to the Agent Fleet Manager.

Beyond the main assistant, Cobli has built more than 30 agents and 22 workflows with Mastra, from an onboarding assistant for customers to bug routing for their internal eng team.

Building agents to help customers use the product

Cobli's product is big. They offer vehicle tracking, driver safety & cameras, fuel management, maintenance, routes operations, and fleet administration. Customers don't always know how to onboard and what to do with all the features and data. Cobli started adding AI capabilities throughout the product to make users' lives easier.

Agent Fleet Onboarding researches each customer's company and creates reusable skills that capture its business context, fleet-management needs, and brand identity. Other agents use these skills to tailor their responses and generated content to that customer.

A few import workflows allow customers to bring data from existing spreadsheets of vehicles and drivers. AI maps the columns, with a person reviewing the result before the import goes ahead.

The team also built an agent to help customers schedule device installations. It involves coordinating customers, technicians, and vehicles across different locations. It's a key step, because until the devices are installed, Cobli has no vehicle data to work with and the customer cannot use the product.

For daily fleet management, Cobli built Agent Fleet Manager, which is the core experience in the product. Instead of navigating over 150 different pages and pulling together the information, managers can ask a question, e.g. how their fleet's safety is looking this month, and get an answer with recommended actions.

Fleet managers can also interact with Cobli's assistant through WhatsApp, bringing fleet questions into a channel they already use every day. Specialized agents help interpret incoming messages and media, while Fleet Manager handles fleet-related requests.

There's also an ops agent, a tracking analyzer agent, a scheduling agent, fuel image OCR, and more. In total, Cobli built over 30 specialized agents, 22 different workflows and over 120 tools with Mastra. And they keep building.

"We chose Mastra because it's written in TypeScript and because it has a really strong community. We also like that Mastra gives us ready-made solutions but at the same time allows us to build things our own way." — Pedro Almeida, Software Engineer

How the Cobli AI system is built

Cobli runs its agents and workflows in a TypeScript service built with Mastra, Bun, and Hono. They have a clear separation between the AI part and the business logic.

The first one relies on the Mastra layer. It contains the agents, workflows, tools, memory, and workspaces. Cobli's infrastructure layer owns the business logic. It contains the services and integrations. Tools are the bridge. Agents never call external APIs directly.

Fleet Manager is the main assistant, with 121+ tools for working with fleet data. It loads customer-specific skills from an S3 workspace, stores persistent memory in PostgreSQL, and uses LaunchDarkly to select a model for each request (with Gemini and Haiku as a fallback). For Python execution and artifact generation, the assistant uses an E2B Code Interpreter sandbox.

Other agents, like onboarding or scheduling agents, are more specialized and have narrower responsibilities.

Tools are grouped by product area—for example, listing vehicles, adding drivers, or retrieving maintenance history—and each validates its inputs with Zod before calling Cobli's business logic.

For more involved requests, like analyzing fleet safety, reviewing maintenance costs, or building HTML dashboards, Cobli gives agents skills loaded from S3. Some skills are shared, others are specific to a customer. Thanks to skills Cobli can add capabilities without redeploying the app.

The team uses workflows for use cases that are more structured, for example bulk imports with specific column mapping or a recommendation pipeline that relies on structured benchmarks with reasoning steps in between.

Each workflow is registered in Mastra and is invokable over HTTP or the Mastra SDK. Workflow snapshots are persisted in PostgreSQL, while Valkey coordinates recovery across service instances, allowing long-running workflows to resume after a restart.

On top of all these Mastra primitives, Cobli uses ClickHouse, Datadog for metrics, and Mastra Studio for observability and debugging.

"Mastra's observability, evals, and scoring help us identify failures, catch regressions and understand how the assistant handles questions. They give us a practical way to improve answer quality across use cases and maintain that quality as we add new capabilities." — Raphael Cunha, Principal Engineer

Cobli also exposes its tools through MCP, allowing clients such as Claude Desktop to access fleet data using a fleet token.

The biggest challenges: auth and tools

The whole system built by Cobli is complex.

Fitting AI into the existing authorization system was one of the biggest challenges. Cobli already had a microservice environment where customer-specific tokens controlled access to data. Adding agents raised a practical question: how could they call those services without risking a data leak?

The team put the AI service behind its existing authorization system and passed customer tokens through request headers. Tools and workflows can then make authenticated calls to the services they need.

Managing the growing number of tools was another challenge. Fleet Manager needed access to more of the product, but exposing all those tools created a context problem. The team didn't want a huge amount of information sent with every request.

Fleet Manager uses a ToolSearchProcessor-based search layer to discover relevant tools on demand, while delegating device scheduling and file generation to specialized subagents. "The discussion was big, but the solution was simple," says Pedro Almeida.

Results and next steps

Cobli has more than 30 agents in production now. They are mostly customer-facing, but they also started building internal agents for different tasks, e.g. analyzing incoming bug reports and routing them to the right team.

The next step is to bring AI to more customers while working through pricing and costs. The assistants still don't cover every feature in Cobli's panel, so the team is continuing to expand what they can do. The goal stays the same: help fleet managers get things done faster.

Start building today

Quickstart