Skip to main content

Overview

Integrate ATP with Flask to expose your tools as HTTP endpoints in a lightweight, flexible way.

Installation


Setup

Step 1: Create ATP Tools Module

Create a module to register your toolkits and tools (e.g., atp_tools.py):

Step 2: Create Flask App

Create your Flask app and import the ATP tools module:

Step 3: Run the App

Run your Flask app:
Your API will be available at http://localhost:5000.

Usage

Endpoints

  • GET /atp/<toolkit_name>/ - Get toolkit details and list of tools
  • GET /atp/<toolkit_name>/<tool_name>/ - Get tool context/schema
  • POST /atp/<toolkit_name>/<tool_name>/ - Execute a tool with parameters

Example Requests

Get Toolkit Details

Response:

Get Tool Context

Response:

Execute Tool

Response:

Complete Example

Here’s a complete example with multiple tools:

Advanced Usage

Using Flask Blueprints

Organize your ATP endpoints using Flask Blueprints:

Error Handling

Add custom error handlers:

CORS Support

Enable CORS for cross-origin requests:

Authentication

Add authentication middleware:

Using Flask-SQLAlchemy

Integrate with databases using Flask-SQLAlchemy:

Production Deployment

Using Gunicorn

For production, use Gunicorn instead of Flask’s development server:

Using uWSGI

Alternatively, use uWSGI:

Next Steps

ToolKitClient

Learn more about ToolKitClient

OAuth2 Guide

Set up OAuth2 authentication

Django Integration

Try ATP with Django

Examples

Explore more examples