Seems like if I want to substitute a visualizer I ...
# proj-sdk
c
Seems like if I want to substitute a visualizer I have to do this:
Copy code
# Current workaround:
conversation = Conversation(
    agent=agent,
    workspace=cwd,
    visualize=False,  # Confusing: we DO want visualization!
    callbacks=[minimal_visualizer.on_event],
)
Seems like it would make more sense to be able to do this:
Copy code
# Ideal (if API supported it):
conversation = Conversation(
    agent=agent,
    workspace=cwd,
    visualize=minimal_visualizer,  # Direct and clear!
)
and if you want the visualization off:
Copy code
conversation = Conversation(
    agent=agent,
    workspace=cwd,
    visualize=None
)
WDYT?
āž• 1
šŸ™Œ 1
c
sounds like a good idea! @nutritious-balloon-65098 please update the visualization system in OpenHands/software-agent-sdk following the suggestion here and opens a new PR
n
I'm on it! Xingyao Wang can track my progress here.
āœ… Summary: Visualization API Improvement Complete I've successfully implemented the improved visualization system for OpenHands/software-agent-sdk and created PR #1025: **https://github.com/OpenHands/software-agent-sdk/pull/1025** šŸŽÆ What Was Done Core Enhancement: The
visualize
parameter now accepts three types for more intuitive usage: 1.
True
→ Use default visualizer (existing behavior, backward compatible) 2.
False
or
None
→ No visualization (existing behavior, backward compatible) 3.
ConversationVisualizer
instance
→ Use custom visualizer (NEW) šŸ“ Before & After Before (confusing):
Copy code
conversation = Conversation(
    agent=agent,
    workspace=cwd,
    visualize=False,  # Confusing: we DO want visualization!
    callbacks=[custom_visualizer.on_event],
)
After (clear and direct):
Copy code
conversation = Conversation(
    agent=agent,
    workspace=cwd,
    visualize=custom_visualizer,  # Direct and clear!
)
šŸ“¦ Changes Made 1. Updated Type Signatures (3 files): ā—¦
conversation.py
- Factory class with all overloads ā—¦
local_conversation.py
- LocalConversation implementation ā—¦
remote_conversation.py
- RemoteConversation implementation 2. Added Comprehensive Tests (1 file): ā—¦ 3 new test cases for the new functionality ā—¦ All 65 tests pass āœ“ 3. Created Example (1 file): ā—¦
examples/01_standalone_sdk/20_custom_visualizer.py
ā—¦ Demonstrates custom visualizer with custom highlighting āœ… Quality Checks • āœ“ All pre-commit hooks pass (ruff format, ruff lint, pycodestyle, pyright) • āœ“ All 65 existing tests continue to pass (fully backward compatible) • āœ“ New functionality fully tested • āœ“ Changes are minimal and focused • āœ“ PR is in draft status as requested The implementation is complete, tested, and ready for review! šŸš€ <sub>View full conversation</sub>
c
c
What is procedure for these messages?
Copy code
============================================================
:x: Found 1 undocumented example(s):
============================================================
   - examples/01_standalone_sdk/20_custom_visualizer.py

:warning:  Please add documentation for these examples in the docs repo.
============================================================
I'll update the PR with an example visualizer.
c
I think you will just need to add a new file in the reference the
examples/01_standalone_sdk/20_custom_visualizer.py
script following this format (https://github.com/OpenHands/docs/blob/main/.github/scripts/README.md) https://github.com/OpenHands/docs/tree/main/sdk/guides @nutritious-balloon-65098 please update this script to print more detailed error message to instruct user about how to add the documentation https://github.com/OpenHands/software-agent-sdk/blob/main/.github/scripts/check_documented_examples.py
n
I'm on it! Xingyao Wang can continue tracking my progress here.
āœ… Final Summary: Documentation and Tooling Updates Complete I've successfully added the documentation and improved the tooling as requested! Here's what was done: šŸ“š Documentation Added Created comprehensive documentation in the docs repository: • File:
sdk/guides/convo-custom-visualizer.mdx
• PR: https://github.com/OpenHands/docs/pull/77 (draft) The documentation includes: • Complete working example with proper code block format for auto-syncing • Step-by-step guide for creating custom visualizers • Before/after comparison showing the API improvement • Customization options (highlight patterns, colors, styles, message filtering) • Advanced usage examples • Links to related guides šŸ› ļø Improved Error Messages Updated `.github/scripts/check_documented_examples.py`: • Added detailed step-by-step instructions when undocumented examples are found • Includes links to: ā—¦ Format documentation README ā—¦ Example documentation files ā—¦ Docs repository guide directory • Makes it much clearer for contributors how to document their examples šŸ”— Cross-Referenced PRs Both PRs now reference each other: • Agent-SDK PR #1025: Updated description to include docs PR link • Docs PR #77: Includes reference to agent-sdk PR #1025 • Docs PR notes it should be merged after agent-sdk PR is merged šŸ“¦ Complete Changes Summary Agent-SDK Repository (3 commits on
feature/improve-visualizer-api
): 1. Core API improvement with tests 2. Example demonstrating custom visualizer usage 3. Improved check script with better error messages Docs Repository (1 commit on
feature/improve-visualizer-api
): 1. Comprehensive guide for custom visualizer feature All changes are pushed and both PRs are ready for review! šŸš€ Links: • Agent-SDK PR: https://github.com/OpenHands/software-agent-sdk/pull/1025 • Docs PR: https://github.com/OpenHands/docs/pull/77 <sub>View full conversation</sub>
c
@chilly-france-44439 I've updated the docs and example and I think this is now ready for a look by someone else.
šŸ™Œ 1
c
@full-greece-2387 could you take a look at these two and get it merged? šŸ™
acknowledged 1
c
@full-greece-2387 You'll see that Simon jumped in and reviewed this morning proposing a good simplification. I've been trying to get open hands to implement and properly test it, but OH is struggling.
Looks like tests are finally clean on this.
šŸ™Œ 1
c
yeah, i'm not super happy about OH's current solution -- just shoot it a paragraph lolsob
c
Thanks for keeping it going @chilly-france-44439!