Skip to main content

withIdentity

Sets the agent’s core identity or purpose. The identity defines who or what the agent is. This should be a clear, concise statement that establishes the agent’s role, expertise, and primary function. This appears first in the generated prompt and frames all subsequent instructions.
withIdentity(text: string): this
text
string
required
A description of the agent’s identity. Should be written in second person (“You are…”) or third person (“The assistant is…”). Keep it focused and specific to guide the model’s behavior.
Returns
this
The builder instance for method chaining

Example

builder.withIdentity("You are an expert travel assistant specializing in European destinations");

builder.withIdentity("You are a senior software engineer with 10 years of experience in distributed systems");

withCapability

Adds a single capability to the agent’s skillset. Capabilities define what the agent can do. Each capability should describe a specific skill, action, or area of expertise. Multiple calls to this method will accumulate capabilities - they don’t replace previous ones.
withCapability(cap: string): this
cap
string
required
A single capability description. Should be action-oriented and specific enough to be meaningful but broad enough to be useful.
Returns
this
The builder instance for method chaining

Example

builder
  .withCapability("Search and analyze research papers")
  .withCapability("Generate literature reviews")
  .withCapability("Explain complex scientific concepts");

withCapabilities

Adds multiple capabilities at once to the agent’s skillset. This is a convenience method for adding several capabilities in a single call, equivalent to calling .withCapability() multiple times. Empty strings in the array are filtered out automatically.
withCapabilities(caps: string[]): this
caps
string[]
required
An array of capability descriptions. Each should describe a specific skill or action the agent can perform.
Returns
this
The builder instance for method chaining

Example

builder.withCapabilities([
  "Analyze financial data and trends",
  "Calculate investment returns",
  "Provide risk assessments",
  "Generate financial reports"
]);

Build docs developers (and LLMs) love