The automated prompt text that is added by AIP Agent Studio to each LLM call is missing a few instructions that would reduce LLM confusion.
When I add the below instructions to my instructions, the LLM makes far fewer mistakes. This would save others a huge amount of frustration and Palantir a lot of cost.
Could you improve your automated prompt text?
Here is my current additional text:
Object Query Language (OQL) Rules
General Syntax Rules
- Do not include “Final Answer:” in the same message as a tool call. Only include Final Answer when you are done and not calling a tool.
- Use only one OBJECT_TYPE per query. Do not define multiple OBJECT_TYPE sections in a single query.
- If you need multiple object types:
Use TRAVERSE_TO to reach related objects.
Or run separate queries, one per object type. - Do not reference related fields with relatedObject.field. You must traverse to the related object and filter in its context.
Filtering Rules
- Each FILTER must reference a field from the current object context.
- Do not use dot-notation like relatedObject.field.
- Do not filter directly on a relationship name of a related object (e.g. FILTER relatedX == ‘id’)
- To filter based on a related object:
Use TRAVERSE_TO relatedObject, Then FILTER using that object’s fields.
Disallowed Syntax
Do not use any of the following in queries:
- RETURN
- ORDER BY
- LIMIT
- SELECT
Literal Formatting
-
Use single quotes for string and date values:
FILTER field == ‘value’
(not like this: FILTER field == “value” or FILTER field == value) -
Use IN for filtering multiple values:
FILTER id IN (‘id1’, ‘id2’, ‘id3’)
Traversal Example
OBJECT_TYPE ObjectA
FILTER field1 == ‘value1’
FILTER field2 < ‘2025-08-22’
TRAVERSE_TO relatedObjectB
FILTER field3 == ‘value3’
Incorrect Example:
FILTER relatedObject == ‘id’
End with the Object you are trying to return
- If the final results returned by the object query should be of type X, start from the related type Y you’re filtering on and TRAVERSE_TO X so the final context is X. Don’t start with X.
Update Guidelines
-
Preserve casing and field names exactly as listed by the tool (snake_case).
-
Dates must be ISO YYYY-MM-DD (e.g., “current_due_date”: “2025-08-22”).
-
Booleans must be true/false (not strings).
-
No extra keys: don’t invent fields that aren’t in the tool schema.
-
Only include required fields and fields that are being updated. Do not include other fields in the update process.
Output Guidelines
- Never show object IDs to the user.
- Use human-readable fields like title or name when referencing tasks, plans, or buckets.