You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@sumup/agent-toolkit

Package Overview
Dependencies
Maintainers
14
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sumup/agent-toolkit

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
21
-36.36%
Maintainers
14
Weekly downloads
 
Created
Source

SumUp Agent Toolkit - Typescript

Allow LLM agents to integrate with the SumUp API using function calling from frameworks such as LangChain, and Vercel's AI SDK. For full documentation, see sumup.github.io/sumup-agent-toolkit.

NPM Version JSR Version

Install

Install SumUp Agent Toolkit using:

npm install @sumup/agent-toolkit
# or
yarn add @sumup/agent-toolkit

LangChain

import { SumUpAgentToolkit } from '@sumup/agent-toolkit/langchain';
import { AgentExecutor, createStructuredChatAgent } from 'langchain/agents';

const sumupAgentToolkit = new SumUpAgentToolkit({
  apiKey: process.env.SUMUP_API_KEY!,
});

const llm = new ChatOpenAI({
  model: 'gpt-4o',
});

const prompt = await pull<ChatPromptTemplate>(
  'hwchase17/structured-chat-agent'
);

const tools = sumupAgentToolkit.getTools();

const agent = await createStructuredChatAgent({
  llm,
  tools,
  prompt,
});

const agentExecutor = new AgentExecutor({
  agent,
  tools,
});

const response = await agentExecutor.invoke({
  input: "Tell me about my last 10 transactions please.",
});

For full example see Langchain Example.

AI SDK

import { SumUpAgentToolkit } from '@sumup/agent-toolkit/langchain';
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";

const sumupAgentToolkit = new SumUpAgentToolkit({
  apiKey: process.env.SUMUP_API_KEY!,
});

const model = openai("gpt-4o");

const response = await generateText({
  model: model,
  tools: {
    ...sumupAgentToolkit.getTools(),
  },
  maxSteps: 5,
  prompt: "Tell me about my last 10 transactions please.",
});

For full example see AI SDK Example.

OpenAI

import { SumUpAgentToolkit } from "@sumup/agent-toolkit/openai";
import OpenAI from "openai";
import type { ChatCompletionMessageParam } from "openai/resources";

const openai = new OpenAI();

const sumupAgentToolkit = new SumUpAgentToolkit({
  apiKey: process.env.SUMUP_API_KEY!,
});

let messages: ChatCompletionMessageParam[] = [
  {
    role: "user",
    content: "Tell me about my last 10 transactions please.",
  },
];

const completion = await openai.chat.completions.create({
  model: "gpt-4o",
  messages,
  tools: sumupAgentToolkit.getTools(),
});

const message = completion.choices[0].message;

messages.push(message);

if (message.tool_calls) {
  const toolMessages = await Promise.all(
    message.tool_calls.map((tc) => sumupAgentToolkit.handleToolCall(tc)),
  );
  messages = [...messages, ...toolMessages];
} else {
  console.log(completion.choices[0].message);
  break;
}

For full example see OpenAI Example.

License

Apache 2.0

FAQs

Package last updated on 28 Apr 2025

Did you know?

Socket

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.

Install

Related posts