
Security News
Federal Audit Finds NIST Wasted Funds With No Plan to Clear NVD Backlog
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.
@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.
The npm package @loopstack/accessing-tool-results-example-workflow receives a total of 45 weekly downloads. As such, @loopstack/accessing-tool-results-example-workflow popularity was classified as not popular.
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
Federal audit finds NIST lacked a plan to clear the NVD backlog, wasted funds on duplicate work, and delayed use of CISA data.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.