Skip to content

feat(backend): New "update microagent prompt" API #8357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

amanape
Copy link
Member

@amanape amanape commented May 8, 2025

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality this introduces.


Summarize what the PR does, explaining any non-trivial design decisions.
Steps:

  1. Get conversation ID and event ID of event we want the agent to learn
  2. Get context surrounding given event ID
  3. Generate a prompt with the help of an LLM to use as initial query

Blocks #8592


Link of any specific issues this addresses:


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:edcbba1-nikolaik   --name openhands-app-edcbba1   docker.all-hands.dev/all-hands-ai/openhands:edcbba1

@amanape amanape self-assigned this May 8, 2025
@amanape amanape changed the title feat(backend): Update microagent API feat(backend): New "update microagent" API May 8, 2025
@enyst enyst self-requested a review May 8, 2025 16:44
@amanape amanape marked this pull request as ready for review May 22, 2025 14:38
@amanape amanape requested review from enyst and rbren May 22, 2025 14:38
@amanape amanape changed the title feat(backend): New "update microagent" API feat(backend): New "update microagent prompt" API May 22, 2025
A list of events including the target event and the specified number of events before and after it.
"""
target_event_index = None
for i, event in enumerate(events):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the point... Still, we shouldn't need the index in history, only event ids... We could apply a filter like this on get_events so that it gives us only the kind of events that can be part of an agent's history. Not enough, because we counted events, not agent history events...

OK, better, we can move to Tim's new interface to the event stream, search_events instead of get_events, because it also has a limit argument (and a nicer filter). So we can do something like

search_events (
  event_id=...,
  filter=EventFilter(...),
  limit=context_size
)

and then get those before event_id similarly, with reverse=True 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let me know if you want me to tweak the events and the prompt. Probably on Monday if that's okay with you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to search events with the start and end indices, though I'm not sure if this is entirely correct given your comment on filter, limits, and reverse.

If you think there is a better way to do this, feel free! As for the prompt (if you mean the jinja file), yes, any improvements there would be appreciated as well 😄

Copy link

openhands-ai bot commented May 29, 2025

Looks like there are a few issues preventing this PR from being merged!

  • GitHub Actions are failing:
    • Docker
    • Run Python Unit Tests

If you'd like me to help, just leave a comment, like

@OpenHands please fix the failing actions on PR #8357

Feel free to include any additional details that might help me get this PR into a better state.

You can manage your notification settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants