IANews
GuidesArticles

Generation modes

Gateway vs Agent mode — understand the two generation approaches, their trade-offs, and when to use each.

Generation modes

IANews provides two distinct article generation modes -- Gateway and Agent. Gateway mode is optimized for speed, producing drafts in about 30 seconds from cached sources. Agent mode runs the full discovery-to-generation process in approximately 75 seconds, delivering publication-ready articles with rich citations. This guide explains how each mode works, their parameters, and when to choose one over the other.

Comparison at a glance

FeatureGatewayAgent
Speed~30 seconds~75 seconds
Sources usedCached content index onlyFresh discovery (multiple providers)
Process stagesSearch → GenerationDiscovery → Content extraction → Indexing → Search → Generation
Citations2--4 inline references8--15 inline references
Reliability scoresBased on existing indexFreshly computed per source
Article depthGood for updates and known topicsBest for new topics and in-depth coverage
Use caseQuick iterations, topic refreshesFirst-time coverage, trending topics
Real-time eventscontent, sources, doneprogress, sources, content, citations, done
Plan quota cost1 article credit1 article credit

How Gateway mode works

Gateway mode bypasses the discovery and content extraction phases entirely. It queries the existing content index for relevant passages, then sends them to the AI for generation.

Submit your request

Send a POST request to the generation endpoint with mode set to "gateway". IANews authenticates your request, checks your plan quota, and searches the existing content index for relevant passages.

curl -N -X POST https://api.earlyforge.ai/api/articles/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "topic": "AI regulation in Europe",
    "mode": "gateway",
    "tone": "journalistic",
    "length": "medium",
    "language": "en"
  }'

IANews performs an intelligent search against the existing content index, combining multiple retrieval techniques to find the most relevant passages. Results are ranked by relevance and the top passages are selected. No new content is fetched from the web.

Streaming generation

The AI generates the article paragraph by paragraph, streaming each chunk back to the client in real time. The full cycle typically completes in about 30 seconds.

Gateway mode relies on sources that were previously discovered and indexed. If you have never generated an Agent-mode article on the same topic, the content index may have limited relevant material. In that case, use Agent mode first to populate the index.

How Agent mode works

Agent mode runs the complete two-phase process: discovery followed by on-demand generation. This produces the most comprehensive, well-sourced articles.

Submit your request

Use mode: "agent" in your request body. The endpoint returns an article_id immediately, then begins processing the full generation asynchronously.

Discovery phase

IANews queries multiple search providers and data sources. The best sources are selected based on keyword matching, topic category, geographic region, and query intent (factual, analytical, opinion, or real-time).

Content extraction and indexing

IANews extracts full article text from the discovered sources using multiple extraction strategies for maximum coverage. Extracted content is then indexed and made available for intelligent search.

Search and generation

IANews performs an intelligent search over the freshly indexed content to find the most relevant passages. The AI generates the article with inline [N] citations, streaming results back in real time. A reliability score is computed for each cited source.

Real-time streaming events

Both modes stream results in real time. Connect to the stream endpoint to receive live updates as the generation progresses.

const eventSource = new EventSource(`/articles/${articleId}/stream`);
 
eventSource.addEventListener("progress", (e) => {
  // Generation phase: "discovering", "extracting", "indexing", "generating"
  const { stage, message } = JSON.parse(e.data);
});
 
eventSource.addEventListener("sources", (e) => {
  // Discovered sources with metadata, sent before content generation begins
  const { sources } = JSON.parse(e.data);
});
 
eventSource.addEventListener("content", (e) => {
  // Article text chunks — append each to the editor
  const { text } = JSON.parse(e.data);
});
 
eventSource.addEventListener("citations", (e) => {
  // Citation metadata for inline [N] references
  const { citations } = JSON.parse(e.data);
});
 
eventSource.addEventListener("done", (e) => {
  // Generation complete — close the connection
  const { article_id, word_count } = JSON.parse(e.data);
  eventSource.close();
});
EventPayloadWhen it fires
progress{ stage: string, message: string }Each generation phase transition (Agent mode only)
sources{ sources: Source[] }After discovery completes, before generation starts
content{ text: string }Each generated paragraph or text chunk
citations{ citations: Citation[] }After all content is generated, with reliability scores
done{ article_id: string, word_count: number }Generation is complete

Generation parameters

Both modes accept the same request body fields:

ParameterTypeRequiredDefaultDescription
topicstringYes--The subject of the article. Be specific for better results.
modestringYes--"gateway" or "agent".
tonestringNo"neutral"One of neutral, analytical, casual, formal, journalistic.
lengthstringNo"medium"short (~500 words), medium (~1,000 words), long (~2,000 words).
languagestringNo"en"Output language code (e.g., en, fr, es, de, ja). Supports 28 languages.
brief_idstringNo--Link generation to a specific brief for source and style inheritance.

Choosing the right mode

Use Gateway when:

  • You need a quick first draft in under 30 seconds
  • The topic has been covered before and the content index contains relevant material
  • You are iterating on tone, structure, or length and need fast feedback loops
  • You plan to edit the article heavily in the AI editor afterward

Use Agent when:

  • You are covering a topic for the first time and need fresh source discovery
  • The topic is trending and benefits from the very latest sources
  • You need publication-quality articles with 8--15 inline citations
  • Source depth and reliability scoring matter more than generation speed

A practical workflow: use Agent mode the first time you cover a topic. This populates the content index with high-quality sources. For follow-up articles on the same topic, switch to Gateway mode for faster turnaround -- it will draw from the sources Agent mode already indexed.

What's next?