Skip to content

feat: Add TikTok/Douyin platform support (video feed, livestream, e-commerce) #212

@akz142857

Description

@akz142857

Summary

I'd like to propose adding TikTok/Douyin as the third simulation platform in OASIS, alongside Twitter and Reddit. This would make OASIS the first open-source framework capable of simulating TikTok-style algorithmic-feed social commerce at scale.

Motivation

  • TikTok/Douyin is the world's largest short-video platform (7-8B DAU), but no open-source multi-agent simulation framework exists for its ecosystem
  • OASIS's architecture (ActionType enum + Platform getattr dispatch + pluggable recsys) is well-suited for platform extension
  • Demand exists: the OASIS paper mentions scalability across platforms, and multimodal support is an open request ([Feature Request] Multimodal Support to Agent Module #41, [Feature Request]Plan to support multi-modal #47)
  • Use cases: content virality prediction, livestream commerce simulation, recommendation algorithm research

Proposed Changes

1. ActionType Extension (typing.py)

14 new TikTok-specific actions:

  • Feed: UPLOAD_VIDEO, WATCH_VIDEO, SHARE_VIDEO, DUET, STITCH, NOT_INTERESTED
  • Livestream: ENTER_LIVESTREAM, EXIT_LIVESTREAM, LIVESTREAM_COMMENT, SEND_GIFT, START_LIVESTREAM, END_LIVESTREAM
  • E-commerce: VIEW_PRODUCT, ADD_TO_CART
  • Plus get_default_tiktok_actions() reusing 5 existing actions (LIKE_POST, CREATE_COMMENT, FOLLOW, PURCHASE_PRODUCT, SEARCH_POSTS, TREND, DO_NOTHING)

2. Traffic Pool Racing Recommendation (recsys.py)

TikTok's core algorithmic differentiator:

  • 7-level traffic pool with percentile-based promotion/demotion (top 20% promoted, bottom 30% stopped)
  • Scoring: completion_rate (0.35) + like_rate (0.15) + comment_rate (0.15) + share_rate (0.20) - negative_rate (0.15)
  • Feed composition: 70% interest-matched + 15% following + 10% explore
  • 72-hour exponential time decay
  • Per-user interest personalization via topic tag matching
  • All 14 algorithm parameters configurable via kwargs

3. Platform Handlers (platform.py)

14 async methods following the existing (self, agent_id, message) dispatch pattern, with trace recording and DB operations.

4. Conditional DB Schema (schema/)

4 new tables created only when platform == "tiktok":

  • video (traffic pool metadata, completion rates)
  • livestream (room state, viewer counts, GMV)
  • livestream_viewer (session tracking with stay duration)
  • orders (e-commerce conversion tracking)

5. Agent Graph Generator (agents_generator.py)

generate_tiktok_agent_graph() — loads JSON profiles with TikTok-specific fields (role, interested_topics, follower_count, video_count). Appends structured interest tags to bio for recsys personalization.

6. Environment (env.py)

DefaultPlatformType.TIKTOK branch with tiktok_recsys_params passthrough for configurable algorithm tuning.

Implementation Status

I have a working implementation on a fork: akz142857/oasis@feat/tiktok-platform

  • 13 files changed (9 modified + 4 new SQL schemas)
  • ~1,200 lines added, fully additive (no changes to existing Twitter/Reddit behavior)
  • All platform handlers follow existing code conventions

Still needed before PR submission:

  • Unit tests for TikTok actions (following test_user_create_post.py pattern)
  • Update test_action_docstring.py and test_twitter_user_agent_all_actions.py
  • Example script in examples/
  • Documentation in docs/key_modules/actions.mdx

Questions

  1. Does this direction align with OASIS's roadmap? Is the team open to a third platform?
  2. Should TikTok actions be added directly to ActionType or would a separate action enum be preferred?
  3. Any preferences on the recsys approach (new function vs. subclassing)?

Happy to adjust the design based on feedback before submitting the PR.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions