Important improvements needed to automated Prompt Instructions

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

  1. Preserve casing and field names exactly as listed by the tool (snake_case).

  2. Dates must be ISO YYYY-MM-DD (e.g., “current_due_date”: “2025-08-22”).

  3. Booleans must be true/false (not strings).

  4. No extra keys: don’t invent fields that aren’t in the tool schema.

  5. 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.
2 Likes

This is very helpful. Thank you for the suggestions to improve our automated prompting!

Is this specifically for the Object Query tool where you found this extra prompting was needed?

You are right that much of it relates to the object query but I have found that it gets confused with action tool use as well (for example, it sometimes does an update action tool and also includes “Final Answer” which confuses the AIP Agent. So at the moment I add this to the overall prompt instruction but you could probably get better results by focusing this on the object query instructions.