Is there a way to get trajectory.json file from Ag...
# questions
l
Is there a way to get trajectory.json file from Agent-SDK? In openhands webui, there is an option to download it. Is there a similar mechanism in Agent-SDK?
w
yes there definitely is.. @chilly-france-44439 can probably point you in the right direction Xingyao, we should add this to the docs somewhere. Maybe just having autogenerated python API docs would fix it
c
Yes, if you set your persistent directory (see the snippet below), your conversation will be persisted to a directory containing JSON files that mirror the
trajectory.json
in V0. https://github.com/OpenHands/software-agent-sdk/blob/9ac99bd6b5c853feb22ab23124091c553a0eba65/examples/01_standalone_sdk/10_persistence.py#L59-L68 @nutritious-balloon-65098, please create a pull request in OpenHands/docs repo and add the information that you can use the persistence directory similar to
trajectory.json
in V0. Also, you should move "Persistence" to top-level (instead of hiding them under conversation feature) in docs.json https://github.com/OpenHands/docs/blob/main/sdk/guides/convo-persistence.mdx
l
Thanks @chilly-france-44439 & @wooden-umbrella-84098.. I've been looking for this feature for while.. This is really a life saver for my project...
šŸ’Æ 1
šŸ™Œ 1
n
I'm on it! Xingyao Wang can track my progress here.
Summary I've successfully created a pull request in the OpenHands/docs repository with the requested changes: āœ… Changes Completed 1. Added Persistence Directory Structure Documentation (
sdk/guides/convo-persistence.mdx
): ā—¦ Added a new section explaining that the persistence directory contains JSON files that mirror the
trajectory.json
file structure from OpenHands V0 ā—¦ Included a directory structure example showing how conversations are stored as individual JSON files named with their conversation IDs ā—¦ Clarified that each JSON file contains the complete serialized conversation state (events, messages, metadata) 2. Moved Persistence to Top-Level (
docs.json
): ā—¦ Moved the Persistence guide from under "Conversation Features" to top-level in the SDK Guides section ā—¦ Now appears alongside other core features like Custom Tools, MCP, and Skill šŸ“‹ Pull Request Draft PR Created: https://github.com/OpenHands/docs/pull/68 The PR is currently marked as a draft. All changes have been committed and pushed to the
sdk-persistence-docs-update
branch. šŸ” What Was Changed • docs.json: Repositioned
sdk/guides/convo-persistence
from nested under "Conversation Features" to top-level • sdk/guides/convo-persistence.mdx: Added 14 lines documenting the persistence directory structure and its similarity to V0's trajectory.json The changes are minimal and focused, addressing exactly what was requested without any extraneous modifications. <sub>View full conversation</sub>
Summary I've successfully updated the OpenHands SDK documentation as requested: Changes Made āœ… 1. Added Persistence Directory Structure Documentation (
sdk/guides/convo-persistence.mdx
) • Added new section explaining that
persistence_dir
creates JSON files mirroring
trajectory.json
from V0 • Clarified the directory structure follows `.conversations/`<conversation-id>`/` pattern • Each conversation stored in its own subdirectory with a
state.json
file • Explained that each JSON file contains serialized conversation state with all events, messages, and metadata āœ… 2. Moved Persistence to Top-Level (
docs.json
) • Moved "Persistence" guide from nested "Conversation Features" group to top-level under "Guides" • Now appears alongside other core features (after "skill", before "context-condenser") Pull Request PR #68: https://github.com/OpenHands/docs/pull/68 The PR has been created as a draft and is ready for review. The branch
sdk-persistence-docs-update
contains all changes and has been pushed to the remote repository. Note: The PR also includes automatic code synchronization updates from the agent-sdk examples repository, which is part of the normal CI/CD process for keeping documentation in sync with actual code examples. <sub>View full conversation</sub>