
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@loopstack/accessing-tool-results-example-workflow
Advanced tools
A simple workflow showing different methods of how to access tool results in a subsequent workflow step.
A module for the Loopstack AI automation framework.
This module provides an example workflow demonstrating different methods for accessing tool results within and across workflow transitions.
The Tool Results Example Workflow shows how to retrieve and use data returned by tools in subsequent workflow steps. Understanding these patterns is essential for building workflows that pass data between operations.
By using this workflow as a reference, you'll learn how to:
@InjectTool() and access their return values directlyThis example is useful for developers learning to build data-driven workflows that need to pass information between steps.
See SETUP.md for installation and setup instructions.
The workflow extends BaseWorkflow and declares tools via @InjectTool(). Tool results are stored as instance properties and accessed across transitions:
@Workflow({
uiConfig: __dirname + '/workflow-tool-results.ui.yaml',
})
export class WorkflowToolResultsWorkflow extends BaseWorkflow {
@InjectTool() private createValue: CreateValue;
@InjectTool() private createChatMessage: CreateChatMessage;
storedMessage?: string;
}
In a transition method, call a tool with this.tool.call(args) and store the result as an instance property:
@Initial({ to: 'data_created' })
async createSomeData() {
const result = await this.createValue.call({ input: 'Hello World.' });
this.storedMessage = result.data as string;
await this.createChatMessage.call({
role: 'assistant',
content: `Data from specific call id: ${this.storedMessage}`,
});
await this.createChatMessage.call({
role: 'assistant',
content: `Data from first tool call: ${this.storedMessage}`,
});
}
The createValue tool returns a ToolResult object with a data property containing the output. This value is stored in this.storedMessage for later use.
Instance properties persist across transitions. In a subsequent @Final method, the stored data is still available:
@Final({ from: 'data_created' })
async accessData() {
await this.createChatMessage.call({
role: 'assistant',
content: `Data from previous transition: ${this.storedMessage}`,
});
await this.createChatMessage.call({
role: 'assistant',
content: `Data access using custom helper: ${this.theMessage()}`,
});
}
Define private methods on the workflow class to encapsulate data access logic:
private theMessage(): string {
return this.storedMessage!;
}
These are standard TypeScript methods -- no decorator needed. Call them from any transition method using this.theMessage().
import { BaseWorkflow, Final, Initial, InjectTool, Workflow } from '@loopstack/common';
import { CreateChatMessage } from '@loopstack/create-chat-message-tool';
import { CreateValue } from '@loopstack/create-value-tool';
@Workflow({
uiConfig: __dirname + '/workflow-tool-results.ui.yaml',
})
export class WorkflowToolResultsWorkflow extends BaseWorkflow {
@InjectTool() private createValue: CreateValue;
@InjectTool() private createChatMessage: CreateChatMessage;
storedMessage?: string;
@Initial({ to: 'data_created' })
async createSomeData() {
const result = await this.createValue.call({ input: 'Hello World.' });
this.storedMessage = result.data as string;
await this.createChatMessage.call({
role: 'assistant',
content: `Data from specific call id: ${this.storedMessage}`,
});
await this.createChatMessage.call({
role: 'assistant',
content: `Data from first tool call: ${this.storedMessage}`,
});
}
@Final({ from: 'data_created' })
async accessData() {
await this.createChatMessage.call({
role: 'assistant',
content: `Data from previous transition: ${this.storedMessage}`,
});
await this.createChatMessage.call({
role: 'assistant',
content: `Data access using custom helper: ${this.theMessage()}`,
});
}
private theMessage(): string {
return this.storedMessage!;
}
}
This workflow uses the following Loopstack modules:
@loopstack/common - Base classes, decorators, and tool injection@loopstack/create-chat-message-tool - Provides CreateChatMessage tool@loopstack/create-value-tool - Provides CreateValue toolAuthor: Jakob Klippel
License: Apache-2.0
FAQs
A simple workflow showing different methods of how to access tool results in a subsequent workflow step.
We found that @loopstack/accessing-tool-results-example-workflow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.