• bitcoinBitcoin(BTC)$77,117.00-1.71%
  • ethereumEthereum(ETH)$2,462.71-0.76%
  • tetherTether(USDT)$1.00-0.02%
  • binancecoinBNB(BNB)$713.37-3.70%
  • rippleXRP(XRP)$1.35-4.57%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$99.73-3.33%
  • tronTRON(TRX)$0.339521-0.05%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.030.05%
  • zcashZcash(ZEC)$1,131.91-10.17%
  • HyperliquidHyperliquid(HYPE)$80.40-6.39%
  • dogecoinDogecoin(DOGE)$0.083825-5.29%
  • RainRain(RAIN)$0.015923-0.96%
  • USDSUSDS(USDS)$1.000.00%
  • moneroMonero(XMR)$516.141.48%
  • whitebitWhiteBIT Coin(WBT)$79.86-1.46%
  • chainlinkChainlink(LINK)$11.64-2.48%
  • leo-tokenLEO Token(LEO)$9.200.21%
  • cardanoCardano(ADA)$0.209509-3.54%
  • stellarStellar(XLM)$0.178455-3.63%
  • daiDai(DAI)$1.000.00%
  • bitcoin-cashBitcoin Cash(BCH)$226.89-11.97%
  • Ethena USDeEthena USDe(USDE)$1.00-0.02%
  • USD1USD1(USD1)$1.00-0.01%
  • litecoinLitecoin(LTC)$52.30-3.21%
  • CantonCanton(CC)$0.099446-4.52%
  • uniswapUniswap(UNI)$6.04-8.56%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.35-2.32%
  • Global DollarGlobal Dollar(USDG)$1.000.01%
  • hedera-hashgraphHedera(HBAR)$0.075147-3.76%
  • avalanche-2Avalanche(AVAX)$7.60-4.17%
  • nearNEAR Protocol(NEAR)$2.50-2.84%
  • suiSui(SUI)$0.74-7.48%
  • shiba-inuShiba Inu(SHIB)$0.000005-5.10%
  • paypal-usdPayPal USD(PYUSD)$1.000.01%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • crypto-com-chainCronos(CRO)$0.056434-4.67%
  • tether-goldTether Gold(XAUT)$4,324.54-1.64%
  • MemeCoreMemeCore(M)$1.15-3.54%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • Ripple USDRipple USD(RLUSD)$1.000.00%
  • okbOKB(OKB)$111.17-1.57%
  • BittensorBittensor(TAO)$239.70-8.07%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.150.01%
  • AsterAster(ASTER)$0.70-5.98%
  • mantleMantle(MNT)$0.58-7.63%
  • aaveAave(AAVE)$122.58-4.25%
  • polkadotPolkadot(DOT)$1.10-2.18%
  • pax-goldPAX Gold(PAXG)$4,325.10-1.70%
  • World Liberty FinancialWorld Liberty Financial(WLFI)$0.0559730.11%
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 Hybrid-Memory Autonomous Agent with Modular Architecture and Tool Dispatch Using OpenAI

May 12, 2026
in AI & Technology
Reading Time: 3 mins read
A A
Build a Hybrid-Memory Autonomous Agent with Modular Architecture and Tool Dispatch Using OpenAI
ShareShareShareShareShare

YOU MAY ALSO LIKE

IDScan Is Offering Free Credit Monitoring And ID Protection After Leaking Driver’s Licenses

OpenAI Launches ChatGPT for Financial Services With Built-In Data – Unite.AI

class MemoryStoreTool(Tool):
   name = "memory_store"
   description = "Save an important fact or piece of information to long-term memory."


   def __init__(self, memory: MemoryBackend):
       self._mem = memory


   def run(self, text: str, category: str = "general") -> str:
       chunk_id = self._mem.store(text, {"category": category})
       return f"Stored as {chunk_id}."


   def schema(self) -> Dict:
       return {
           "type": "function",
           "function": {
               "name": self.name,
               "description": self.description,
               "parameters": {
                   "type": "object",
                   "properties": {
                       "text":     {"type": "string", "description": "The fact to remember."},
                       "category": {"type": "string", "description": "Category tag, e.g. 'user_pref', 'task', 'fact'."},
                   },
                   "required": ["text"],
               },
           },
       }




class MemorySearchTool(Tool):
   name = "memory_search"
   description = "Search long-term memory for information relevant to a query."


   def __init__(self, memory: MemoryBackend):
       self._mem = memory


   def run(self, query: str, top_k: int = 3) -> str:
       results = self._mem.search(query, top_k=top_k)
       if not results:
           return "No relevant memories found."
       lines = [f"[{r['id']}] (score={r['rrf_score']}) {r['text']}" for r in results]
       return "Relevant memories:\n" + "\n".join(lines)


   def schema(self) -> Dict:
       return {
           "type": "function",
           "function": {
               "name": self.name,
               "description": self.description,
               "parameters": {
                   "type": "object",
                   "properties": {
                       "query": {"type": "string", "description": "What to look for."},
                       "top_k": {"type": "integer", "description": "Max results (default 3)."},
                   },
                   "required": ["query"],
               },
           },
       }




class CalculatorTool(Tool):
   name = "calculator"
   description = "Evaluate a safe mathematical expression, e.g. '2 ** 10 + sqrt(144)'."


   def run(self, expression: str) -> str:
       allowed = {k: getattr(math, k) for k in dir(math) if not k.startswith("_")}
       allowed.update({"abs": abs, "round": round})
       try:
           result = eval(expression, {"__builtins__": {}}, allowed)
           return str(result)
       except Exception as exc:
           return f"Error: {exc}"


   def schema(self) -> Dict:
       return {
           "type": "function",
           "function": {
               "name": self.name,
               "description": self.description,
               "parameters": {
                   "type": "object",
                   "properties": {
                       "expression": {"type": "string", "description": "Math expression to evaluate."},
                   },
                   "required": ["expression"],
               },
           },
       }




class WebSnippetTool(Tool):
   name = "web_search"
   description = "Search the web for current information on a topic (simulated)."


   _KB = {
       "openai": "OpenAI is an AI safety company that develops the GPT family of models.",
       "rag": "Retrieval-Augmented Generation (RAG) combines a retrieval system with an LLM to ground answers in external documents.",
       "bm25": "BM25 (Best Match 25) is a probabilistic keyword ranking function used in search engines.",
   }


   def run(self, query: str) -> str:
       q = query.lower()
       for kw, snippet in self._KB.items():
           if kw in q:
               return f"Web snippet for '{query}': {snippet}"
       return f"No snippet found for '{query}'. (Mock tool — integrate a real search API here.)"


   def schema(self) -> Dict:
       return {
           "type": "function",
           "function": {
               "name": self.name,
               "description": self.description,
               "parameters": {
                   "type": "object",
                   "properties": {
                       "query": {"type": "string", "description": "Search query."},
                   },
                   "required": ["query"],
               },
           },
       }




@dataclass
class AgentPersona:
   name: str
   role: str
   traits: List[str]
   forbidden_phrases: List[str] = field(default_factory=list)
   goals: List[str] = field(default_factory=list)


   def compile_system_prompt(self, extra_context: str = "") -> str:
       lines = [
           f"You are {self.name}, {self.role}.",
           "",
           "## Core Traits",
           *[f"- {t}" for t in self.traits],
       ]
       if self.goals:
           lines += ["", "## Goals", *[f"- {g}" for g in self.goals]]
       if self.forbidden_phrases:
           lines += ["", "## Forbidden Phrases (never say these)", *[f"- \"{p}\"" for p in self.forbidden_phrases]]
       if extra_context:
           lines += ["", "## Live Context", extra_context]
       lines += [
           "",
           "## Behaviour",
           "- Always reason step-by-step before answering.",
           "- Use available tools proactively; never guess when you can look up.",
           "- After using memory_search, quote the retrieved ID in your answer.",
           "- Keep answers concise unless depth is explicitly requested.",
       ]
       return "\n".join(lines)




ARIA = AgentPersona(
   name="Aria",
   role="a precise, helpful research assistant with a hybrid memory system",
   traits=["Methodical", "Curious", "Transparent about uncertainty", "Concise"],
   goals=[
       "Remember and connect information across conversations",
       "Use tools whenever they can improve accuracy",
   ],
   forbidden_phrases=["I cannot", "As an AI language model"],
)


print("✅  Tools and AgentPersona ready.")

Credit: Source link

ShareTweetSendSharePin

Related Posts

IDScan Is Offering Free Credit Monitoring And ID Protection After Leaking Driver’s Licenses
AI & Technology

IDScan Is Offering Free Credit Monitoring And ID Protection After Leaking Driver’s Licenses

September 10, 2026
OpenAI Launches ChatGPT for Financial Services With Built-In Data – Unite.AI
AI & Technology

OpenAI Launches ChatGPT for Financial Services With Built-In Data – Unite.AI

September 10, 2026
Abacus.AI Releases Three Open-Weight Smaug Models for Agentic Workloads – Unite.AI
AI & Technology

Abacus.AI Releases Three Open-Weight Smaug Models for Agentic Workloads – Unite.AI

September 10, 2026
Yoto Just Announced Two New Audio Devices For Kids
AI & Technology

Yoto Just Announced Two New Audio Devices For Kids

September 10, 2026
Next Post
Why the ‘SpaceMob’ Is So Bullish on AST

Why the 'SpaceMob' Is So Bullish on AST

Leave a Reply Cancel reply

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

Search

No Result
View All Result
You Can Now Plan IRL Events On Snapchat

You Can Now Plan IRL Events On Snapchat

September 10, 2026
Berlin police kill suspect in Pride festival attack after manhunt

Berlin police kill suspect in Pride festival attack after manhunt

September 4, 2026
Gold or International Stocks? Peter Schiff Goes Rapid-Fire

Gold or International Stocks? Peter Schiff Goes Rapid-Fire

September 9, 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!