• bitcoinBitcoin(BTC)$80,792.00-0.55%
  • ethereumEthereum(ETH)$2,333.20-1.15%
  • tetherTether(USDT)$1.00-0.03%
  • binancecoinBNB(BNB)$744.05-1.01%
  • rippleXRP(XRP)$1.29-3.27%
  • usd-coinUSDC(USDC)$1.00-0.01%
  • solanaSolana(SOL)$100.08-2.18%
  • tronTRON(TRX)$0.3313870.55%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.051.53%
  • zcashZcash(ZEC)$1,323.402.57%
  • HyperliquidHyperliquid(HYPE)$93.6215.52%
  • dogecoinDogecoin(DOGE)$0.079319-0.44%
  • moneroMonero(XMR)$600.460.47%
  • USDSUSDS(USDS)$1.000.00%
  • whitebitWhiteBIT Coin(WBT)$77.49-0.66%
  • chainlinkChainlink(LINK)$11.71-0.36%
  • leo-tokenLEO Token(LEO)$9.460.75%
  • cardanoCardano(ADA)$0.202423-1.34%
  • stellarStellar(XLM)$0.169535-1.30%
  • bitcoin-cashBitcoin Cash(BCH)$287.430.02%
  • nearNEAR Protocol(NEAR)$4.40-6.59%
  • RainRain(RAIN)$0.006547-4.32%
  • daiDai(DAI)$1.00-0.02%
  • Ethena USDeEthena USDe(USDE)$1.00-0.04%
  • litecoinLitecoin(LTC)$57.93-2.01%
  • uniswapUniswap(UNI)$7.18-0.14%
  • CantonCanton(CC)$0.100996-0.14%
  • avalanche-2Avalanche(AVAX)$8.85-1.12%
  • USD1USD1(USD1)$1.00-0.04%
  • suiSui(SUI)$0.93-1.15%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.21-2.63%
  • tether-goldTether Gold(XAUT)$4,015.67-0.79%
  • hedera-hashgraphHedera(HBAR)$0.073202-2.98%
  • Global DollarGlobal Dollar(USDG)$1.000.01%
  • BittensorBittensor(TAO)$252.98-1.56%
  • paypal-usdPayPal USD(PYUSD)$1.000.00%
  • shiba-inuShiba Inu(SHIB)$0.000005-0.46%
  • EthenaEthena(ENA)$0.2099291.86%
  • quant-networkQuant(QNT)$191.68-3.34%
  • crypto-com-chainCronos(CRO)$0.052872-1.22%
  • Ripple USDRipple USD(RLUSD)$1.00-0.01%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.16%
  • okbOKB(OKB)$113.212.00%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • MemeCoreMemeCore(M)$1.031.03%
  • pepePepe(PEPE)$0.0000057.05%
  • BitwayBitway(BTW)$1.47-15.25%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • aaveAave(AAVE)$133.71-1.17%
  • Pump.funPump.fun(PUMP)$0.0044220.85%
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

AI Can Unlock More Creativity in Video Games, Says Ex-EA Executive

AI Data Center Anger Is From the ‘Fringes,’ Host Digital Chair Says

ShareTweetSendSharePin

Related Posts

AI Can Unlock More Creativity in Video Games, Says Ex-EA Executive
AI & Technology

AI Can Unlock More Creativity in Video Games, Says Ex-EA Executive

October 29, 2026
AI Data Center Anger Is From the ‘Fringes,’ Host Digital Chair Says
AI & Technology

AI Data Center Anger Is From the ‘Fringes,’ Host Digital Chair Says

October 29, 2026
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
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
LiveWire Group: Some Technical Issues, But Mostly Demographic Issues (NYSE:LVWR)

LiveWire Group: Some Technical Issues, But Mostly Demographic Issues (NYSE:LVWR)

October 24, 2026
Steelers vs. Saints live updates, inactives, where to watch: Aaron Rodgers, Pittsburgh face New Orleans in NFL's first regular-season game in Paris – Yahoo Sports

Steelers vs. Saints live updates, inactives, where to watch: Aaron Rodgers, Pittsburgh face New Orleans in NFL's first regular-season game in Paris – Yahoo Sports

October 25, 2026
AssemblyAI Ships AssemblyAI-TTS-1: A  per 1M Character Text-to-Speech API for Voice Agents

AssemblyAI Ships AssemblyAI-TTS-1: A $15 per 1M Character Text-to-Speech API for Voice Agents

October 29, 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!