• bitcoinBitcoin(BTC)$80,738.00-0.31%
  • ethereumEthereum(ETH)$2,326.44-1.18%
  • tetherTether(USDT)$1.00-0.03%
  • binancecoinBNB(BNB)$743.44-0.96%
  • rippleXRP(XRP)$1.28-3.32%
  • usd-coinUSDC(USDC)$1.00-0.01%
  • solanaSolana(SOL)$100.29-1.67%
  • tronTRON(TRX)$0.3310960.42%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.062.52%
  • HyperliquidHyperliquid(HYPE)$94.3716.79%
  • zcashZcash(ZEC)$1,318.802.48%
  • dogecoinDogecoin(DOGE)$0.079087-0.58%
  • moneroMonero(XMR)$600.970.32%
  • USDSUSDS(USDS)$1.00-0.02%
  • whitebitWhiteBIT Coin(WBT)$77.39-0.50%
  • chainlinkChainlink(LINK)$11.64-0.55%
  • leo-tokenLEO Token(LEO)$9.460.41%
  • cardanoCardano(ADA)$0.201558-1.37%
  • stellarStellar(XLM)$0.169114-1.39%
  • bitcoin-cashBitcoin Cash(BCH)$287.430.73%
  • nearNEAR Protocol(NEAR)$4.39-6.64%
  • RainRain(RAIN)$0.006433-8.55%
  • daiDai(DAI)$1.000.00%
  • Ethena USDeEthena USDe(USDE)$1.00-0.04%
  • litecoinLitecoin(LTC)$57.55-2.14%
  • uniswapUniswap(UNI)$7.16-0.54%
  • CantonCanton(CC)$0.1004170.10%
  • avalanche-2Avalanche(AVAX)$8.80-1.38%
  • USD1USD1(USD1)$1.00-0.04%
  • suiSui(SUI)$0.93-1.15%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.21-2.78%
  • tether-goldTether Gold(XAUT)$4,008.46-0.76%
  • hedera-hashgraphHedera(HBAR)$0.072825-3.51%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • BittensorBittensor(TAO)$251.86-1.88%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.02%
  • shiba-inuShiba Inu(SHIB)$0.000005-0.63%
  • EthenaEthena(ENA)$0.2082782.44%
  • quant-networkQuant(QNT)$190.63-3.71%
  • crypto-com-chainCronos(CRO)$0.052862-1.03%
  • Ripple USDRipple USD(RLUSD)$1.00-0.01%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.06%
  • okbOKB(OKB)$113.031.88%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • MemeCoreMemeCore(M)$1.03-0.40%
  • pepePepe(PEPE)$0.0000058.65%
  • BitwayBitway(BTW)$1.47-14.00%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • aaveAave(AAVE)$133.22-1.30%
  • Pump.funPump.fun(PUMP)$0.0044110.72%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

Build a Modular Skill-Based Agent System for LLMs with Dynamic Tool Routing in Python

May 5, 2026
in AI & Technology
Reading Time: 2 mins read
A A
Build a Modular Skill-Based Agent System for LLMs with Dynamic Tool Routing in Python
ShareShareShareShareShare
class CalculatorSkill(Skill):
   def _define_metadata(self):
       return SkillMetadata(
           name="calculator",
           description="Evaluate mathematical expressions. Supports arithmetic, powers, and "
                       "math functions: sqrt, abs, round, log, sin, cos, tan.",
           category=SkillCategory.REASONING,
           tags=["math", "arithmetic", "compute"],
           output_type="text", cost_estimate=0.0,
       )


   def _define_schema(self):
       return {"type": "object",
               "properties": {"expression": {"type": "string",
                   "description": "A Python math expression e.g. '2**10 + sqrt(144)'"}},
               "required": ["expression"]}


   def execute(self, expression: str) -> str:
       import math
       safe = {"__builtins__": {}, "sqrt": math.sqrt, "abs": abs, "round": round,
               "pow": pow, "log": math.log, "pi": math.pi, "e": math.e,
               "sin": math.sin, "cos": math.cos, "tan": math.tan}
       try:
           return f"Result: {eval(expression, safe)}"
       except Exception as ex:
           return f"Error: {ex}"


class TextSummarizerSkill(Skill):
   def _define_metadata(self):
       return SkillMetadata(
           name="text_summarizer",
           description="Summarize text at three verbosity levels: brief (1-2 sentences), "
                       "standard (1 paragraph), or detailed (structured bullets).",
           category=SkillCategory.GENERATION,
           tags=["summarize", "nlp", "text", "writing"],
       )


   def _define_schema(self):
       return {"type": "object",
               "properties": {
                   "text": {"type": "string"},
                   "mode": {"type": "string", "enum": ["brief", "standard", "detailed"],
                            "default": "standard"}},
               "required": ["text"]}


   def execute(self, text: str, mode: str = "standard") -> str:
       instructions = {"brief": "in 1-2 sentences", "standard": "in one paragraph",
                       "detailed": "as structured bullet points covering main ideas, key details, and conclusions"}
       r = client.chat.completions.create(
           model=MODEL, max_tokens=300,
           messages=[
               {"role": "system",  "content": f"Summarize {instructions.get(mode, instructions['standard'])}. Be concise."},
               {"role": "user",    "content": text}])
       return r.choices[0].message.content


class DataAnalystSkill(Skill):
   def _define_metadata(self):
       return SkillMetadata(
           name="data_analyst",
           description="Analyse structured data (JSON or CSV) and extract statistical insights, "
                       "trends, or answer specific questions.",
           category=SkillCategory.DATA,
           tags=["data", "analysis", "statistics", "csv", "json"],
       )


   def _define_schema(self):
       return {"type": "object",
               "properties": {
                   "data":     {"type": "string", "description": "Data as JSON array or CSV"},
                   "question": {"type": "string", "description": "Analytical question to answer"}},
               "required": ["data", "question"]}


   def execute(self, data: str, question: str) -> str:
       r = client.chat.completions.create(
           model=MODEL, max_tokens=400,
           messages=[
               {"role": "user",   "content": f"Data:\n{data}\n\nQuestion: {question}"}])
       return r.choices[0].message.content


class CodeGeneratorSkill(Skill):
   def _define_metadata(self):
       return SkillMetadata(
           name="code_generator",
           description="Generate clean, commented Python code for a given task with a brief explanation.",
           category=SkillCategory.GENERATION,
           tags=["code", "python", "programming", "script"],
       )


   def _define_schema(self):
       return {"type": "object",
               "properties": {
                   "task":     {"type": "string"},
                   "language": {"type": "string", "default": "python"}},
               "required": ["task"]}


   def execute(self, task: str, language: str = "python") -> str:
       r = client.chat.completions.create(
           model=MODEL, max_tokens=500,
           messages=[
               {"role": "system", "content": f"Expert {language} developer. Write clean, commented code with a one-line explanation."},
               {"role": "user",   "content": task}])
       return r.choices[0].message.content

Credit: Source link

YOU MAY ALSO LIKE

Investors Eye AI Payoff in Microsoft, Alphabet Earnings

Anthropic Weighs Offering 15%-20% of IPO to Retail Investors

ShareTweetSendSharePin

Related Posts

Investors Eye AI Payoff in Microsoft, Alphabet Earnings
AI & Technology

Investors Eye AI Payoff in Microsoft, Alphabet Earnings

October 29, 2026
Anthropic Weighs Offering 15%-20% of IPO to Retail Investors
AI & Technology

Anthropic Weighs Offering 15%-20% of IPO to Retail Investors

October 29, 2026
Mintive Raises  Million for AI Agent Identity, Bringing Total Funding to  Million – Unite.AI
AI & Technology

Mintive Raises $7 Million for AI Agent Identity, Bringing Total Funding to $11 Million – Unite.AI

October 29, 2026
NVIDIA CEO Jensen Huang May Have Been The Target Of A Chinese Government Spy
AI & Technology

NVIDIA CEO Jensen Huang May Have Been The Target Of A Chinese Government Spy

October 29, 2026
Next Post
OpenAI’s Brockman details wild meeting with Elon Musk — ‘I thought he was going to physically attack me’

OpenAI's Brockman details wild meeting with Elon Musk — 'I thought he was going to physically attack me'

Leave a Reply Cancel reply

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

Search

No Result
View All Result
Why This Real Estate Idea Will Make You Broke #realestate #investing #money

Why This Real Estate Idea Will Make You Broke #realestate #investing #money

October 27, 2026
What Does The Bell Icon Mean On Your CarPlay Screen?

What Does The Bell Icon Mean On Your CarPlay Screen?

October 25, 2026
SpaceX: The Last Neocloud Standing

SpaceX: The Last Neocloud Standing

October 26, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!