withOutput
Sets the output format guidelines for the agent’s responses. The output format defines how the agent should structure its responses. This can specify formatting patterns, response structure, markdown usage, or any other output conventions the agent should follow. Supports multi-line strings for complex formatting instructions.Output format description or template. Can include examples, numbered steps, markdown formatting requirements, or structural guidelines.
The builder instance for method chaining
Examples
- Simple Structure
- Detailed Template
withTone
Sets the communication tone and style for the agent. The tone defines how the agent should communicate - its personality, formality level, and interaction style. This helps ensure consistent and appropriate communication for your use case.Description of the desired communication style. Should specify personality traits, formality level, and interaction patterns. Can include multiple aspects (e.g., “friendly but professional”).
The builder instance for method chaining
Examples
- Friendly
- Professional
- Educational
withFormat
Sets the output format for the generated prompt. This method allows you to choose between different output formats, each optimized for different use cases:-
markdown: Standard markdown format with headers and formatting (default). Most human-readable, good for debugging and documentation. -
toon: TOON format (Token-Oriented Object Notation). Optimized for token efficiency, reducing token usage by 30-60% compared to markdown. Uses indentation-based structure and eliminates redundant syntax. -
compact: Minimal whitespace variant of markdown. Removes excessive whitespace while maintaining markdown structure.
- Start with
markdownwhile authoring or debugging prompts so teammates can read and diff the content easily. - Promote to
compactin QA/staging when you still want Markdown semantics but need to trim 10–20% of token usage. - Switch to
toonfor production workloads with high traffic or large guardrails/examples where 30–60% token savings meaningfully lower cost.
The desired output format:
"markdown", "toon", or "compact"The builder instance for method chaining
Examples
- TOON Format
- Compact Format
- Markdown Format