Close Menu
    Facebook X (Twitter) Instagram
    • Privacy Policy
    • Terms Of Service
    • Social Media Disclaimer
    • DMCA Compliance
    • Anti-Spam Policy
    Facebook X (Twitter) Instagram
    Fintech Fetch
    • Home
    • Crypto News
      • Bitcoin
      • Ethereum
      • Altcoins
      • Blockchain
      • DeFi
    • AI News
    • Stock News
    • Learn
      • AI for Beginners
      • AI Tips
      • Make Money with AI
    • Reviews
    • Tools
      • Best AI Tools
      • Crypto Market Cap List
      • Stock Market Overview
      • Market Heatmap
    • Contact
    Fintech Fetch
    Home»AI News»Build a Hybrid-Memory Autonomous Agent with Modular Architecture and Tool Dispatch Using OpenAI
    Build a Hybrid-Memory Autonomous Agent with Modular Architecture and Tool Dispatch Using OpenAI
    AI News

    Build a Hybrid-Memory Autonomous Agent with Modular Architecture and Tool Dispatch Using OpenAI

    May 13, 20264 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email
    Customgpt

    rewrite this content and keep HTML tags as is. This is content from rss feed and I don’t need their *Daily Debrief Newsletter*, their tags from bottom like this *Share this articleCategoriesTags*, Editorial Process section, phrases like *Featured image from Peakpx, chart from Tradingview.com*, SPECIAL OFFERS and similar sections – just remove such sections and save only article itself:

    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”],
    },
    },
    }

    aistudios

    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.”)

    quillbot
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Fintech Fetch Editorial Team
    • Website

    Related Posts

    MIT’s Initiative for New Manufacturing builds momentum | MIT News

    MIT’s Initiative for New Manufacturing builds momentum | MIT News

    June 17, 2026
    Satya Nadella warns that AI could hollow out entire industries, echoing the damage done by globalization

    Satya Nadella warns that AI could hollow out entire industries, echoing the damage done by globalization

    June 16, 2026
    Automating portfolio trading with AI

    Automating portfolio trading with AI

    June 15, 2026
    How to Build a QwenPaw Agent Workspace with Custom Skills, Model Providers, Console Access, and Streaming API Testing

    How to Build a QwenPaw Agent Workspace with Custom Skills, Model Providers, Console Access, and Streaming API Testing

    June 14, 2026
    Add A Comment

    Comments are closed.

    Join our email newsletter and get news & updates into your inbox for free.


    Privacy Policy

    Thanks! We sent confirmation message to your inbox.

    synthesia
    Latest Posts
    MIT’s Initiative for New Manufacturing builds momentum | MIT News

    MIT’s Initiative for New Manufacturing builds momentum | MIT News

    June 17, 2026
    The Four Types of Memory Every AI Agent Needs

    The Four Types of Memory Every AI Agent Needs

    June 17, 2026
    Coinbase Launches 21 Products at Once, Including Bitcoin-Backed Mortgages and AI Advisor

    rewrite this title in other words: Coinbase Launches 21 Products at Once, Including Bitcoin-Backed Mortgages and AI Advisor

    June 16, 2026
    Charles Hoskinson Reveals What Happened to 1,096 BTC From Cardano's Early Days

    rewrite this title in other words: Charles Hoskinson Reveals What Happened to 1,096 BTC From Cardano’s Early Days

    June 16, 2026
    Oluwapelumi Adejumo

    rewrite this title in other words: Strategy bought $100 million more Bitcoin but critics say MSTR shareholders now own less of it

    June 16, 2026
    binance
    LEGAL INFORMATION
    • Privacy Policy
    • Terms Of Service
    • Social Media Disclaimer
    • DMCA Compliance
    • Anti-Spam Policy
    Top Insights
    bitcoin-drops-toward-80-000-market-misinterprets-white-house-summit-information

    rewrite this title in other words: Bitcoin Rallies To $67K As US-Iran Make Peace: Will Both Hold?

    June 17, 2026
    Kraken

    rewrite this title in other words: Kraken Launches CFTC-Regulated Perpetual Futures For US Pro Traders

    June 17, 2026
    livechat
    Facebook X (Twitter) Instagram Pinterest
    © 2026 FintechFetch.com - All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.