liveBook · Manning

Trigger pattern

As explained in Build an AI Agent (From Scratch)

A trigger pattern is a linguistic signal that indicates when a particular action or tool invocation is appropriate.

A trigger pattern is a linguistic signal that helps an agent decide when a particular tool invocation is appropriate. Prompt guidelines make these signals explicit instead of leaving timing to vague instructions such as “use when necessary.” section 2.3.2

Useful trigger patterns include:

  • Explicit references: “What we discussed...” or “As I mentioned before...” section 2.3.2
  • Time references: “What did we talk about yesterday?” or “Show me last week’s chat.” section 2.3.2
  • Implicit references: “You suggested,” “We decided,” “My project,” or “That bug.” section 2.3.2
  • Negative guides: avoid searching for timeless information, definitions, fundamental concepts, or established technical facts. section 2.3.2

Conversation-search decision

When a user asks, “What did we talk about yesterday?”, the time reference indicates that the conversation-search tool may be appropriate. When the user asks, “How do I write a for loop in Python?”, the timeless technical question indicates that searching is unnecessary. section 2.3.2

How Build an AI Agent (From Scratch) covers it

How deep it goes
Defines explicit, time-based, implicit, and negative signals, but does not describe implementation beyond prompt guidance.
Examples
Uses past-conversation phrases, time references, implicit references, and a Python for-loop question as contrasting cases.
What you can do after
Apply trigger patterns in agent prompts to improve search-tool timing and reduce unnecessary latency and cost.
How it connects
Connects tool invocation with agent prompts, search tools, negative guides, and prompt examples.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build an AI Agent (From Scratch). The section links point to the parts of the book it draws on.