• Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy
Sunday, January 11, 2026
newsaiworld
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us
No Result
View All Result
Morning News
No Result
View All Result
Home Artificial Intelligence

Construct LLM Brokers Sooner with Datapizza AI

Admin by Admin
November 3, 2025
in Artificial Intelligence
0
Image 413.jpg
0
SHARES
2
VIEWS
Share on FacebookShare on Twitter

READ ALSO

Mastering Non-Linear Information: A Information to Scikit-Study’s SplineTransformer

Federated Studying, Half 1: The Fundamentals of Coaching Fashions The place the Information Lives


Organizations are more and more investing in AI as these new instruments are adopted in on a regular basis operations increasingly more. This steady wave of innovation is fueling the demand for extra environment friendly and dependable frameworks. Following this pattern, Datapizza (the startup behind Italy’s tech neighborhood) simply launched an open-source framework for GenAI with Python, known as Datapizza AI.

When creating LLM-powered Brokers, it is advisable choose an AI stack:

  • Language Mannequin – the mind of the Agent. The primary wide selection is open-source (i.e. Llama, DeepSeek, Phi) vs paid (i.e. ChatGPT, Claude, Gemini). Then, based mostly on the usecase, one wants to contemplate the LLM data: generic (is aware of a little bit little bit of every little thing like Wikipedia) vs topic-specific (i.e. fine-tuned for coding or finance).
  • LLM Engine – it’s what runs the language mannequin, responding to prompts, inferring that means, and creating textual content. Principally, it generates intelligence. Probably the most used are OpenAI (ChatGPT), Anthropic (Claude), Google (Gemini), and Ollama (runs open-source fashions regionally).
  • AI Framework – it’s the orchestration layer to construct and handle workflows. To place it in one other approach, the framework should construction the intelligence created by LLMs. In the intervening time, the panorama is dominated by LangChain, LLamaIndex, and CrewAI. The brand new library Datapizza AI falls on this class and needs to be a substitute for the opposite essential frameworks.

On this article, I’m going to point out the way to use the brand new Datapizza framework for constructing LLM-powered AI Brokers. I’ll current some helpful Python code that may be simply utilized in different comparable instances (simply copy, paste, run) and stroll by way of each line of code with feedback as a way to replicate this instance.

Setup

I’ll use Ollama because the LLM engine, as a result of I wish to host fashions regionally on my pc. That’s the usual observe for all firms with delicate knowledge. Protecting every little thing native offers full management over knowledge privateness, mannequin conduct, and price.

To begin with, it is advisable obtain Ollama from the web site. Then, choose a mannequin and run the command indicated on the web page to tug the LLM. I’m going with Alibaba’s Qwen, because it’s each good and lite (ollama run qwen3).

Datapizza AI helps all the primary LLM engines. We are able to full the setup by operating the next instructions:

pip set up datapizza-ai
pip set up datapizza-ai-clients-openai-like

As indicated within the official documentation, we will shortly take a look at our AI stack by calling the mannequin with a easy immediate and asking a query. The article OpenAILikeClient() is the way you connect with the Ollama API, which is often hosted on the identical localhost URL.

from datapizza.purchasers.openai_like import OpenAILikeClient

llm = "qwen3"

immediate = '''
You're an clever assistant, present the very best reply to consumer's request. 
''' 

ollama = OpenAILikeClient(api_key="", mannequin=llm, system_prompt=immediate, base_url="http://localhost:11434/v1")

q = '''
what time is it?
'''

llm_res = ollama.invoke(q)
print(llm_res.textual content)

Chatbot

One other solution to take a look at the potential of the LLM is to construct a easy Chatbot and do some dialog. To take action, at each interplay, we have to retailer the chat historical past and feed it again to the mannequin, specifying what was mentioned by whom. The Datapizza framework already has a built-in reminiscence system.

from datapizza.reminiscence import Reminiscence
from datapizza.sort import TextBlock, ROLE

reminiscence = Reminiscence()
reminiscence.add_turn(TextBlock(content material=immediate), function=ROLE.SYSTEM)

whereas True:
    ## Consumer
    q = enter('🙂 >')
    if q == "stop":
        break
    
    ## LLM
    llm_res = ollama.invoke(q, reminiscence=reminiscence)
    res = llm_res.textual content
    print("🍕 >", f"x1b[1;30m{res}x1b[0m")

    ## Update Memory
    memory.add_turn(TextBlock(content=q), role=ROLE.USER)
    memory.add_turn(TextBlock(content=res), role=ROLE.ASSISTANT)

If you want to retrieve the chat history, you can just access the memory. Usually, AI frameworks use three roles in the interaction with an LLM: “system” (core instructions), “user” (what was said by the human), “assistant” (what the chatbot replied).

memory.to_dict()

Obviously, the LLM alone is very limited and it can’t do much besides chatting. Therefore, we need to give it the possibility to take action, or in other words, to activate Tools.

Tools

Tools are the main difference between a simple LLM and an AI Agent. When the user requests something that goes beyond the LLM knowledge base (i.e. “what time is it now?“), the Agent should understand that it doesn’t know the answer, activate a Tool to get additional information (i.e. checking the clock), elaborate the result through the LLM, and generate an answer.

The Datapizza framework allows you to create Tools from scratch very easily. You just need to import the decorator @tool and any function can become actionable for the Agent.

from datapizza.tools import tool

@tool
def get_time() -> str:
    '''Get the current time.'''
    from datetime import datetime
    return datetime.now().strftime("%H:%M")

get_time()

Then, assign the designated Tool to the Agent, and you’ll have an AI that combines language understanding + autonomy decision making + tool use.

from datapizza.agents import Agent
import os

os.environ["DATAPIZZA_AGENT_LOG_LEVEL"] = "DEBUG"  #max logging

agent = Agent(title="single-agent", consumer=ollama, system_prompt=immediate, 
              instruments=[get_time], max_steps=2)

q = '''
what time is it?
'''

agent_res = agent.run(q)

An LLM-powered AI Agent is an clever system constructed round a language mannequin that doesn’t simply reply, nevertheless it causes, decides, and acts. In addition to dialog (which suggests chatting with a general-purpose data base), the most typical actions that Brokers can do are RAG (chatting together with your paperwork), Querying (chatting with a database), Internet Search (chatting with the entire Web).

As an example, let’s attempt an online looking Device. In Python, the best solution to do it’s with the well-known personal browser DuckDuckGo. You’ll be able to immediately use the authentic library or the Datapizza framework wrapper (pip set up datapizza-ai-tools-duckduckgo).

from datapizza.instruments.duckduckgo import DuckDuckGoSearchTool

DuckDuckGoSearchTool().search(question="powell")

Let’s create an Agent that may search the online for us. If you wish to make it extra interactive, you may construction the AI like I did for the Chatbot.

os.environ["DATAPIZZA_AGENT_LOG_LEVEL"] = "ERROR" #flip off logging

immediate = '''
You're a journalist. You need to make assumptions, use your software to analysis, make a guess, and formulate a remaining reply.
The ultimate reply should include info, dates, evidences to help your guess.
'''

reminiscence = Reminiscence()

agent = Agent(title="single-agent", consumer=ollama, system_prompt=immediate, 
              instruments=[DuckDuckGoSearchTool()], 
              reminiscence=reminiscence, max_steps=2)

whereas True:
    ## Consumer
    q = enter('🙂 >')
    if q == "stop":
        break
    
    ## Agent
    agent_res = agent.run(q)
    res = agent_res.textual content
    print("🍕 >", f"x1b[1;30m{res}x1b[0m")

    ## Update Memory
    memory.add_turn(TextBlock(content=q), role=ROLE.USER)
    memory.add_turn(TextBlock(content=res), role=ROLE.ASSISTANT)

Multi-Agent System

The real strength of Agents is the ability to collaborate with each other, just like humans do. These teams are called Multi-Agent Systems (MAS), a group of AI Agents that work together in a shared environment to solve complex problems that are too difficult for a single one to handle alone.

This time, let’s create a more advanced Tool: code execution. Please note that LLMs know how to code by being exposed to a large corpus of both code and natural language text, where they learn patterns, syntax, and semantics of programming languages. But since they can not complete any real action, the code they create is just text. In short, LLMs can generate Python code but can’t execute it, Agents can.

import io
import contextlib

@tool
def code_exec(code:str) -> str:
    '''Execute python code. Use always the function print() to get the output'''
    output = io.StringIO()
    with contextlib.redirect_stdout(output):
        try:
            exec(code)
        except Exception as e:
            print(f"Error: {e}")
    return output.getvalue()

code_exec("from datetime import datetime; print(datetime.now().strftime('%H:%M'))")

There are two types of MAS: the sequential process ensures tasks are executed one after the other, following a linear progression. On the other hand, the hierarchical structure simulates traditional organizational hierarchies for efficient task delegation and execution. Personally, I tend to prefer the latter as there is more parallelism and flexibility.

With the Datapizza framework, you can link two or more Agents with the function can_call(). In this way, one Agent can pass the current task to another Agent.

prompt_senior = '''
You are a senior Python coder. You check the code generated by the Junior, 
and use your tool to execute the code only if it's correct and safe.
'''
agent_senior = Agent(name="agent-senior", client=ollama, system_prompt=prompt_senior, 
                     tools=[code_exec])

prompt_junior = '''
You're a junior Python coder. You'll be able to generate code however you may't execute it. 
You obtain a request from the Supervisor, and your remaining output should be Python code to go on.
If you do not know some particular instructions, you need to use your software and search the online for "the way to ... with python?".
'''
agent_junior = Agent(title="agent-junior", consumer=ollama, system_prompt=prompt_junior, 
                     instruments=[DuckDuckGoSearchTool()])
agent_junior.can_call([agent_senior])

prompt_manager = '''
You recognize nothing, you are only a supervisor. After you get a request from the consumer, 
first you ask the Junior to generate the code, you then ask the Senior to execute it.
'''
agent_manager = Agent(title="agent-manager", consumer=ollama, system_prompt=prompt_manager, 
                      instruments=[])
agent_manager.can_call([agent_junior, agent_senior])

q = '''
Plot the Titanic dataframe. You will discover the info right here: 
https://uncooked.githubusercontent.com/mdipietro09/DataScience_ArtificialIntelligence_Utils/grasp/machine_learning/data_titanic.csv
'''

agent_res = agent_manager.run(q)
#print(agent_res.textual content)

Conclusion

This text has been a tutorial to introduce Datapizza AI, a model new framework to construct LLM-powered Chatbots and AI Brokers. The library may be very versatile and user-friendly, and may cowl completely different GenAI usecases. I used it with Ollama, however it may be linked with all of the well-known engines, like OpenAI.

Full code for this text: GitHub

I hope you loved it! Be happy to contact me for questions and suggestions or simply to share your attention-grabbing tasks.

👉 Let’s Join 👈

(All photos are by the writer until in any other case famous)

Tags: AgentsBuildDatapizzaFasterLLM

Related Posts

Splinetransformer gemini.jpg
Artificial Intelligence

Mastering Non-Linear Information: A Information to Scikit-Study’s SplineTransformer

January 11, 2026
Untitled diagram 17.jpg
Artificial Intelligence

Federated Studying, Half 1: The Fundamentals of Coaching Fashions The place the Information Lives

January 10, 2026
Julia taubitz kjnkrmjr0pk unsplash scaled 1.jpg
Artificial Intelligence

Information Science Highlight: Chosen Issues from Introduction of Code 2025

January 10, 2026
Mario verduzco brezdfrgvfu unsplash.jpg
Artificial Intelligence

TDS E-newsletter: December Should-Reads on GraphRAG, Knowledge Contracts, and Extra

January 9, 2026
Gemini generated image 4biz2t4biz2t4biz.jpg
Artificial Intelligence

Retrieval for Time-Sequence: How Trying Again Improves Forecasts

January 8, 2026
Title 1.jpg
Artificial Intelligence

HNSW at Scale: Why Your RAG System Will get Worse because the Vector Database Grows

January 8, 2026
Next Post
Moneygram20western20union id 0924d673 30bb 44a8 a423 8e1d71031a76 size900.jpg

Western Union Hints at Crypto Service with Trademark Submitting Amid Stablecoin Launch

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

POPULAR NEWS

Chainlink Link And Cardano Ada Dominate The Crypto Coin Development Chart.jpg

Chainlink’s Run to $20 Beneficial properties Steam Amid LINK Taking the Helm because the High Creating DeFi Challenge ⋆ ZyCrypto

May 17, 2025
Image 100 1024x683.png

Easy methods to Use LLMs for Highly effective Computerized Evaluations

August 13, 2025
Gemini 2.0 Fash Vs Gpt 4o.webp.webp

Gemini 2.0 Flash vs GPT 4o: Which is Higher?

January 19, 2025
Blog.png

XMN is accessible for buying and selling!

October 10, 2025
0 3.png

College endowments be a part of crypto rush, boosting meme cash like Meme Index

February 10, 2025

EDITOR'S PICK

Bitcoin Etf Gold.jpg

Bitcoin ETFs on observe to overhaul gold ETFs inside 2 months

November 12, 2024
4 Yz2vkgl.jpg

3 Arms-On Experiments with OpenAI’s o1 You Must See

September 14, 2024
What Is Mern Stack Everything You Need To Know.png

What’s MERN Stack: All the pieces You Have to Know?

January 17, 2025
Intro image.png

Lowering Time to Worth for Information Science Tasks: Half 2

June 4, 2025

About Us

Welcome to News AI World, your go-to source for the latest in artificial intelligence news and developments. Our mission is to deliver comprehensive and insightful coverage of the rapidly evolving AI landscape, keeping you informed about breakthroughs, trends, and the transformative impact of AI technologies across industries.

Categories

  • Artificial Intelligence
  • ChatGPT
  • Crypto Coins
  • Data Science
  • Machine Learning

Recent Posts

  • Mastering Non-Linear Information: A Information to Scikit-Study’s SplineTransformer
  • Bitcoin Community Mining Problem Falls in Jan 2026
  • Past the Flat Desk: Constructing an Enterprise-Grade Monetary Mannequin in Energy BI
  • Home
  • About Us
  • Contact Us
  • Disclaimer
  • Privacy Policy

© 2024 Newsaiworld.com. All rights reserved.

No Result
View All Result
  • Home
  • Artificial Intelligence
  • ChatGPT
  • Data Science
  • Machine Learning
  • Crypto Coins
  • Contact Us

© 2024 Newsaiworld.com. All rights reserved.

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?