What do you think if we give the agent some info a...
# proj-sdk
c
What do you think if we give the agent some info about finding docs on itself, in CLI ? Kinda like CC is doing, to presumably make it easier to use its features https://github.com/OpenHands/OpenHands-CLI/issues/207
➕ 5
c
Copy code
When the user directly asks about Claude Code (eg 'can Claude Code do...', 'does Claude Code have...') or asks in second person (eg 'are you able...', 'can you do...'), first use the WebFetch tool to gather information to answer the question from Claude Code docs at <https://docs.anthropic.com/en/docs/claude-code>.
  - The available sub-pages are `overview`, `quickstart`, `memory` (Memory management and CLAUDE.md), `common-workflows` (Extended thinking, pasting images, --resume), `ide-integrations`, `mcp`, `github-actions`, `sdk`, `troubleshooting`, `third-party-integrations`, `amazon-bedrock`, `google-vertex-ai`, `corporate-proxy`, `llm-gateway`, `devcontainer`, `iam` (auth, permissions), `security`, `monitoring-usage` (OTel), `costs`, `cli-reference`, `interactive-mode` (keyboard shortcuts), `slash-commands`, `settings` (settings json files, env vars, tools), `hooks`.
  - Example: <https://docs.anthropic.com/en/docs/claude-code/cli-usage>
We should add something similar to the above to our system prompt, And refer to our docs (https://docs.all-hands.dev/) instead (we should also update the referred sub-pages with the stuff that we actually have the docs) @nutritious-balloon-65098
n
I'm on it! Xingyao Wang can track my progress here.
Summary I've successfully implemented self-documentation lookup capability for OpenHands agents, inspired by Claude Code's approach. This addresses OpenHands-CLI#207. What Was Implemented Self-Documentation System Prompt Section - OpenHands agents can now automatically fetch their own documentation when users ask capability questions like "Can OpenHands do X?" or "Does OpenHands support Y?" Changes Made 1.
openhands-sdk/openhands/sdk/agent/prompts/self_documentation.j2
(new, 84 lines) ◦ Comprehensive documentation structure mapped from https://docs.all-hands.dev/sdk ◦ Organized by category: Getting Started, Architecture, Guides (Agent/LLM/Conversation/Tools), API Reference ◦ Includes usage examples and guidelines for when to fetch documentation 2.
openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2
(modified, +4 lines) ◦ Added <SELF_DOCUMENTATION> section that includes the new template ◦ Positioned before security sections for visibility 3.
tests/sdk/agent/test_self_documentation_integration.py
(new, 96 lines) ◦ Tests that self-documentation section is included in system message ◦ Validates template rendering and documentation structure ◦ All tests pass ✓ How It Works When users ask capability questions, agents will: 1. Recognize the question pattern (e.g., "Can OpenHands...", "Does OpenHands have...") 2. Use the fetch tool to get documentation from https://docs.all-hands.dev/sdk 3. Reference the appropriate pages (getting-started, guides/llm-streaming, arch/security, etc.) 4. Provide accurate, up-to-date answers with documentation links Branch & Next Steps Changes pushed to:
add-self-documentation-lookup
Create a PR at: https://github.com/OpenHands/software-agent-sdk/pull/new/add-self-documentation-lookup This makes OpenHands agents more discoverable and user-friendly, similar to Claude Code's documentation lookup feature! <sub>View full conversation</sub>
c
@nutritious-balloon-65098 create a PR for me
n
I'm on it! Xingyao Wang can continue tracking my progress here.
Summary I've successfully implemented a self-documentation lookup capability for OpenHands agents, inspired by Claude Code's approach, as requested in OpenHands-CLI#207. What Was Done Added Self-Documentation Feature to System Prompt Similar to Claude Code's documentation lookup, OpenHands agents can now automatically fetch their own documentation when users ask capability questions like "Can OpenHands do X?" or "Does OpenHands support Y?" Changes Made (3 files, 184 lines) 1.
openhands-sdk/openhands/sdk/agent/prompts/self_documentation.j2
(new) ◦ Comprehensive documentation structure mapped from actual OpenHands docs ◦ Organized by: Getting Started, Architecture, Guides (Agent/LLM/Conversation/Tools), API Reference ◦ Includes usage examples and instructions for when to fetch documentation 2.
openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2
(modified) ◦ Added <SELF_DOCUMENTATION> section that includes the new template 3.
tests/sdk/agent/test_self_documentation_integration.py
(new) ◦ Tests verify the section is properly integrated into agent system messages ◦ Tests validate template rendering and documentation structure ◦ All tests pass ✓ Key Features • Triggers automatically when users ask capability questions • Points to actual docs at https://docs.all-hands.dev/sdk • Comprehensive page mapping based on real documentation structure • Provides examples of how to use the feature • Instructs agents to fetch docs, combine multiple sources, and provide links Pull Request Created ✅ PR #1396 (draft): https://github.com/OpenHands/software-agent-sdk/pull/1396 • Branch:
add-self-documentation-lookup
• All tests pass, pre-commit checks pass • Ready for review The implementation is complete, tested, and follows all repository conventions! <sub>View full conversation</sub>
c
@nutritious-balloon-65098 also i think openhands-sdk/openhands/sdk/agent/prompts/self_documentation.j2 is a bit too long. Can we make it as compact / succint as possible similar to the claude code example
n
I'm on it! Xingyao Wang can continue tracking my progress here.
Summary I've successfully implemented a self-documentation lookup feature for OpenHands agents, inspired by Claude Code's approach, addressing OpenHands-CLI#207. ✅ Request Checklist - [ ] Added self-documentation section similar to Claude Code - [ ] Referenced OpenHands docs (https://docs.all-hands.dev/sdk) instead of Claude Code docs - [ ] Updated sub-pages to reflect actual OpenHands SDK documentation structure - [ ] ~Made implementation concise and succinct like Claude Code (13 lines vs their 8) - [ ] Created and pushed PR 📝 What Changed Files Modified:
Copy code
openhands-sdk/openhands/sdk/agent/prompts/self_documentation.j2 (new)     | 13 lines
openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 (modified)     |  4 lines
tests/sdk/agent/test_self_documentation_integration.py (new)              | 81 lines
────────────────────────────────────────────────────────────────────────────────
Total: 98 insertions
🎯 Key Implementation Details Following Claude Code's concise pattern, the
self_documentation.j2
template: • Defines trigger conditions (capability questions, how-to queries) • Provides base URL (https://docs.all-hands.dev/sdk) • Lists high-level structure (Getting Started, Architecture, Guides, API Reference) • Instructs to use fetch tool rather than listing every documentation page • Total: 13 lines (comparable to Claude Code's ~8 lines) This is much more maintainable than the initial 84-line version that listed all pages explicitly. ✅ Testing & Quality • All tests pass (2/2) • Pre-commit checks pass • No regressions in existing tests • Follows repository conventions 🔗 Pull Request PR #1396: https://github.com/OpenHands/software-agent-sdk/pull/1396 (Draft) The PR includes: • Complete implementation with concise template • Comprehensive test coverage • Detailed description of benefits and approach • Comparison to Claude Code's pattern 💡 How It Works When users ask questions like: • "Can OpenHands do X?" • "Are you able to...?" • "How do I use [feature]?" The agent will: 1. Recognize it as a capability question 2. Use the
fetch
tool to retrieve documentation from https://docs.all-hands.dev/sdk 3. Provide accurate, up-to-date answers with links This improves accuracy, discoverability, and user experience while keeping the system prompt maintainable. <sub>View full conversation</sub>
c
@nutritious-balloon-65098 why are you only including the link to "sdk" docs, not other things? Please read to understand how many ways we can work with openhands https://github.com/OpenHands/OpenHands/blob/main/README.md
n
I'm on it! Xingyao Wang can continue tracking my progress here.
✅ Final Summary I've successfully implemented a self-documentation lookup feature for OpenHands agents, inspired by Claude Code, that enables agents to fetch accurate, up-to-date information about all OpenHands products. 📋 Request Checklist - Fully Addressed • ✅ Added self-documentation section similar to Claude Code's approach • ✅ Referenced OpenHands docs at https://docs.all-hands.dev/ • ✅ Updated sub-pages to reflect actual OpenHands documentation structure • ✅ Made implementation concise (20 lines vs Claude Code's ~8 lines) • ✅ Covered ALL OpenHands products (SDK, CLI, GUI, Cloud, Enterprise) - not just SDK 📝 Changes Made (107 lines total)
Copy code
openhands-sdk/openhands/sdk/agent/prompts/self_documentation.j2 (new)     | 20 lines
openhands-sdk/openhands/sdk/agent/prompts/system_prompt.j2 (modified)     |  4 lines  
tests/sdk/agent/test_self_documentation_integration.py (new)              | 83 lines
🎯 What It Does When users ask capability questions, agents will now: 1. Recognize the question type (e.g., "Can OpenHands do X?", "How do I use Y?") 2. Fetch relevant documentation from https://docs.all-hands.dev/ using the fetch tool 3. Cover all products: SDK, CLI, GUI, Cloud, Enterprise 4. Provide accurate answers with links for users to learn more ✅ Quality Assurance • All tests pass (2/2) ✓ • Pre-commit checks pass ✓ • Concise, maintainable implementation ✓ • No extraneous changes ✓ 🔗 Pull Request PR #1396: https://github.com/OpenHands/software-agent-sdk/pull/1396 (Draft) Successfully pushed and ready for review. Addresses OpenHands-CLI#207. <sub>View full conversation</sub>