Skip to main content

A professional and scalable Flask-based Agent Framework with blockchain-like token management.

Project description

🚀 PIT Agent Framework

PyPI Version GitHub stars Twitter Follow

Welcome to the PITAGENT Framework — a powerful system for creating and managing Programmable Intelligent Tokens (PITs) on a blockchain! 🌐

This framework allows developers to build and manage programmable tokens that contain specific logic, allowing for flexible and customizable interactions within decentralized applications (dApps) and ecosystems. PIT tokens can be used in a variety of use cases, from finance to gaming, offering secure and intelligent token management.

Features ✨

  • Agent Management: Easily create and manage agents (users) with their associated tokens.
  • Programmable Tokens: Tokens can carry conditions such as time-locks, amounts, or custom logic that must be met before they can be transferred or used.
  • Blockchain Integration: Interaction with the blockchain (Solana, Ethereum, etc.) for secure and tamper-proof token storage and transactions.
  • Token Conditions: Programmable logic that defines how tokens can be transferred or used.
  • RESTful API: Comprehensive API to create agents, mint tokens, transfer tokens, and validate conditions.

Technologies Used 🛠️

  • Flask: Lightweight web framework for Python.
  • SQLAlchemy: ORM (Object-Relational Mapper) for working with databases.
  • Solana (or Ethereum): Blockchain for token management (Solana in this example).
  • Python 3.8+: Programming language for backend logic.

Quick Start 🚀

Prerequisites 📋

  • Python 3.8+ installed.
  • Flask and other Python libraries.

Installation 🛠️

  1. Clone the repository:

    git clone https://github.com/yourusername/pitagents.git
    cd pitagents
    
  2. Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Run the application:

    python app.py
    

    The Flask server will start at http://127.0.0.1:5000/.

Usage 📚

You can interact with the API using tools like curl, Postman, or any HTTP client of your choice. Below are examples of the API endpoints:

API Endpoints 📡

1. Create an Agent

  • Endpoint: /api/agents/create
  • Method: POST
  • Body:
    {
      "agent_id": "agent_1"
    }
    
  • Response:
    {
      "message": "Agent agent_1 created successfully."
    }
    

2. Mint a Token for an Agent

  • Endpoint: /api/tokens/mint
  • Method: POST
  • Body:
    {
      "agent_id": "agent_1",
      "token_data": {
        "amount": 100,
        "purpose": "Utility token",
        "condition": "time_lock"
      }
    }
    
  • Response:
    {
      "message": "Token minted successfully",
      "token": {
        "token_id": "TKN_1627568937",
        "amount": 100,
        "purpose": "Utility token",
        "condition": "time_lock"
      }
    }
    

3. Transfer a Token

  • Endpoint: /api/tokens/transfer
  • Method: POST
  • Body:
    {
      "from_agent_id": "agent_1",
      "to_agent_id": "agent_2",
      "amount": 50
    }
    
  • Response:
    {
      "message": "Token transferred successfully",
      "transfer": {
        "from": "agent_1",
        "to": "agent_2",
        "amount": 50
      }
    }
    

4. Validate Token Conditions

  • Endpoint: /api/tokens/validate
  • Method: POST
  • Body:
    {
      "token_id": "TKN_1627568937"
    }
    
  • Response:
    {
      "is_valid": true
    }
    

Project Structure 📂

PIT_Framework/
├── app.py               # Main Flask API to interact with the framework
├── pit_token_logic.py   # Logic for minting, transferring tokens and applying conditions
├── solana_service.py    # Interactions with the Solana blockchain
├── models.py            # SQLAlchemy models for Agents and PIT Tokens
├── requirements.txt     # List of project dependencies
└── README.md            # Project documentation (you're here)

Contributing 🤝

We welcome contributions! Feel free to fork the project, make changes, and submit a pull request. Here's how you can contribute:

  1. Fork the repo
  2. Create a new branch for your feature or fix:
    git checkout -b feature/YourFeature
  3. Commit your changes:
    git commit -m 'Add new feature'
  4. Push your branch:
    git push origin feature/YourFeature
  5. Create a Pull Request: Open a PR on GitHub.

License 📄

This project is licensed under the MIT License. See the LICENSE file for more details.

Contact 📧


Acknowledgements 🎉

  • Inspired by the need for scalable and programmable token systems.
  • Built with love using Flask, Solana, and SQLAlchemy.
  • Special thanks to the blockchain community for their constant innovation.

Happy coding! ✨

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pitagentsai-1.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pitagentsai-1.1.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pitagentsai-1.1.0.tar.gz.

File metadata

  • Download URL: pitagentsai-1.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pitagentsai-1.1.0.tar.gz
Algorithm Hash digest
SHA256 990b682a3c6015bf3960b74a31a25d66d9a399176eade57d04088ceb46bdef61
MD5 6bf759cc2cc0cb4c0079952e7bb181c4
BLAKE2b-256 3d3c6569a67cf5c6c2ff72196a8c132e8e23899c20d76278684b3a44760695e8

See more details on using hashes here.

File details

Details for the file pitagentsai-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pitagentsai-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pitagentsai-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a8c068a80a9cec363c0b10f7debf89045d123dd41773730a8499188bef45169
MD5 82b460b25d476b5b7390ccce743a780b
BLAKE2b-256 86484bb7428d5d4b87c47a6b211535a55ae70cfaf5de077d104ff577025c2978

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page