Skip to main content

Build an API-Powered Assistant

This project teaches you how to connect your AI agent to any REST API, enabling it to create, read, update, and delete data through natural conversation. Think of it as giving your AI agent hands to interact with the digital world.

What You'll Build​

An API assistant that:

  • Connects to any REST API
  • Performs CRUD operations (Create, Read, Update, Delete) via natural language
  • Understands API schemas and generates correct request bodies
  • Handles errors gracefully

Approach 1: Individual Request Tools​

Best for simple APIs with a few endpoints.

Step 1: Create the Flow​

  1. Create a new Agentflow named "API Assistant"
  2. Start node: Chat Input

Step 2: Add Request Tools to the Agent​

In the Agent node, add these tools:

GET Tool (for reading data):

  • URL: http://your-api.com/items
  • Name: get_items
  • Description: "Use this to retrieve items or get item details"
  • Query Params Schema:
{
"id": { "type": "string", "in": "path", "description": "Item ID. Use /:id" }
}

POST Tool (for creating data):

  • URL: http://your-api.com/items
  • Name: create_item
  • Description: "Use this to create a new item"
  • Body Schema:
{
"name": { "type": "string", "required": true, "description": "Item name" },
"price": { "type": "number", "required": true, "description": "Item price" }
}

DELETE Tool (for removing data):

  • URL: http://your-api.com/items
  • Name: delete_item
  • Description: "Use this to delete an item"
  • Query Params Schema:
{
"id": { "type": "string", "required": true, "in": "path", "description": "Item ID to delete. /:id" }
}

Best for APIs with many endpoints. Upload one YAML file and get all endpoints as tools automatically.

Step 1: Get or Create an OpenAPI Spec​

If your API has a Swagger/OpenAPI specification (most modern APIs do), download the YAML file. If not, you can create one β€” here's a minimal example:

openapi: 3.0.0
info:
title: My API
version: 1.0.0
servers:
- url: http://localhost:5566
paths:
/items:
get:
summary: List all items
operationId: listItems
responses:
'200':
description: A list of items
post:
summary: Create an item
operationId: createItem
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
price:
type: number
required: [name, price]

Step 2: Add OpenAPI Toolkit to Agent​

  1. In the Agent node, add the OpenAPI Toolkit tool
  2. Upload your YAML file
  3. CiniterFlow automatically creates a tool for every endpoint

Testing​

Try natural language commands:

  • "Show me all items" β†’ GET /items
  • "Create a new item called 'Widget' priced at $29.99" β†’ POST /items
  • "Delete item with ID 5" β†’ DELETE /items/5
  • "Update the price of 'Widget' to $24.99" β†’ PATCH /items/:id

Approach 3: Sequential API Calls with HTTP Nodes​

For workflows where you need to call APIs in a specific order (not decided by the AI).

Use HTTP nodes in your Agentflow to make deterministic API calls at specific points:

Start β†’ HTTP (GET customer list) β†’ Agent (analyze customers) β†’ HTTP (POST report)

Tips​

  • Include {{ current_date_time }} in your prompt so the AI can handle time-relative queries ("events today")
  • Use Require Human Input for destructive operations (DELETE, UPDATE)
  • Handle authentication by adding headers in the tool configuration or using HTTP credentials
  • Test each endpoint individually before combining them in a complex flow