Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/memory/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ def conversation_loop():
raise

# Process all messages from the runner
assistant_content: list[BetaContentBlockParam] = []
for message in runner:
spinner.stop()

Expand All @@ -351,6 +350,7 @@ def conversation_loop():
print(f"\n🧹 [Context Management: {edit.type} applied]")

# Process content blocks
assistant_content: list[BetaContentBlockParam] = []
for content in message.content:
if content.type == "text":
print(content.text, end="", flush=True)
Expand All @@ -371,6 +371,10 @@ def conversation_loop():
}
)

# Store assistant message
if assistant_content:
messages.append({"role": "assistant", "content": assistant_content})

# Generate tool response automatically
tool_response = runner.generate_tool_call_response()
if tool_response and tool_response["content"]:
Expand All @@ -381,10 +385,6 @@ def conversation_loop():
if isinstance(result, dict) and result.get("type") == "tool_result":
print(f"[Tool result processed]")

# Store assistant message
if assistant_content:
messages.append({"role": "assistant", "content": assistant_content})

print()


Expand Down