Overview
Embeds allow you to reference and manipulate content dynamically using a special syntax:- « and »: Embed delimiters (guillemets)
- embed_type: The type of embed (e.g.,
artifact_content,datetime,math) - expression: The expression to evaluate
- format (optional): Output format modifier
Embed Types
Embeds are categorized into two groups based on when they’re resolved:Early Embeds
Resolved before tool execution, during parameter processing:Current date/time in various formats.
Mathematical expressions.
Generate unique identifiers.
Access artifact metadata.
Late Embeds
Resolved after tool execution, typically for content output:Load artifact content with transformations.
Signal that artifact should be returned to user.
Artifact Content Embeds
The most powerful embed type for working with artifacts.Basic Syntax
Examples
Modifiers
Modifiers transform the content before it’s returned:limit - Limit output size
limit - Limit output size
offset - Skip initial content
offset - Skip initial content
sample - Random sampling
sample - Random sampling
line_numbers - Add line numbers
line_numbers - Add line numbers
Format Transformations
Theformat specifier transforms content into different formats:
Convert to JSON format.
Convert to pretty-printed JSON.
Convert to CSV format.
Convert to HTML table.
Convert to base64 data URI.
Chaining Operations
Use>>> to chain multiple operations:
- Takes 100 random samples from the CSV
- Converts the result to JSON format
Complete Examples
Example 1: Transform CSV to JSON
Example 2: Extract Specific Lines
Example 3: Create HTML Report
Datetime Embeds
Generate timestamps and dates dynamically.Syntax
Format Examples
Common Format Codes
%Y: Year (4 digits)%m: Month (01-12)%d: Day (01-31)%H: Hour 24-hour (00-23)%I: Hour 12-hour (01-12)%M: Minute (00-59)%S: Second (00-59)%p: AM/PM%B: Full month name%b: Abbreviated month name
Math Embeds
Evaluate mathematical expressions.Syntax
Examples
UUID Embeds
Generate unique identifiers.Syntax
Examples
Artifact Metadata Embeds
Access artifact metadata without loading full content.Syntax
Available Fields
description: Artifact descriptionsize: File size in bytesmime_type: MIME typecreated_at: Creation timestampschema: Schema information (for structured data)
Examples
Embed Resolution
Embeds are resolved at different stages:Early Resolution (Parameter Processing)
Early embeds are resolved when processing tool parameters:
datetime: Current timestampmath: Mathematical calculationsuuid: Unique ID generationartifact_meta: Metadata retrieval
Configuration
Embed behavior can be configured globally:Best Practices
Use Appropriate Embed Types
Use Appropriate Embed Types
Choose the right embed type for your use case:
- Use
artifact_contentfor loading data - Use
artifact_metawhen you only need metadata - Use
datetimefor timestamps - Use
uuidfor unique identifiers
Chain Operations Efficiently
Chain Operations Efficiently
Order operations for efficiency:
Use Limits for Large Files
Use Limits for Large Files
Always use limits when working with large files:
Validate Embed Syntax
Validate Embed Syntax
Use the correct delimiter characters:
- Use
«and»(guillemets), not<and> - Use
>>>for chaining, not>> - Use
|for format, not::
Error Handling
When embeds fail to resolve:Advanced Examples
Example 1: Dynamic Report Generation
Example 2: Data Pipeline
See Also
- Artifact Management - Work with artifacts
- apply_embed_and_create_artifact - Apply embeds to create artifacts
- Tool Configuration - Configure embed behavior