> ## Documentation Index
> Fetch the complete documentation index at: https://docs.y.uno/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Agent Toolkit

> Crie experiências de pagamento com IA usando o toolkit multi-framework da Yuno.

O Agent Toolkit da Yuno permite que agentes de IA interajam com a plataforma de orquestração de pagamentos da Yuno por meio de function calling. Feito para TypeScript, ele se conecta ao servidor MCP remoto da Yuno e expõe ferramentas de pagamento que funcionam em cinco frameworks de IA: use uma única integração para acessar mais de 300 provedores de pagamento no mundo todo.

## O que está incluído

O Yuno Agent Toolkit está disponível como um pacote npm (`@yuno-payments/agent-toolkit`) e oferece:

* **Integrações com frameworks**: Vercel AI SDK, Google Genkit, LangChain, OpenAI Chat e OpenAI Agents SDK. Importe apenas o adaptador de que você precisa.
* **Orquestração multiprovedor**: acesse mais de 300 provedores de pagamento no mundo todo por meio de uma única integração. Seu agente de IA herda o roteamento inteligente da Yuno, o failover entre vários provedores e os meios de pagamento específicos de cada mercado.
* **Tipagem segura**: TypeScript completo, com tipos abrangentes e schemas validados com Zod.
* **Modular**: importe apenas as categorias de ferramentas de que você precisa (clientes, pagamentos, assinaturas etc.) e filtre as ações de forma granular.

## Início rápido

### Instalação

```bash theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
npm install @yuno-payments/agent-toolkit
```

### Requisitos

* **Node.js**: versão 18 ou superior.
* **Conta Yuno**: uma [conta Yuno](https://y.uno/) com credenciais de API.

### Credenciais

Obtenha suas credenciais de API no [Dashboard da Yuno](https://dashboard.y.uno/) e defina-as como variáveis de ambiente:

```bash theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
YUNO_ACCOUNT_CODE=your_account_code
YUNO_PUBLIC_API_KEY=your_public_api_key
YUNO_PRIVATE_SECRET_KEY=your_private_secret_key
```

## Frameworks de IA compatíveis

O toolkit oferece adaptadores específicos para os principais frameworks de IA. Escolha o que se encaixa na sua stack:

> [tab] Vercel AI SDK
>
> Importe o adaptador usando `@yuno-payments/agent-toolkit/ai-sdk`.
>
> ```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import { generateText } from "ai";
> import { openai } from "@ai-sdk/openai";
> import { createYunoAgentToolkit } from "@yuno-payments/agent-toolkit/ai-sdk";
>
> const toolkit = await createYunoAgentToolkit({
>   accountCode: process.env.YUNO_ACCOUNT_CODE!,
>   publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
>   privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
> });
>
> const { text } = await generateText({
>   model: openai("gpt-4o"),
>   tools: toolkit.getTools(),
>   prompt: "Create a customer named Maria Garcia with email maria@example.com",
> });
>
> await toolkit.close();
> ```

> [tab] Google Genkit
>
> Importe o adaptador usando `@yuno-payments/agent-toolkit/genkit`.
>
> ```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import { genkit, z } from "genkit";
> import { googleAI, gemini15Pro } from "@genkit-ai/googleai";
> import { createYunoGenkitToolkit } from "@yuno-payments/agent-toolkit/genkit";
>
> const ai = genkit({ plugins: [googleAI()] });
>
> const toolkit = await createYunoGenkitToolkit({
>   accountCode: process.env.YUNO_ACCOUNT_CODE!,
>   publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
>   privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
>   ai,
> });
>
> const agent = ai.definePrompt({
>   name: "paymentAgent",
>   model: gemini15Pro,
>   tools: toolkit.getToolsArray(),
>   input: { schema: z.object({ query: z.string() }) },
> });
>
> const result = await agent({ query: "Create a customer named Jane Smith" });
> await toolkit.close();
> ```

> [tab] LangChain
>
> Importe o adaptador usando `@yuno-payments/agent-toolkit/langchain`.
>
> ```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import { YunoLangChainToolkit } from "@yuno-payments/agent-toolkit/langchain";
>
> const toolkit = await YunoLangChainToolkit.create({
>   accountCode: process.env.YUNO_ACCOUNT_CODE!,
>   publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
>   privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
> });
>
> const tools = toolkit.getTools();
> // Use with LangChain agents...
>
> await toolkit.close();
> ```

> [tab] OpenAI Chat
>
> Importe o adaptador usando `@yuno-payments/agent-toolkit/openai`.
>
> ```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import OpenAI from "openai";
> import { createYunoOpenAIToolkit } from "@yuno-payments/agent-toolkit/openai";
>
> const toolkit = await createYunoOpenAIToolkit({
>   accountCode: process.env.YUNO_ACCOUNT_CODE!,
>   publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
>   privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
> });
>
> const client = new OpenAI();
> const response = await client.chat.completions.create({
>   model: "gpt-4o",
>   tools: toolkit.getTools(),
>   messages: [{ role: "user", content: "Create a payment link for $50 USD" }],
> });
>
> for (const toolCall of response.choices[0].message.tool_calls ?? []) {
>   const result = await toolkit.handleToolCall(
>     toolCall.function.name,
>     toolCall.function.arguments,
>   );
> }
>
> await toolkit.close();
> ```

> [tab] OpenAI Agents SDK
>
> Importe o adaptador usando `@yuno-payments/agent-toolkit/openai-agents`.
>
> ```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import { Agent, run } from "@openai/agents";
> import { createYunoOpenAIAgentsToolkit } from "@yuno-payments/agent-toolkit/openai-agents";
>
> const toolkit = await createYunoOpenAIAgentsToolkit({
>   accountCode: process.env.YUNO_ACCOUNT_CODE!,
>   publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
>   privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
> });
>
> const agent = new Agent({
>   name: "Yuno Payment Agent",
>   instructions: "You are a payment assistant powered by Yuno.",
>   tools: toolkit.getTools(),
> });
>
> const result = await run(agent, "Create a customer named Maria Garcia");
> await toolkit.close();
> ```

## Configuração

### Filtragem de ações

Você pode controlar de forma granular quais ferramentas ficam disponíveis para o agente:

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const toolkit = await createYunoAgentToolkit({
  // ...credentials
  actions: {
    customers: { create: true, retrieve: true },
    payments: { retrieve: true, refund: true },
  },
});
```

Para ativar todas as ferramentas disponíveis, você pode usar a constante `ALL_TOOLS_ENABLED`:

```typescript theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import { ALL_TOOLS_ENABLED } from "@yuno-payments/agent-toolkit/ai-sdk";

const toolkit = await createYunoAgentToolkit({
  // ...credentials
  actions: ALL_TOOLS_ENABLED,
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.