Feed Configs

A feed config bundles one or more algorithms with weights, fallbacks, cache settings, and exclusion rules. It's the bridge between your algorithm code and production serving.


Overview

After you've built and tested an algorithm (using the pipeline in [Search](../Building Algorithms/search) → [Features](../Building Algorithms/algo-features) → [Scoring & Ranking](../Building Algorithms/algo-scoring-ranking)), you save it as a feed algorithm. Then you create a feed config that defines:

  • Which algorithms run and how their results are interleaved
  • What happens when an algorithm fails (fallback chain)
  • How long results are cached
  • How many items per page
  • Which items to exclude

You create feed configs in the Console or via the API. The output is a config_id you pass to the Serve endpoint.

Algo A ──┐
         ├── Feed Config (config_id: 104) ──→ POST /deploy/serve
Algo B ──┘

Multi-Algorithm Interleaving

When your config has multiple algorithms, results are interleaved by weight:

{
  "main_algos": [
    { "algo_id": 42, "weight": 0.6 },
    { "algo_id": 43, "weight": 0.4 }
  ]
}

Items from each algorithm are merged in order, maintaining each algorithm's internal ranking while respecting the weight ratio. [0.6, 0.4] means 60% of items come from the first algorithm and 40% from the second.

Common Patterns

PatternAlgo AAlgo BWhy
Trending + personalGlobal trending (60%)User-personalized (40%)Mix discovery with relevance
Cross-indexFarcaster posts (70%)Zora coins (30%)Multi-content-type feed
Safe A/B testProven algo (80%)Experimental algo (20%)Test new logic with low risk

Fallback Chain

If an algorithm fails or times out, fallbacks keep the feed alive:

{
  "main_algos": [
    { "algo_id": 42, "weight": 0.6 },
    { "algo_id": 43, "weight": 0.4 }
  ],
  "primary_fallback": 42,
  "secondary_fallback": 44
}
main_algos (42 + 43 interleaved)
        │ fails or times out
        ▼
primary_fallback (algo 42 alone)
        │ fails
        ▼
secondary_fallback (algo 44)

Each level has its own cache TTL.


Cache Settings

Algorithm results are cached to reduce latency and compute costs:

{
  "main_algos": [
    { "algo_id": 42, "weight": 0.6 },
    { "algo_id": 43, "weight": 0.4 }
  ],
  "main_max_cache_age_s": 3600,
  "primary_fallback": 42,
  "primary_fallback_max_cache_age_s": 7200,
  "secondary_fallback": 44,
  "secondary_fallback_max_cache_age_s": 600,
  "building_timeout_ms": 300
}
ParameterDefaultDescription
main_max_cache_age_s7200Cache TTL for main results (seconds)
primary_fallback_max_cache_age_s7200Cache TTL for primary fallback
secondary_fallback_max_cache_age_s600Cache TTL for secondary fallback
building_timeout_ms150Max ms to wait for a fresh build before serving cached results

Recommended TTLs

Use casemain_max_cache_age_s
Fast-moving markets (crypto, sports)300–600 (5–10 min)
Social feeds (Farcaster, Zora)1800–3600 (30–60 min)
Discovery / explore feeds7200 (2 hours, the default)
Editorial / curated content14400+ (4+ hours)

When you update an algorithm, cached results continue serving until the TTL expires. Use the cache clear endpoint to force a refresh.

Cold Starts

If building takes longer than building_timeout_ms, the API returns an empty feed rather than blocking. This typically happens on first serve for a new user. See Handling cold starts for retry patterns.


Page Size

Controls items per page when serving:

{
  "main_algos": [{ "algo_id": 42, "weight": 1.0 }],
  "page_size": 25
}

The initial /deploy/serve call returns page 1. Fetch more via /deploy/serve/page. See Serving for the full pagination flow.


Exclusion Rules

Remove items matching specific criteria at serve time, without modifying algorithm code:

{
  "main_algos": [{ "algo_id": 42, "weight": 1.0 }],
  "page_size": 25,
  "exclusion_rules": []
}

Exclusion rules are evaluated after algorithms run and before items are paginated. Multiple rules use OR logic — an item is excluded if it matches any rule.

Where to Filter

ApproachWhereWhen to use
Search filters (include/exclude)Algorithm codeHard requirements — items that should never be candidates
Ranking diversity (limitByField)Algorithm codeVariety in ranked output
Exclusion rulesFeed configBusiness rules you want to change without redeploying algorithms

Creating a Feed Config

Via the Console

  1. Go to the Console
  2. Navigate to the Feed Config section
  3. Select your algorithms and set weights
  4. Configure fallbacks, cache TTLs, and page size
  5. Save — note your config_id

Via the API

const response = await fetch('https://api.mbd.xyz/v3/studio/deploy/configs', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer mbd-YOUR_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Polymarket Trending + Personal',
    description: 'Blends trending markets with user-personalized picks',
    is_public: false,
    feed_config: {
      main_algos: [
        { algo_id: 42, weight: 0.6 },
        { algo_id: 43, weight: 0.4 }
      ],
      primary_fallback: 42,
      secondary_fallback: 44,
      building_timeout_ms: 300,
      main_max_cache_age_s: 3600,
      page_size: 25,
      exclusion_rules: []
    }
  })
})

const { config_id } = await response.json()

Previewing Before Saving

Test config changes without creating a permanent record:

const preview = await fetch('https://api.mbd.xyz/v3/studio/deploy/preview', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer mbd-YOUR_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    config: {
      main_algos: [
        { algo_id: 42, weight: 0.7 },
        { algo_id: 43, weight: 0.3 }
      ],
      page_size: 25,
      building_timeout_ms: 300
    },
    inputs: { farcasterFid: '16085' }
  })
})

The preview response is identical to a serve response — you get a served_id and can paginate.


Managing Configs

ActionMethodEndpoint
List all configsGET/v3/studio/deploy/configs
Get a configGET/v3/studio/deploy/configs/{id}
Update a configPUT/v3/studio/deploy/configs/{id}
Delete a configDELETE/v3/studio/deploy/configs/{id}

Updating a config does not clear cached results. Clear the cache to see changes immediately.


What's Next


What’s Next

Learn how to serve feeds in production