Skip to main content
This is Part 1 of the Build an End-to-End RAG Pipeline series: the ingestion side of RAG. The publisher and content you set up here are the same ones you’ll manage in Part 2 and harden in Part 3. The retrieval side (semantic search and grounded answers) is covered in the Building Custom Search tutorial and the Grounded Completions guide. In this part you’ll create a publisher, upload content with descriptive metadata, and verify that it’s fully indexed and ready for retrieval.

The Full Journey

A production RAG application connects several Gloo AI features into one path. The diagram below shows it end to end: you set up your content and keep adding to it, Gloo answers questions against it, and you keep it current over time. Each stage maps to a step in this series or a focused tutorial. The end-to-end Gloo journey in three phases. Set up your content: 1 create a publisher in Studio, 2 ingest content into the Data Engine, 3 attach metadata. Answer questions (at request time): 4 semantic search finds matching snippets, 5 grounded completions answer from your content, 6 your app displays the sources. Keep it current (ongoing): 7 update or delete items, 8 monitor status and debug errors. Purple stages are handled by you and your app; green stages are handled by Gloo. The end-to-end Gloo journey in three phases. Set up your content: 1 create a publisher in Studio, 2 ingest content into the Data Engine, 3 attach metadata. Answer questions (at request time): 4 semantic search finds matching snippets, 5 grounded completions answer from your content, 6 your app displays the sources. Keep it current (ongoing): 7 update or delete items, 8 monitor status and debug errors. Purple stages are handled by you and your app; green stages are handled by Gloo. This series covers stages 1-3 and 7-8 in depth. Stages 4-6, the retrieval side, are covered in the tutorial and guide linked above.

Pipeline at a Glance

1

Publisher setup (Studio)

Create the publisher that owns your content: covered below.
2

Ingest content with metadata

Upload files and enrich them: covered below, with a deep dive in Upload Files to Data Engine.
3

Verify indexing

Poll item status until your content is searchable: covered below.
4

Semantic search

Query your content. Deep dive: Building Custom Search.
5

Grounded completions with sources

Answer questions from your content with citations. Deep dive: Grounded Completions, which sets rag_publisher to your publisher name.
6

Content lifecycle

Update, bulk-edit, and delete content: Part 2.
7

Verification, errors & resilience

Error handling and retry patterns: Part 3.

Prerequisites

Before starting, you need:
  • A Gloo AI Studio account
  • API key - Set the GLOO_API_KEY environment variable to your key from the API Keys page. Keep it on your server and out of source control; see API Key Security
All API calls in this series authenticate with an API key. The snippets below read GLOO_API_KEY and set API_KEY so the same variable works in Part 2 and Part 3.
This series requires Data Engine access. Data Engine is currently at capacity for new organizations: existing Pro and Enterprise organizations already have access. New organizations can request access and the team will follow up, or review Billing & Plans. Without access you cannot complete the steps below.

Step 1: Create Your Publisher

Content in the Data Engine belongs to a publisher. Create one in Gloo AI Studio:
  1. In Gloo AI Studio, click your user account in the bottom-left corner and select Manage Organizations
  2. Select the organization you want to add the publisher to, then click View Publishers
  3. Click Create Publisher and give the new publisher a name
  4. Note two values for this publisher. Each parameter in this series takes a different one:
    • Publisher ID (a UUID): the ingestion endpoints take it as the publisher_id field
    • Publisher name: the grounded endpoints take it as the rag_publisher parameter
See Manage Publishers for the full Studio walkthrough.
Keep both values handy. The Grounded Completions guide documents rag_publisher as your publisher name, which you can read from the same Publishers page.
Use one dedicated publisher for this series. Parts 2 and 3 operate on the content you upload here; a dedicated publisher keeps them separate from your production content.

Step 2: Upload Content with a Producer ID

Upload a file to POST /ingestion/v2/files. The producer_id query parameter attaches your own stable identifier to the item. This is what makes the pipeline manageable later: re-running the upload detects a duplicate instead of creating a copy, and in Part 2 you’ll update, bulk-edit, and delete these same items. This series uses a short Markdown article as its sample content: grab building-stronger-communities.md from the cookbook repository and save it next to your script. (Any Markdown, text, PDF, or Word file of your own works too. Just adjust the filename.) Then upload it:
Content not on local disk? See Preparing Content for Ingestion for the source-agnostic pattern: pulling from a CMS, API, database, file library, or feed, and how to structure content before it reaches this upload step.

What You’ll See

Keep this item ID: the next two steps use it, and Parts 2 and 3 operate on this same item.
For multi-file uploads, batch processing, and supported file types, see the Upload Files to Data Engine deep dive.

Step 3: Enrich with Metadata

Attach descriptive metadata with PATCH /engine/v2/item. Titles and authors appear in search results and source citations, and tags let you organize and bulk-manage content in Part 2.
Metadata can be set as soon as the item ID exists. You don’t need to wait for ingestion to finish. You can also target a single item by producer_id instead of item_id.

Step 4: Verify Indexing

Ingestion is asynchronous: the upload response means your file is queued, not searchable. Poll GET /engine/v2/items/{item_id} until status reaches COMPLETED, typically a few minutes for a small file. While processing you’ll see intermediate states such as CHUNKING (see How Chunking Works for what happens during this stage).

What You’ll See

For a fresh upload (about 6 minutes for the sample file):
If you re-run against already-indexed content, the first poll returns COMPLETED immediately. The response also returns the title, author, and tags from Step 3: proof they’re attached to the indexed item.

Run the Complete Example

The cookbook contains the full pipeline (upload, metadata, and polling with error handling) as one runnable program in all six languages. From the cookbook repository, install dependencies, copy .env.example to .env and add your credentials, then run it:
You’ll see:

Working Code Sample

View Complete Code

Clone or browse the complete working examples for all 6 languages (JavaScript, TypeScript, Python, PHP, Go, Java) with setup instructions and the sample content file.
The code snippets above are simplified and self-contained, designed for readability and easy copy-paste. The cookbook examples add duplicate handling and structured error handling. Both implement the same APIs and patterns.

Troubleshooting

Error: 401 Unauthorized

Your API key is missing or invalid. Verify the GLOO_API_KEY environment variable is set correctly. See the Authentication Tutorial.

Error: 400 publisher_not_found

The publisher_id doesn’t exist or isn’t accessible with your credentials. Copy the Publisher ID (a UUID) from Studio > Data Engine > Publishers.

Error: 400 too_many_files

producer_id applies to a single file. When uploading multiple files in one request, omit it.

Polling times out

Larger files take longer to process. Increase the timeout, or check Studio > Ingestion Analytics to see whether the publisher is still processing.

Next Steps

Your pipeline now has indexed, metadata-rich content. Wire it into retrieval:
  1. Building Custom Search: query this content semantically with the Search API
  2. Grounded Completions: answer questions from this content with source citations (set rag_publisher to your publisher name, not the Publisher ID)
  3. Part 2: Content Lifecycle: update, bulk-edit, and delete the items you created here
  4. Part 3: Verification, Error Handling & Resilience: production-grade retry and verification patterns
To learn the concepts behind this part, read Building a Knowledge Base in the Learning Center: knowledge sources, chunking and metadata.