npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loopstack/accessing-tool-results-example-workflow

v0.20.6

Published

A simple workflow showing different methods of how to access tool results in a subsequent workflow step.

Readme

@loopstack/accessing-tool-results-example-workflow

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.

Overview

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:

  • Access tool results using call IDs via runtime.tools
  • Access tool results using call indices
  • Retrieve data from previous transitions
  • Create custom helper functions that access runtime for data extraction

This example is useful for developers learning to build data-driven workflows that need to pass information between steps.

Installation

See SETUP.md for installation and setup instructions.

How It Works

Workflow Class

The workflow declares tools, typed runtime, and a helper function:

@Workflow({
  configFile: __dirname + '/workflow-tool-results.workflow.yaml',
})
export class WorkflowToolResultsWorkflow {
  @InjectTool() private createValue: CreateValue;
  @InjectTool() private createChatMessage: CreateChatMessage;

  @Runtime()
  runtime: {
    tools: {
      create_some_data: {
        say_hello: {
          data: string;
        };
      };
    };
  };

  @DefineHelper()
  theMessage(): string {
    return this.runtime.tools.create_some_data.say_hello.data;
  }
}

Accessing Tool Results

1. Using Call IDs

Assign a unique id to a tool call, then reference it via runtime.tools.<transition_id>.<call_id>.data:

- id: say_hello
  tool: createValue
  args:
    input: 'Hello World.'

- tool: createChatMessage
  args:
    role: 'assistant'
    content: 'Data from specific call id: {{ runtime.tools.create_some_data.say_hello.data }}'

2. Using Call Indices

Access tool results by their position (zero-indexed) within the transition:

- tool: createChatMessage
  args:
    role: 'assistant'
    content: 'Data from first tool call: {{ runtime.tools.create_some_data.0.data }}'

3. Across Transitions

Tool results persist and can be accessed from subsequent transitions using the same runtime.tools patterns:

# In a later transition
- id: access_data
  from: data_created
  to: end
  call:
    - tool: createChatMessage
      args:
        role: 'assistant'
        content: 'Data from previous transition: {{ runtime.tools.create_some_data.say_hello.data }}'

4. Using Helper Functions

Define custom helper functions in your workflow class that access this.runtime directly:

@DefineHelper()
theMessage(): string {
  return this.runtime.tools.create_some_data.say_hello.data;
}

Then use them in your YAML configuration (no arguments needed):

- tool: createChatMessage
  args:
    role: 'assistant'
    content: 'Data access using custom helper: {{ theMessage }}'

Dependencies

This workflow uses the following Loopstack modules:

  • @loopstack/core - Core framework functionality
  • @loopstack/create-chat-message-tool - Provides CreateChatMessage tool
  • @loopstack/create-value-tool - Provides CreateValue tool

About

Author: Jakob Klippel

License: Apache-2.0

Additional Resources