Skip to main content
0
N

Npi

Action library for AI Agent

Rating

0.0

Votes

0

score

Downloads

0

total

Price

Free

API key required

Works With

Claude CodeCursorWindsurfVS CodeDeveloper tool

About

NPI

[!WARNING] NPi is currently under active development and the APIs are subject to change in the future release. It is recommended to use the command line tool to try it out.

NPi is an open-source platform providing _Tool-use_ APIs to empower AI agents with the ability to take action in virtual world!

🛠️Try NPi Online: Try NPi on online Playground (🚧Under Construction).

👀 NPi Example: Highly recommended to check this first - See what you can build with NPi.

🔥 Introducing NPi: Why we build NPi?

📚 NPi Documentation: How to use NPi?

📢 Join our community on Discord: Let's build NPi together 👻 !

NPi (Natural-language Programming Interface), pronounced as "N π", is an open-source platform providing _Tool-use_ APIs to empower AI agents with the ability to operate and interact with a diverse array of software tools and applications.

Installation

sh
pip install npiai

One-Minute Quick Start

Let's create a new tool to compute the nth Fibonacci number. Start by crafting a new Python file titled main.py and insert the following snippet:

py filename="main.py" showLineNumbers {9,12-13,19-22,33,44,51}
import os
import json
import asyncio

from openai import OpenAI
from npiai import FunctionTool, function


class MyTool(FunctionTool):
    name = 'Fibonacci'
    description = 'My first NPi tool'

    @function
    def fibonacci(self, n: int) -> int:
        """
        Get the nth Fibonacci number.

        Args:
            n: The index of the Fibonacci number in the sequence.
        """
        if n == 0:
            return 0
        if n == 1:
            return 1
        return self.fibonacci(n - 1) + self.fibonacci(n - 2)


async def main():
    async with MyTool() as tool:
        print(f'The schema of the tool is\n\n {json.dumps(tool.tools, indent=2)}')
        client = OpenAI(api_key=os.getenv('OPENAI_API_KEY'))
        messages = [
            {
                "role": "user",
                "content": "What's the 10-th fibonacci number?",
            }
        ]
        response = client.chat.completions.create(
            model="gpt-4o",
            messages=messages,
            tools=tool.tools,  # use tool as functions package
            tool_choice="auto",
            max_tokens=4096,
        )
        response_message = response.choices[0].message
        if response_message.tool_calls:
            result = await tool.call(tool_calls=response_message.tool_calls)
            print(f'The result of function\n\n {json.dumps(result, indent=2)}')


if __name__ == "__main__":
    asyncio.run(main())

Now, run the tool:

sh
python main.py

You will see the function result in OpenAI function calling format:

Don't lose this

Three weeks from now, you'll want Npi again. Will you remember where to find it?

Save it to your library and the next time you need Npi, it’s one tap away — from any AI app you use. Group it into a bench with the rest of the team for that kind of task and you can pull the whole stack at once.

⚡ Pro tip for geeks: add a-gnt 🤵🏻‍♂️ as a custom connector in Claude or a custom GPT in ChatGPT — one click and your library is right there in the chat. Or, if you’re in an editor, install the a-gnt MCP server and say “use my [bench name]” in Claude Code, Cursor, VS Code, or Windsurf.

🤵🏻‍♂️

a-gnt's Take

Our honest review

Action library for AI Agent. Best for anyone looking to make their AI assistant more capable in search & web. It's completely free and works across most major AI apps. This one just landed in the catalog — worth trying while it's fresh.

Tips for getting started

1

Tap "Get" above, pick your AI app, and follow the steps. Most installs take under 30 seconds.

2

Heads up: this needs an API key to work. You'll get one from the service's website (usually free). The setup guide tells you exactly where.

What's New

Version 1.0.06 days ago

Imported from GitHub

Ratings & Reviews

0.0

out of 5

0 ratings

No reviews yet. Be the first to share your experience.