fix: improve FastAgent <add_memory> prompt with examples and stronger guidance

Update response format examples to show <add_memory> usage with
plain text (not JSON) alongside tool calls. Strengthen the rule
to explicitly remind the agent to save data before navigating
away from a screen.
This commit is contained in:
Mariozada
2026-05-19 14:23:03 +10:00
parent 250efc6f49
commit 2716ea0232
2 changed files with 36 additions and 25 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ Key agents: ManagerAgent (planning), ExecutorAgent (actions), CodeActAgent (dire
ScripterAgent (off-device computation), StructuredOutputAgent (typed data extraction).
Atomic actions available to agents: `click`, `long_press`, `type`, `system_button`, `swipe`,
`open_app`, `get_state`, `take_screenshot`, `remember`, `complete`.
`open_app`, `get_state`, `take_screenshot`, `complete`.
## Repository Structure
@@ -62,51 +62,62 @@ State what you'll do before making tool calls. Example:
{% if 'click' in available_tools %}
{% if parallel_tools %}
Settings is open. I need to tap Wi-Fi at index 3. This will navigate to a new screen.
I can see the note with the meeting details: Team standup at 9:00 AM in Room 204, bring Q3 report. I need to save this before navigating to Calendar.
<add_memory>Meeting details from note: Team standup at 9:00 AM, Room 204, bring Q3 report.</add_memory>
<function_calls>
<invoke name="click">
<parameter name="index">3</parameter>
<invoke name="system_button">
<parameter name="button">home</parameter>
</invoke>
</function_calls>
The Wi-Fi password dialog is showing. The password field is at index 4 and Connect button at index 8. Both are on the same dialog so I'll type the password and connect in one go.
Now I'll open Calendar and create the event. From my memory I know it's 9:00 AM, Room 204.
<function_calls>
<invoke name="open_app">
<parameter name="text">Calendar</parameter>
</invoke>
</function_calls>
Calendar is open. I'll tap the + button at index 2 to create a new event.
<function_calls>
<invoke name="click">
<parameter name="index">2</parameter>
</invoke>
</function_calls>
Event form is open. I'll type the title and tap the time field. Both are on the same form.
<function_calls>
<invoke name="type">
<parameter name="index">4</parameter>
<parameter name="text">MyPassword</parameter>
<parameter name="index">3</parameter>
<parameter name="text">Team standup</parameter>
</invoke>
<invoke name="click">
<parameter name="index">8</parameter>
</invoke>
</function_calls>
Successfully connected to HomeNetwork.
<function_calls>
<invoke name="complete">
<parameter name="success">true</parameter>
<parameter name="message">Connected to HomeNetwork Wi-Fi network</parameter>
<parameter name="index">5</parameter>
</invoke>
</function_calls>
{% else %}
I can see the Settings app is open. I need to tap on the Wi-Fi option which is at index 3 in the UI elements.
I can see the Contacts app with Grace Liu's details. Her birthday is August 10. I need to save this before going to Calendar.
<add_memory>Grace Liu's birthday is August 10.</add_memory>
<function_calls>
<invoke name="click">
<parameter name="index">3</parameter>
<invoke name="system_button">
<parameter name="button">home</parameter>
</invoke>
</function_calls>
After receiving the result, continue reasoning and acting:
Wi-Fi settings are now open. I can see the toggle is off. I need to enable it by clicking the toggle at index 1.
I'm on the home screen now. I need to open Calendar to create the birthday event. From my memory, Grace Liu's birthday is August 10.
<function_calls>
<invoke name="click">
<parameter name="index">1</parameter>
<invoke name="open_app">
<parameter name="text">Calendar</parameter>
</invoke>
</function_calls>
@@ -115,7 +126,7 @@ When done:
<function_calls>
<invoke name="complete">
<parameter name="success">true</parameter>
<parameter name="message">Successfully enabled Wi-Fi in settings</parameter>
<parameter name="message">Created birthday event for Grace Liu on August 10</parameter>
</invoke>
</function_calls>
{% endif %}
@@ -129,7 +140,7 @@ When done:
- Prefer one tool call per response so you can observe the result before acting again
{% endif %}
- Use `complete` to signal task completion (success or failure)
- Use `<add_memory>` tags to store important information you'll need in future steps (e.g. data read from the screen that you'll need after navigating away). Only record NEW facts — your previous memory is shown to you each step in the `<memory>` block. If nothing new is worth remembering, omit the tag.
- **Before navigating away from a screen that contains data you need later** (names, numbers, dates, settings values, list items), save it using `<add_memory>` tags. Write plain text, not JSON. Your memory is shown to you each step in the `<memory>` block. Only record NEW facts — if nothing new is worth remembering, omit the tag.
- Messages in `<external_user_message>` tags are live corrections or new instructions from the user sent mid-execution. They override earlier assumptions — honor the most recent user guidance on your next step
{% if output_schema %}