massgen 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of massgen might be problematic. Click here for more details.

Files changed (90) hide show
  1. massgen/__init__.py +1 -1
  2. massgen/api_params_handler/_chat_completions_api_params_handler.py +4 -0
  3. massgen/api_params_handler/_claude_api_params_handler.py +4 -0
  4. massgen/api_params_handler/_gemini_api_params_handler.py +4 -0
  5. massgen/api_params_handler/_response_api_params_handler.py +4 -0
  6. massgen/backend/base_with_custom_tool_and_mcp.py +25 -5
  7. massgen/backend/docs/permissions_and_context_files.md +2 -2
  8. massgen/backend/response.py +2 -0
  9. massgen/chat_agent.py +340 -20
  10. massgen/cli.py +326 -19
  11. massgen/configs/README.md +92 -41
  12. massgen/configs/memory/gpt5mini_gemini_baseline_research_to_implementation.yaml +94 -0
  13. massgen/configs/memory/gpt5mini_gemini_context_window_management.yaml +187 -0
  14. massgen/configs/memory/gpt5mini_gemini_research_to_implementation.yaml +127 -0
  15. massgen/configs/memory/gpt5mini_high_reasoning_gemini.yaml +107 -0
  16. massgen/configs/memory/single_agent_compression_test.yaml +64 -0
  17. massgen/configs/tools/custom_tools/crawl4ai_example.yaml +55 -0
  18. massgen/configs/tools/custom_tools/multimodal_tools/text_to_file_generation_multi.yaml +61 -0
  19. massgen/configs/tools/custom_tools/multimodal_tools/text_to_file_generation_single.yaml +29 -0
  20. massgen/configs/tools/custom_tools/multimodal_tools/text_to_image_generation_multi.yaml +51 -0
  21. massgen/configs/tools/custom_tools/multimodal_tools/text_to_image_generation_single.yaml +33 -0
  22. massgen/configs/tools/custom_tools/multimodal_tools/text_to_speech_generation_multi.yaml +55 -0
  23. massgen/configs/tools/custom_tools/multimodal_tools/text_to_speech_generation_single.yaml +33 -0
  24. massgen/configs/tools/custom_tools/multimodal_tools/text_to_video_generation_multi.yaml +47 -0
  25. massgen/configs/tools/custom_tools/multimodal_tools/text_to_video_generation_single.yaml +29 -0
  26. massgen/configs/tools/custom_tools/multimodal_tools/understand_audio.yaml +1 -1
  27. massgen/configs/tools/custom_tools/multimodal_tools/understand_file.yaml +1 -1
  28. massgen/configs/tools/custom_tools/multimodal_tools/understand_image.yaml +1 -1
  29. massgen/configs/tools/custom_tools/multimodal_tools/understand_video.yaml +1 -1
  30. massgen/configs/tools/custom_tools/multimodal_tools/youtube_video_analysis.yaml +1 -1
  31. massgen/filesystem_manager/_filesystem_manager.py +1 -0
  32. massgen/filesystem_manager/_path_permission_manager.py +148 -0
  33. massgen/memory/README.md +277 -0
  34. massgen/memory/__init__.py +26 -0
  35. massgen/memory/_base.py +193 -0
  36. massgen/memory/_compression.py +237 -0
  37. massgen/memory/_context_monitor.py +211 -0
  38. massgen/memory/_conversation.py +255 -0
  39. massgen/memory/_fact_extraction_prompts.py +333 -0
  40. massgen/memory/_mem0_adapters.py +257 -0
  41. massgen/memory/_persistent.py +687 -0
  42. massgen/memory/docker-compose.qdrant.yml +36 -0
  43. massgen/memory/docs/DESIGN.md +388 -0
  44. massgen/memory/docs/QUICKSTART.md +409 -0
  45. massgen/memory/docs/SUMMARY.md +319 -0
  46. massgen/memory/docs/agent_use_memory.md +408 -0
  47. massgen/memory/docs/orchestrator_use_memory.md +586 -0
  48. massgen/memory/examples.py +237 -0
  49. massgen/message_templates.py +160 -12
  50. massgen/orchestrator.py +223 -7
  51. massgen/tests/memory/test_agent_compression.py +174 -0
  52. massgen/{configs/tools → tests}/memory/test_context_window_management.py +30 -30
  53. massgen/tests/memory/test_force_compression.py +154 -0
  54. massgen/tests/memory/test_simple_compression.py +147 -0
  55. massgen/tests/test_agent_memory.py +534 -0
  56. massgen/tests/test_binary_file_blocking.py +274 -0
  57. massgen/tests/test_case_studies.md +12 -12
  58. massgen/tests/test_conversation_memory.py +382 -0
  59. massgen/tests/test_multimodal_size_limits.py +407 -0
  60. massgen/tests/test_orchestrator_memory.py +620 -0
  61. massgen/tests/test_persistent_memory.py +435 -0
  62. massgen/token_manager/token_manager.py +6 -0
  63. massgen/tool/_manager.py +7 -2
  64. massgen/tool/_multimodal_tools/image_to_image_generation.py +293 -0
  65. massgen/tool/_multimodal_tools/text_to_file_generation.py +455 -0
  66. massgen/tool/_multimodal_tools/text_to_image_generation.py +222 -0
  67. massgen/tool/_multimodal_tools/text_to_speech_continue_generation.py +226 -0
  68. massgen/tool/_multimodal_tools/text_to_speech_transcription_generation.py +217 -0
  69. massgen/tool/_multimodal_tools/text_to_video_generation.py +223 -0
  70. massgen/tool/_multimodal_tools/understand_audio.py +19 -1
  71. massgen/tool/_multimodal_tools/understand_file.py +6 -1
  72. massgen/tool/_multimodal_tools/understand_image.py +112 -8
  73. massgen/tool/_multimodal_tools/understand_video.py +32 -5
  74. massgen/tool/_web_tools/crawl4ai_tool.py +718 -0
  75. massgen/tool/docs/multimodal_tools.md +589 -0
  76. massgen/tools/__init__.py +8 -0
  77. massgen/tools/_planning_mcp_server.py +520 -0
  78. massgen/tools/planning_dataclasses.py +434 -0
  79. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/METADATA +142 -82
  80. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/RECORD +84 -41
  81. massgen/configs/tools/custom_tools/crawl4ai_mcp_example.yaml +0 -67
  82. massgen/configs/tools/custom_tools/crawl4ai_multi_agent_example.yaml +0 -68
  83. massgen/configs/tools/memory/README.md +0 -199
  84. massgen/configs/tools/memory/gpt5mini_gemini_context_window_management.yaml +0 -131
  85. massgen/configs/tools/memory/gpt5mini_gemini_no_persistent_memory.yaml +0 -133
  86. massgen/configs/tools/multimodal/gpt5mini_gpt5nano_documentation_evolution.yaml +0 -97
  87. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/WHEEL +0 -0
  88. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/entry_points.txt +0 -0
  89. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/licenses/LICENSE +0 -0
  90. {massgen-0.1.3.dist-info → massgen-0.1.5.dist-info}/top_level.txt +0 -0
@@ -1,131 +0,0 @@
1
- # Example Configuration: Context Window Management with Memory
2
- #
3
- # Use Case: Demonstrates automatic context compression when approaching token limits
4
- #
5
- # This configuration demonstrates:
6
- # - Automatic context window monitoring and compression
7
- # - Token-aware conversation management (75% threshold, 40% target)
8
- # - Persistent memory integration for long-term knowledge retention
9
- # - Graceful handling when context window fills up
10
- # - Multi-agent collaboration with shared context management
11
- #
12
- # Run with:
13
- # massgen \
14
- # --config massgen/configs/tools/memory/gpt5mini_gemini_context_window_management.yaml \
15
- # "Tell me a detailed story about a space explorer. After each paragraph, ask me what happens next, and I'll guide the story. Keep expanding the narrative with rich details about planets, aliens, technology, and adventures. Make each response at least 500 words."
16
-
17
- # ====================
18
- # AGENT DEFINITIONS
19
- # ====================
20
- agents:
21
- - id: "agent_a"
22
- backend:
23
- # Use GPT-5-mini with medium reasoning
24
- type: "openai"
25
- model: "gpt-5-mini"
26
- text:
27
- verbosity: "medium"
28
- reasoning:
29
- effort: "medium"
30
- summary: "auto"
31
-
32
- - id: "agent_b"
33
- backend:
34
- # Use Gemini 2.5 Flash for cost-effective testing
35
- type: "gemini"
36
- model: "gemini-2.5-flash"
37
-
38
- # ====================
39
- # MEMORY CONFIGURATION
40
- # ====================
41
- memory:
42
- # Enable/disable persistent memory (default: true)
43
- enabled: true
44
-
45
- # Memory configuration
46
- conversation_memory:
47
- enabled: true # Short-term conversation tracking (recommended: always true)
48
-
49
- persistent_memory:
50
- enabled: true # Long-term knowledge storage (set to false to disable)
51
- on_disk: true # Persist across restarts
52
- # session_name: "test_session" # Optional - if not specified, auto-generates unique ID
53
- # Format: agent_storyteller_20251023_143022_a1b2c3
54
- # Specify to continue a specific session
55
-
56
- # Vector store backend (default: qdrant)
57
- vector_store: "qdrant"
58
-
59
- # Context window management thresholds
60
- compression:
61
- trigger_threshold: 0.75 # Compress when context usage exceeds 75%
62
- target_ratio: 0.40 # Target 40% of context after compression
63
-
64
- # Memory system behavior when enabled:
65
- # - ConversationMemory: Tracks short-term conversation history
66
- # - PersistentMemory: Stores long-term knowledge in vector database
67
- # - Automatic compression: Triggers at 75% of context window
68
- # - Token budget: Keeps 40% after compression
69
- # - Persistence: Saves to disk and survives restarts
70
- #
71
- # Session management:
72
- # - Each agent gets its own memory (separate by agent_name)
73
- # - New sessions start fresh (session_name auto-generated if not specified)
74
- # - To continue a previous session, specify the session_name
75
- #
76
- # To disable persistent memory for testing, set:
77
- # memory.persistent_memory.enabled: false
78
- #
79
- # See massgen/memory/docs/ for detailed documentation.
80
-
81
- # ====================
82
- # ORCHESTRATOR CONFIGURATION
83
- # ====================
84
- orchestrator:
85
- # Multi-turn mode to enable interactive storytelling
86
- session_storage: "memory_test_sessions"
87
-
88
- # Agent workspace for any file operations
89
- agent_temporary_workspace: "memory_test_workspaces"
90
- snapshot_storage: "memory_test_snapshots"
91
-
92
- # ====================
93
- # UI CONFIGURATION
94
- # ====================
95
- ui:
96
- display_type: "rich_terminal"
97
- logging_enabled: true
98
-
99
- # ====================
100
- # EXECUTION FLOW
101
- # ====================
102
- # What happens:
103
- # 1. User starts an interactive story with the agent
104
- # 2. Agent responds with detailed narrative (400-600 words per turn)
105
- # 3. As conversation continues, token usage is monitored automatically
106
- # 4. When context usage reaches 75% of model's limit:
107
- # - System logs: "📊 Context usage: X / Y tokens (Z%) - compressing old context"
108
- # - Old messages are compressed into persistent memory (if configured)
109
- # - Recent messages (fitting in 40% of context window) are kept
110
- # - Compression details logged: "📦 Compressed N messages (X tokens) into long-term memory"
111
- # 5. Agent continues seamlessly with compressed context
112
- # 6. Story maintains consistency by referencing persistent memories
113
- # 7. Process repeats as needed for very long conversations
114
- #
115
- # Expected output with persistent memory:
116
- # 📊 Context usage: 96,000 / 128,000 tokens (75.0%) - compressing old context
117
- # 📦 Compressed 15 messages (60,000 tokens) into long-term memory
118
- # Kept 8 messages (36,000 tokens) in context
119
- #
120
- # Expected output WITHOUT persistent memory:
121
- # 📊 Context usage: 96,000 / 128,000 tokens (75.0%) - compressing old context
122
- # ⚠️ Warning: Dropping 15 messages (60,000 tokens)
123
- # No persistent memory configured to retain this information
124
- # Consider adding persistent_memory to avoid losing context
125
- #
126
- # Token Budget Allocation (after compression):
127
- # - Conversation history: 40% (kept in active context)
128
- # - New user messages: 20%
129
- # - Retrieved memories: 10%
130
- # - System prompt overhead: 10%
131
- # - Response generation: 20%
@@ -1,133 +0,0 @@
1
- # Example Configuration: Context Window Management WITHOUT Persistent Memory
2
- #
3
- # Use Case: Demonstrates context compression warnings when no persistent memory
4
- #
5
- # This configuration demonstrates what happens when:
6
- # - Conversation memory is enabled (tracks short-term history)
7
- # - Persistent memory is DISABLED (no long-term storage)
8
- # - Context window fills up (triggering compression warnings)
9
- #
10
- # Run with:
11
- # python massgen/configs/tools/memory/test_context_window_management.py \
12
- # --config massgen/configs/tools/memory/gpt5mini_gemini_no_persistent_memory.yaml
13
-
14
- # ====================
15
- # AGENT DEFINITIONS
16
- # ====================
17
- agents:
18
- - id: "agent_a"
19
- system_message: |
20
- You are a creative storyteller who crafts detailed, immersive narratives.
21
-
22
- When telling stories:
23
- - Create rich, detailed descriptions of settings, characters, and events
24
- - Build on previous plot points and maintain narrative consistency
25
- - Ask engaging questions to guide the story forward
26
- - Make each response substantial and immersive (aim for 400-600 words)
27
- - Reference earlier story elements to create callbacks and continuity
28
-
29
- Your goal is to create a long, engaging narrative that will naturally fill up
30
- the context window over multiple turns, demonstrating how the system manages
31
- conversation history automatically.
32
-
33
- backend:
34
- # Use GPT-5-mini with medium reasoning
35
- type: "openai"
36
- model: "gpt-5-mini"
37
-
38
- # LLM parameters
39
- temperature: 0.8
40
- max_tokens: 2000
41
-
42
- text:
43
- verbosity: "medium"
44
-
45
- reasoning:
46
- effort: "medium"
47
- summary: "auto"
48
-
49
- - id: "agent_b"
50
- system_message: |
51
- You are a creative storyteller who crafts detailed, immersive narratives.
52
-
53
- When telling stories:
54
- - Create rich, detailed descriptions of settings, characters, and events
55
- - Build on previous plot points and maintain narrative consistency
56
- - Ask engaging questions to guide the story forward
57
- - Make each response substantial and immersive (aim for 400-600 words)
58
- - Reference earlier story elements to create callbacks and continuity
59
-
60
- Your goal is to create a long, engaging narrative that will naturally fill up
61
- the context window over multiple turns, demonstrating how the system manages
62
- conversation history automatically.
63
-
64
- backend:
65
- # Use Gemini 2.5 Flash
66
- type: "gemini"
67
- model: "gemini-2.5-flash"
68
-
69
- # LLM parameters
70
- temperature: 0.8
71
- max_tokens: 2000
72
-
73
- # ====================
74
- # MEMORY CONFIGURATION
75
- # ====================
76
- memory:
77
- # Memory is enabled
78
- enabled: true
79
-
80
- # Conversation memory tracks short-term history
81
- conversation_memory:
82
- enabled: true
83
-
84
- # Persistent memory is DISABLED - this will trigger warnings
85
- persistent_memory:
86
- enabled: false # ⚠️ Set to false to see warning behavior
87
-
88
- # Context window management still works
89
- compression:
90
- trigger_threshold: 0.75 # Compress when context usage exceeds 75%
91
- target_ratio: 0.40 # Target 40% of context after compression
92
-
93
- # Expected behavior when context fills:
94
- # ⚠️ Warning: Dropping N messages (X tokens)
95
- # No persistent memory configured to retain this information
96
- # Consider adding persistent_memory to avoid losing context
97
- #
98
- # The system will still compress context, but information is lost
99
- # rather than stored in long-term memory.
100
-
101
- # ====================
102
- # ORCHESTRATOR CONFIGURATION
103
- # ====================
104
- orchestrator:
105
- # Multi-turn mode
106
- session_storage: "massgen_logs/memory_test_sessions"
107
-
108
- # Agent workspaces
109
- agent_temporary_workspace: "massgen_logs/memory_test_workspaces"
110
- snapshot_storage: "massgen_logs/memory_test_snapshots"
111
-
112
- # ====================
113
- # UI CONFIGURATION
114
- # ====================
115
- ui:
116
- display_type: "rich_terminal"
117
- logging_enabled: true
118
-
119
- # ====================
120
- # EXECUTION FLOW
121
- # ====================
122
- # What happens:
123
- # 1. Conversation proceeds normally with short-term memory
124
- # 2. When context reaches 75% capacity:
125
- # - System logs: "📊 Context usage: X / Y tokens (Z%) - compressing old context"
126
- # - Warning shown: "⚠️ Warning: Dropping N messages"
127
- # - Warning shown: "No persistent memory configured"
128
- # 3. Old messages are dropped (not saved anywhere)
129
- # 4. Agent continues with reduced context
130
- # 5. Information from dropped messages is permanently lost
131
- #
132
- # Compare this to the config with persistent memory enabled to see
133
- # the difference between graceful compression and data loss.
@@ -1,97 +0,0 @@
1
- # Example Configuration: Multimodal Self-Evolution Analysis
2
- #
3
- # Use Case: MassGen agents analyze their own documentation videos to extract insights
4
- #
5
- # This configuration demonstrates MassGen's self-evolution capabilities through multimodal
6
- # understanding. Agents use understand_video and understand_image tools to analyze case study
7
- # videos, extract technical insights, and provide recommendations for documentation improvements.
8
- #
9
- # Run with:
10
- # uv run python -m massgen.cli --config massgen/configs/tools/multimodal/gpt5mini_gpt5nano_documentation_evolution.yaml "Analyze the MassGen case study video and extract key technical insights about the multi-agent collaboration capabilities demonstrated."
11
-
12
- agents:
13
- - id: "agent_a"
14
- backend:
15
- type: "openai"
16
- model: "gpt-5-mini"
17
- text:
18
- verbosity: "medium"
19
- reasoning:
20
- effort: "medium"
21
- summary: "auto"
22
- enable_web_search: true
23
- custom_tools:
24
- - name: ["understand_video"]
25
- category: "multimodal"
26
- path: "massgen/tool/_multimodal_tools/understand_video.py"
27
- function: ["understand_video"]
28
- - name: ["understand_image"]
29
- category: "multimodal"
30
- path: "massgen/tool/_multimodal_tools/understand_image.py"
31
- function: ["understand_image"]
32
- system_message: |
33
- You are an AI assistant analyzing MassGen's documentation and case studies to provide
34
- insights for self-evolution and improvement.
35
-
36
- You have access to multimodal understanding tools:
37
- - understand_video: Analyzes video content by extracting key frames
38
- - understand_image: Analyzes image content in detail
39
-
40
- Your goal is to extract technical insights, identify documentation quality patterns,
41
- and provide actionable recommendations for improvement. Focus on understanding
42
- how MassGen presents itself to users and how the documentation could better
43
- demonstrate self-evolution capabilities.
44
-
45
- - id: "agent_b"
46
- backend:
47
- type: "openai"
48
- model: "gpt-5-nano"
49
- text:
50
- verbosity: "medium"
51
- reasoning:
52
- effort: "medium"
53
- summary: "auto"
54
- enable_web_search: true
55
- custom_tools:
56
- - name: ["understand_video"]
57
- category: "multimodal"
58
- path: "massgen/tool/_multimodal_tools/understand_video.py"
59
- function: ["understand_video"]
60
- - name: ["understand_image"]
61
- category: "multimodal"
62
- path: "massgen/tool/_multimodal_tools/understand_image.py"
63
- function: ["understand_image"]
64
- system_message: |
65
- You are an AI assistant analyzing MassGen's documentation and case studies to provide
66
- insights for self-evolution and improvement.
67
-
68
- You have access to multimodal understanding tools:
69
- - understand_video: Analyzes video content by extracting key frames
70
- - understand_image: Analyzes image content in detail
71
-
72
- Your goal is to extract technical insights, identify documentation quality patterns,
73
- and provide actionable recommendations for improvement. Focus on understanding
74
- how MassGen presents itself to users and how the documentation could better
75
- demonstrate self-evolution capabilities.
76
-
77
- # Orchestrator-level configuration
78
- orchestrator:
79
- snapshot_storage: "snapshots"
80
- agent_temporary_workspace: "agent_temp"
81
-
82
- # Context paths at orchestrator level (for read-only source files)
83
- filesystem:
84
- context_paths:
85
- - path: "massgen/configs/resources/v0.1.3-example"
86
- permission: "read"
87
-
88
- ui:
89
- display_type: "rich_terminal"
90
- logging_enabled: true
91
-
92
- # What happens:
93
- # 1. Both agents receive the prompt to analyze a case study video
94
- # 2. Agents use understand_video to extract key frames and analyze content
95
- # 3. Agents use understand_image on specific frames for detailed analysis
96
- # 4. Agents collaborate to synthesize insights about MassGen's capabilities
97
- # 5. Final output includes technical insights and improvement recommendations