Connection Data Structure
Understanding the data structure of different block outputs
When you connect blocks, the output data structure from the source block determines what values are available in the destination block. Each block type produces a specific output structure that you can reference in downstream blocks.
Understanding these data structures is essential for effectively using connection tags and accessing the right data in your workflows.
Block Output Structures
Different block types produce different output structures. Here's what you can expect from each block type:
Agent Block Output Fields
- content: The main text response generated by the agent
- model: The AI model used (e.g., "gpt-4o", "claude-3-opus")
- tokens: Token usage statistics
- prompt: Number of tokens in the prompt
- completion: Number of tokens in the completion
- total: Total tokens used
- toolCalls: Array of tool calls made by the agent (if any)
- cost: Array of cost objects for each tool call (if any)
- usage: Token usage statistics for the entire response
Custom Output Structures
Some blocks may produce custom output structures based on their configuration:
-
Agent Blocks with Response Format: When using a response format in an Agent block, the output structure will match the defined schema instead of the standard structure.
-
Function Blocks: The
result
field can contain any data structure returned by your function code. -
API Blocks: The
data
field will contain whatever the API returns, which could be any valid JSON structure.
Always check the actual output structure of your blocks during development to ensure you're referencing the correct fields in your connections.
Nested Data Structures
Many block outputs contain nested data structures. You can access these using dot notation in connection tags:
For example:
<agent1.tokens.total>
- Access the total tokens from an Agent block<api1.data.results[0].id>
- Access the ID of the first result from an API response<function1.result.calculations.total>
- Access a nested field in a Function block's result