Skip to main content

No More Agents - nmagents

Agentic AI without any Agent Frameworks

There is a deluge of Agentic Frameworks. Actually nothing is needed but just a few python wrappers, and thats what this is. Not another framework

Something you can pip install or copy paste and use! And it has elementary token cost and budgetting which none of the Frameworks have !!

What is Agentic AI ?

In the simplest sense, it means using AI in your code. For example I give a file and I use an LLM Model to do a Code Review. Instead of me doing this manually in ChatGPT, if I write a program for this then that is Agentic AI.

Here Agent is a automated program that uses AI for a task.

Why is Model Context Protocol (MCP) needed for Agentic AI ?

MCP is a JSON-RPC based wrapper for API calls. Why ?

Because Generative AI/LLM models can generate the API calls in JSON with parameters,which an Agentic AI program can parse and invoke the actual API.

Example:

Say that I write a program to automate flight ticket booking - an Agentic AI application

User input will be - "Here is a picture of my passport (and credit card). Book me a ticket, economy class to Santiago"

My program will need to translate the above command to an API call with the ticket booking system with the help of LLM.

I need to tell the LLM to formulate the API call as per how the API expects the parameter. The Ticket Booking System MCP server( assume it exists) will give the methods

and JSON structure for booking.

I give this format to the LLM and ask it to parse the Passport and user command and create a JSON request for ticket booking

The LLM/AI will repsont with something similar to below and my program will POST this to the Ticket Booking System MCP server for intiating Ticket booking

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "book_flight_ticket",
    "arguments": {
      "destination": "Santiago (SCL)",
      "travel_class": "economy",
      "passenger_details": {
        "full_name": "John Doe", 
        "passport_number": "A12345678",
        "nationality": "USA",
        "expiry_date": "2030-05-12"
      },
      "travel_date": "2023-11-27" 
    }
  },
  "id": "call_890s7d6f"
}

You will understand while coding MCP the actual deatails

Which Framework to use for Agentic AI ?

You really do not need a framework like LangChain, LangGraph,CrewAI or AutoGen/Microsoft Agent Framework or all the other hunderds of frameworks for using AI logic in your programming.

Calling LLMs via an API is already exposed by OpenAI APIs. This abstraction is more than enough. All that is needed is just some Software Construction Patterns like Command Pattern and Chain of Responsibility

This is a simple Command class wrapper for performing LLM-based automation without using Any frameworks - complex or simple

Just plain MCP and API calls combined with good old-fashioned programming is enough for the most complicated tasks

How to Use

pip install nmagents
from nmagents.command import CallLLM, ToolCall, 

Intailize OpenAI based LLMs (Inlcuding vLLM and ollama models)


from openai import OpenAI

# Initialize OpenAI client with OpenAI's official base URL
MODEL_NAME = "gpt-4.1-nano"
#MODEL_NAME = "gpt-5-nano"
openai_client = OpenAI(
    api_key=api_key,
    base_url="https://api.openai.com/v1"
)

# ollama client
# MODEL_NAME= "phi3.5" 
# openai_client = OpenAI(
#     api_key="sk-local",
#     base_url="http://localhost:11434/v1"
#  )

# vllm client
# MODEL_NAME= "gemma"
# openai_client = OpenAI(
#     api_key="sk-local",
#     base_url="http://localhost:8080/v1"
# )

Call the LLM with the Prompt

call_llm_command = CallLLM(openai_client, "Call the LLM with the given context",
                               MODEL_NAME, COST_PER_TOKEN_INPUT, COST_PER_TOKEN_OUTPUT, 0.5)

context = main_context + f" Here is the file diff for {file_path}:\n{diff} for review\n" + \
        f"You have access to the following MCP tools to help you with your code review: {tool_schemas_content}"
response = call_llm_command.execute(context)

Call the LLM for invoking an MCP Tool

   
async with Client(SOME_MCP_SERVER_URL) as ast_tool_client:

tool_command = ToolCall(
        ast_tool_client, "Call the tool with the given method and params")
 tool_result, succeeded = await tool_command.execute(payload_json)

PyPy Repo link

https://pypi.org/project/nmagents/0.1.0/

Metadata

Release files for nmagents 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nmagents 0.1.1
File Size Uploaded
nmagents-0.1.1.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nmagents 0.1.1
File Interpreter ABI Platform
nmagents-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.2 kB

Release files / nmagents-0.1.1.tar.gz

Download URL nmagents-0.1.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
43e6fa6c3e0bd2dc3de77b4db58433ef0959fba35a126aab2379f47869a87eca
BLAKE2b-256 checksum
How to use checksums
02b79b38afe9c58598410fa015e13d947b7b68c9aaf736ff634892dbe21305fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / nmagents-0.1.1-py3-none-any.whl

Download URL nmagents-0.1.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b041d596d044c648fac843165fd4c5e22b55d775d23a0324984f407dc78d29f5
BLAKE2b-256 checksum
How to use checksums
a9edea01a5197ee4d30be4d6b869c74b749f8b822b94ecf000e0a14c10357062
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page