Skip to content

Sequencer Plugin

The Sequencer Plugin enables your agent to execute complex multi-step operations by:

Coordinating multiple actions in a specific sequence Handling state and context across actions Providing detailed execution feedback


Installation

  1. Install the required packages:

    Terminal window
    pnpm add @iqai/agent @iqai/plugin-sequencer

Basic Setup

Here’s a complete example of setting up an agent with the Sequencer plugin:

import { AgentBuilder, ModelProviderName } from "@iqai/agent";
import createSequencerPlugin from "@iqai/plugin-sequencer";
async function main() {
// Initialize Sequencer plugin
const sequencerPlugin = await createSequencerPlugin();
// Create agent with plugin
const agent = new AgentBuilder()
.withModelProvider(
ModelProviderName.OPENAI,
process.env.OPENAI_API_KEY
)
.withPlugins([sequencerPlugin])
.build();
await agent.start();
}
main().catch(console.error);

Usage Examples

  • Get my AI token holdings, then sell 10% of the top holding
  • Get Fraxlend pool with highest APR, then lend 0.1 FRAX to the pool

Common Issues and Troubleshooting

  • Missing Actions: Ensure all required action plugins are installed
  • State Persistence: Verify database configuration
  • Sequence Timeouts: Check maxSteps configuration