MCPcopy Create free account
hub / github.com/MiniMax-AI/Mini-Agent / test_multi_turn_conversation

Function test_multi_turn_conversation

tests/test_session_integration.py:33–73  ·  view source on GitHub ↗

Test multi-turn conversation and context sharing

(mock_llm_client, temp_workspace)

Source from the content-addressed store, hash-verified

31
32
33def test_multi_turn_conversation(mock_llm_client, temp_workspace):
34 """Test multi-turn conversation and context sharing"""
35 # Prepare test data
36 system_prompt = "You are an intelligent assistant"
37 tools = [
38 ReadTool(workspace_dir=temp_workspace),
39 WriteTool(workspace_dir=temp_workspace),
40 SessionNoteTool(),
41 ]
42
43 # Create agent
44 agent = Agent(
45 llm_client=mock_llm_client,
46 system_prompt=system_prompt,
47 tools=tools,
48 workspace_dir=temp_workspace,
49 )
50
51 # Verify initial state
52 assert len(agent.messages) == 1 # Only system prompt
53 assert agent.messages[0].role == "system"
54 # Agent automatically adds workspace info to system prompt
55 assert system_prompt in agent.messages[0].content
56 assert "Current Workspace" in agent.messages[0].content
57
58 # Add first user message
59 agent.add_user_message("Hello")
60 assert len(agent.messages) == 2
61 assert agent.messages[1].role == "user"
62 assert agent.messages[1].content == "Hello"
63
64 # Add second user message
65 agent.add_user_message("Help me create a file")
66 assert len(agent.messages) == 3
67 assert agent.messages[2].role == "user"
68
69 # Verify all messages are retained in history
70 user_messages = [m for m in agent.messages if m.role == "user"]
71 assert len(user_messages) == 2
72 assert user_messages[0].content == "Hello"
73 assert user_messages[1].content == "Help me create a file"
74
75
76def test_session_history_management(mock_llm_client, temp_workspace):

Callers

nothing calls this directly

Calls 5

add_user_messageMethod · 0.95
ReadToolClass · 0.90
WriteToolClass · 0.90
SessionNoteToolClass · 0.90
AgentClass · 0.90

Tested by

no test coverage detected