PageSourceSearch

https://innovationlab.fetch.ai/resources/assets/js/f31dd4b7.01dfc721.js

js fetch.ai collected 2026-10-01 11:57:05 UTC 68,209 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkinnovation_labs=self.webpackChunkinnovation_labs||[]).push([[3020],{98063:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>r,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"examples/singularityNet/fetchai-knowledge-assistant-metta","title":"Fetch.ai Knowledge Assistant with MeTTa","description":"Learn how to build a toy Fetch.ai and uAgents knowledge-lookup assistant using MeTTa","source":"@site/versioned_docs/version-1.0.5/examples/singularityNet/fetchai-knowledge-assistant-metta.md","sourceDirName":"examples/singularityNet","slug":"/examples/singularityNet/fetchai-knowledge-assistant-metta","permalink":"/resources/docs/examples/singularityNet/fetchai-knowledge-assistant-metta","draft":false,"unlisted":false,"tags":[],"version":"1.0.5","frontMatter":{"id":"fetchai-knowledge-assistant-metta","title":"Fetch.ai Knowledge Assistant with MeTTa","sidebar_label":"Fetch.ai Knowledge Assistant","description":"Learn how to build a toy Fetch.ai and uAgents knowledge-lookup assistant using MeTTa"},"sidebar":"tutorialSidebar","previous":{"title":"Financial Advisor Agent","permalink":"/resources/docs/examples/singularityNet/financial-advisor-agent-metta"},"next":{"title":"Agentverse Skills Examples","permalink":"/resources/docs/examples/agentverse-skills/agentverse-skills-examples"}}');var a=t(74848),i=t(28453);const o={id:"fetchai-knowledge-assistant-metta",title:"Fetch.ai Knowledge Assistant with MeTTa",sidebar_label:"Fetch.ai Knowledge Assistant",description:"Learn how to build a toy Fetch.ai and uAgents knowledge-lookup assistant using MeTTa"},r=void 0,l={},d=[{value:"<strong>Overview</strong>",id:"overview",level:2},{value:"<strong>What is MeTTa?</strong>",id:"what-is-metta",level:2},{value:"<strong>Installation &amp; Setup</strong>",id:"installation--setup",level:2},{value:"<strong>Prerequisites</strong>",id:"prerequisites",level:3},{value:"<strong>Installation Options</strong>",id:"installation-options",level:3},{value:"<strong>Option 1: Install All Dependencies at Once (Recommended)</strong>",id:"option-1-install-all-dependencies-at-once-recommended",level:3},{value:"<strong>Option 2: Verify Hyperon First</strong>",id:"option-2-verify-hyperon-first",level:3},{value:"<strong>Windows Installation Guide</strong>",id:"windows-installation-guide",level:3},{value:"<strong>Project layout</strong>",id:"project-layout",level:2},{value:"<strong>Architecture Overview</strong>",id:"architecture-overview",level:2},{value:"<strong>Core Integration Concepts</strong>",id:"core-integration-concepts",level:2},{value:"<strong>1. MeTTa Knowledge Graph Structure</strong>",id:"1-metta-knowledge-graph-structure",level:3},{value:"<strong>2. Pattern Matching and Querying</strong>",id:"2-pattern-matching-and-querying",level:3},{value:"<strong>3. uAgent Chat Protocol Integration</strong>",id:"3-uagent-chat-protocol-integration",level:3},{value:"<strong>4. Knowledge lookup (not vector RAG)</strong>",id:"4-knowledge-lookup-not-vector-rag",level:3},{value:"<strong>Core Components</strong>",id:"core-components",level:2},{value:"<strong>Implementation Guide</strong>",id:"implementation-guide",level:2},{value:"<strong>Step 1: Define Your Knowledge Domain</strong>",id:"step-1-define-your-knowledge-domain",level:3},{value:"<strong>Step 2: Implement MeTTa lookup</strong>",id:"step-2-implement-metta-lookup",level:3},{value:"<strong>Step 3: Query processing</strong>",id:"step-3-query-processing",level:3},{value:"<strong>Step 4: Configure Agent</strong>",id:"step-4-configure-agent",level:3},{value:"<strong>Detailed Working (Step-by-Step)</strong>",id:"detailed-working-step-by-step",level:2},{value:"<strong>Testing and Deployment</strong>",id:"testing-and-deployment",level:2},{value:"<strong>Local Testing (mailbox)</strong>",id:"local-testing-mailbox",level:3},{value:"<strong>Sample queries (aligned with one-keyword lookup)</strong>",id:"sample-queries-aligned-with-one-keyword-lookup",level:3},{value:"<strong>Query your agent from ASI</strong>",id:"query-your-agent-from-asi",level:3},{value:"<strong>Expected output</strong>",id:"expected-output",level:3},{value:"<strong>Notes</strong>",id:"notes",level:2}];function c(e){const n={a:"a",code:"code",em:"em",h2:"h2",h3:"h3",hr:"hr",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h2,{id:"overview",children:(0,a.jsx)(n.strong,{children:"Overview"})}),"\n",(0,a.jsxs)(n.p,{children:["This guide shows how to integrate ",(0,a.jsx)(n.strong,{children:"SingularityNET's MeTTa (Meta Type Talk)"})," knowledge graph with ",(0,a.jsx)(n.strong,{children:"Fetch.ai's uAgents"})," framework. The sample is a ",(0,a.jsx)(n.strong,{children:"toy demo"}),": it looks up illustrative Fetch.ai / uAgents / Agentverse / ASI",":One"," facts in MeTTa, then uses ",(0,a.jsxs)(n.strong,{children:["ASI",":One"]})," to classify intent and humanize the reply. The seed graph is a ",(0,a.jsx)(n.strong,{children:"snapshot"})," (last reviewed ",(0,a.jsx)(n.strong,{children:"2026-08-22"}),"), not live product docs \u2014 prefer the Innovation Lab docs and ",(0,a.jsxs)(n.a,{href:"https://docs.asi1.ai/documentation/models",children:["ASI",":One"," models"]})," for authoritative guidance."]}),"\n",(0,a.jsxs)(n.p,{children:["Same MeTTa + uAgent skeleton as ",(0,a.jsx)(n.a,{href:"/docs/examples/singularityNet/medical-agent-metta",children:"Medical Agent with MeTTa"})," and ",(0,a.jsx)(n.a,{href:"/docs/examples/singularityNet/financial-a
1dvisor-agent-metta",children:"Financial Advisor Agent with MeTTa"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:"Tested combo:"})," Python ",(0,a.jsx)(n.strong,{children:"3.10\u20133.12"}),", ",(0,a.jsx)(n.code,{children:"uagents>=0.25.5"})," (needs ",(0,a.jsx)(n.code,{children:"uagents-core"})," 0.4.x), ",(0,a.jsx)(n.code,{children:"hyperon>=0.2.6"}),". Chat Protocol samples need this runtime; Python 3.8 is not supported."]}),"\n",(0,a.jsx)(n.h2,{id:"what-is-metta",children:(0,a.jsx)(n.strong,{children:"What is MeTTa?"})}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:"MeTTa"})," (Meta Type Talk) is SingularityNET's multi-paradigm language for declarative and functional computations over knowledge (meta)graphs. Official docs: ",(0,a.jsx)(n.a,{href:"https://metta-lang.dev/",children:"MeTTa language"})," and ",(0,a.jsx)(n.a,{href:"https://github.com/trueagi-io/hyperon-experimental",children:"Hyperon"}),". It provides:"]}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Structured Knowledge Representation"}),": Organize platform/domain knowledge in queryable relations"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Symbolic Reasoning"}),": Perform logic-like pattern matching over graph atoms"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Knowledge Graph Operations"}),": Build, query, and evolve knowledge state"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Space-based Architecture"}),": Store knowledge as atoms in a logical space"]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"installation--setup",children:(0,a.jsx)(n.strong,{children:"Installation & Setup"})}),"\n",(0,a.jsx)(n.h3,{id:"prerequisites",children:(0,a.jsx)(n.strong,{children:"Prerequisites"})}),"\n",(0,a.jsx)(n.p,{children:"Before you begin, ensure you have:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Python 3.10+"})," (3.10\u20133.12 recommended for ",(0,a.jsx)(n.code,{children:"uagents"}
1)," 0.25.x). On Windows use ",(0,a.jsx)(n.code,{children:"py -3.10"}),"; on WSL/macOS/Linux use ",(0,a.jsx)(n.code,{children:"python3"}),"."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"pip"})," package manager"]}),"\n",(0,a.jsxs)(n.li,{children:["An ",(0,a.jsxs)(n.strong,{children:["ASI",":One"," API key"]})," from the ",(0,a.jsxs)(n.a,{href:"https://asi1.ai/dashboard/api-keys",children:["ASI",":One"," API keys dashboard"]})," (not only the ",(0,a.jsx)(n.a,{href:"https://asi1.ai/",children:"asi1.ai"})," homepage)"]}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"Create a project folder and a virtual environment (do not install into system Python):"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"# macOS / Linux / WSL\npython3 -m venv .venv\nsource .venv/bin/activate\n\n# Windows PowerShell\npy -3.10 -m venv .venv\n.\\.venv\\Scripts\\Activate.ps1\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Create a ",(0,a.jsx)(n.code,{children:".env"})," file (never commit real secrets):"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-text",children:"ASI_ONE_API_KEY=your_key_here\nAGENT_SEED=change-me-to-a-unique-local-seed\n# Optional: set LEARN=1 only if you want the demo to persist LLM guesses into the graph\n# LEARN=1\n"})}),"\n",(0,a.jsx)(n.hr,{}),"\n",(0,a.jsx)(n.h3,{id:"installation-options",children:(0,a.jsx)(n.strong,{children:"Installation Options"})}),"\n",(0,a.jsx)(n.h3,{id:"option-1-install-all-dependencies-at-once-recommended",children:(0,a.jsx)(n.strong,{children:"Option 1: Install All Dependencies at Once (Recommended)"})}),"\n",(0,a.jsxs)(n.p,{children:["Create a ",(0,a.jsx)(n.code,{children:"requirements.txt"})," file with one package per line:"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-text",children:"openai>=1.0.0\nhyperon>=0.2.6\nuagents>=0.25.5\nuagents-core>=0.4.9\npython-dotenv>=1.0.0\n"})}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.code,{children:"uagents"}
1)," 0.25.x is tested with ",(0,a.jsx)(n.code,{children:"uagents-core"})," 0.4.x (Chat Protocol). Keep ",(0,a.jsx)(n.code,{children:"uagents>=0.25.5"})," and ",(0,a.jsx)(n.code,{children:"uagents-core>=0.4.9"})," unless you intentionally upgrade the whole stack."]}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Install all dependencies with one command:"})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"python3 -m pip install -r requirements.txt\n"})}),"\n",(0,a.jsxs)(n.p,{children:["On Windows: ",(0,a.jsx)(n.code,{children:"py -3.10 -m pip install -r requirements.txt"}),"."]}),"\n",(0,a.jsx)(n.hr,{}),"\n",(0,a.jsx)(n.h3,{id:"option-2-verify-hyperon-first",children:(0,a.jsx)(n.strong,{children:"Option 2: Verify Hyperon First"})}),"\n",(0,a.jsxs)(n.p,{children:["Use this only to confirm Hyperon/MeTTa installs on your machine. You still need Option 1 (",(0,a.jsx)(n.code,{children:"requirements.txt"}),") for ",(0,a.jsx)(n.code,{children:"uagents"}),", ",(0,a.jsx)(n.code,{children:"openai"}),", and ",(0,a.jsx)(n.code,{children:"python-dotenv"}),"."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"python3 -m pip install hyperon\npython3 -c \"from hyperon import MeTTa; print('Hyperon installed successfully!')\"\n"})}),"\n",(0,a.jsx)(n.hr,{}),"\n",(0,a.jsx)(n.h3,{id:"windows-installation-guide",children:(0,a.jsx)(n.strong,{children:"Windows Installation Guide"})}),"\n",(0,a.jsxs)(n.p,{children:["Hyperon on native Windows is often painful. ",(0,a.jsx)(n.strong,{children:"WSL (Ubuntu) is recommended."})," If you stay on native Windows and hit build errors, see this video: ",(0,a.jsx)(n.a,{href:"https://www.youtube.com/watch?v=Hp28F9gL2Cc",children:"Hyperon Installation on Windows"}),"."]}),"\n",(0,a.jsx)(n.p,{children:"Written WSL path:"}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["Install ",(0,a.jsx)(n.a,{href:"https://learn.microsoft.com/en-us/windows/wsl/install",children:"WSL"})," and Ubuntu."]}),"\n",(0,a.jsxs)(n.li,{children:["Inside WSL: install Python 3.10+, create the venv above, then ",(0,a.jsx)(n.code,{children:"pip install -r requirements.txt"}),"."]}),"\n",(0,a.jsxs)(n.li,{children:["Run ",(0,a.jsx)(n.code,{children:"python3 agent.py"})," from the project folder shown below."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"project-layout",children:(0,a.jsx)(n.strong,{children:"Project layout"})}),"\n",(0,a.jsxs)(n.p,{children:["Imports in ",(0,a.jsx)(n.code,{children:"agent.py"})," use the ",(0,a.jsx)(n.code,{children:"metta"})," package. Create this tree (a flat folder of four ",(0,a.jsx)(n.code,{children:".py"})," files will raise ",(0,a.jsx)(n.code,{children:"ImportError"}),"):"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-text",children:"project/\n  agent.py\n  metta/\n    __init__.py\n    knowledge.py\n    generalrag.py\n    utils.py\n  .env\n  requirements.txt\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Create empty ",(0,a.jsx)(n.code,{children:"metta/__init__.py"}),". Run from ",(0,a.jsx)(n.code,{children:"project/"}),":"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"python3 agent.py\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Windows: ",(0,a.jsx)(n.code,{children:"py -3.10 agent.py"}),"."]}),"\n",(0,a.jsx)(n.p,{children:"This page is the Fetch.ai-domain sample of the shared MeTTa + uAgent skeleton. Copy the files below into that tree."}),"\n",(0,a.jsx)(n.h2,{id:"architecture-overview",children:(0,a.jsx)(n.strong,{children:"Architecture Overview"})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.img,{alt:"Fetch.ai Knowledge Assistant \u2014 sequence-style workflow (yellow / green / white)",src:t(1383).A+"",width:"1376",height:"768"})}),"\n",(0,a.jsxs)(n.p,{children:["The ",(0,a.jsx)(n.strong,{children:"code"})," pipeline (ASI",":One"," chat does not classify intent for you):"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-mermaid",children:"flowchart LR\n  user[User or ASI:One chat]\n  handler[Chat Protocol handler]\n  llm[Agent LLM: intent plus keyword]\n  lookup[MeTTa knowledge lookup]\n  humanize[Humanize plus disclaimer]\n  user --\x3e handler --\x3e llm --\x3e lookup --\x3e humanize --\x3e user\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Alt text: User or ASI",":One"," sends chat text to the Chat Protocol handler. The agent LLM classifies intent and a keyword, MeTTa looks up the toy graph, then the agent humanizes the answer and sends a disclaimer-prefixed reply."]}),"\n",(0,a.jsxs)(n.p,{children:["Architecture pipeline: ",(0,a.jsxs)(n.strong,{children:["User / ASI",":One"," Chat \u2192 Chat Protocol handler \u2192 agent LLM classifies intent + keyword \u2192 MeTTa knowledge lookup (not vector RAG) \u2192 humanized reply with disclaimer \u2192 User"]}),"."]}),"\n",(0,a.jsx)(n.h2,{id:"core-integration-concepts",children:(0,a.jsx)(n.strong,{children:"Core Integration Concepts"})}),"\n",(0,a.jsx)(n.h3,{id:"1-metta-knowledge-graph-structure",children:(0,a.jsx)(n.strong,{children:"1. MeTTa Knowledge Graph Structure"})}),"\n",(0,a.jsxs)(n.p,{children:["MeTTa organizes knowledge as ",(0,a.jsx)(n.strong,{children:"atoms"})," in logical ",(0,a.jsx)(n.strong,{children:"spaces"}),". Use ",(0,a.jsx)(n.strong,{children:"one convention"}),": capability / deployment / adapter ",(0,a.jsx)(n.em,{children:"keys"})," as ",(0,a.jsx)(n.code,{children:"S(...)"}),"; free-text solutions, considerations, and FAQ answers as ",(0,a.jsx)(n.code,{children:"ValueAtom"}),". Multi-word names use underscores (",(0,a.jsx)(n.code,{children:"hosted_agents"}),", ",(0,a.jsx)(n.code,{children:"create_uagent"}),"), never raw spaces or parentheses inside query interpolation."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'from hyperon import MeTTa, E, S, ValueAtom\n\nmetta 
1= MeTTa()\n\nmetta.space().add_atom(E(S("capability"), S("uAgent"), S("message_handling")))\nmetta.space().add_atom(\n    E(S("solution"), S("create_uagent"), ValueAtom("pip install uagents; define Agent; add handlers; run"))\n)\nmetta.space().add_atom(E(S("faq"), S("hi"), ValueAtom("Hello! How can I help with uAgents today?")))\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Key MeTTa Elements:"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"E (Expression)"}),": Creates logical expressions"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"S (Symbol)"}),": Represents symbolic atoms"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"ValueAtom"}),": Stores string values (FAQ text, solution steps, considerations)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Space"}),": Container where atoms are stored and queried"]}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"2-pattern-matching-and-querying",children:(0,a.jsx)(n.strong,{children:"2. Pattern Matching and Querying"})}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:"# Query syntax: !(match &self (relation subject $variable) $variable)\nquery_str = '!(match &self (capability uAgent $feature) $feature)'\nresults = metta.run(query_str)\n# Results include message_handling for the toy graph\n"})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Query Components:"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"&self"})}),": References the current space"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"$variable"})}),": Pattern matching variables that capture results"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"!(match ...)"})}),": Query syntax for pattern matching"]}),"\n"]}),"\n",(0,a.jsxs)(n.p,{children:["Never interpolate unsanitized user/LLM text into MeTTa. Only simple ",(0,a.jsx)(n.code,{children:"[a-z0-9_.:-]+"})," symbols are allowed (ASI",":One"," model IDs use hyphens; ",(0,a.jsx)(n.code,{children:"ASI:One"})," keeps a colon)."]}),"\n",(0,a.jsx)(n.h3,{id:"3-uagent-chat-protocol-integration",children:(0,a.jsx)(n.strong,{children:"3. uAgent Chat Protocol Integration"})}),"\n",(0,a.jsxs)(n.p,{children:["The following is an ",(0,a.jsx)(n.strong,{children:"excerpt"}),". Full Protocol construction is in ",(0,a.jsx)(n.code,{children:"agent.py"}),". ",(0,a.jsx)(n.code,{children:"process_query"})," returns a dict; send the ",(0,a.jsx)(n.code,{children:"humanized_answer"})," string (plus disclaimer), not the dict."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'from uagents_core.contrib.protocols.chat import (\n    ChatMessage,\n    ChatAcknowledgement,\n    TextContent,\n    chat_protocol_spec,\n)\n\n@chat_proto.on_message(ChatMessage)\nasync def handle_message(ctx: Context, sender: str, msg: ChatMessage):\n    response = process_query(user_query, rag, llm)\n    answer = response.get("humanized_answer", "I could not process that query.")\n    await ctx.send(sender, create_text_chat(answer))\n'})}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.code,{children:"ctx.send"})," delivers a message and pairs with ",(0,a.jsx)(n.strong,{children:"acknowledgements"})," (",(0,a.jsx)(n.code,{children:"ChatAcknowledgement"}),") in the Chat Protocol. Prefer ",(0,a.jsx)(n.code,{children:"ctx.send_and_receive"})," when you need a synchronous request/response with a timeout."]}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.code,{children:"mailbox=True"})," on ",(0,a.jsx)(n.code,{children:"Agent(...)"})," is the Agentverse mailbox flag (an inbox so a local agent stays reachable). Do ",(0,a.jsx)(n.strong,{children:"not"})," ",(0,a.jsx)(n.code,{children:"import mailbox"})," \u2014 that is Python's stdlib email-mailbox module and is unused here. Older docs sometimes say ",(0,a.jsx)(n.em,{children:"Mailroom"}),"; the current term is ",(0,a.jsx)(n.strong,{children:"Mailbox"}),"."]}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.code,{children:"publish_agent_details=True"})," publishes the agent's profile/details to Agentverse when the mailbox connects. Use it for discoverable demos; turn it off if you do not want the profile updated automatically."]}),"\n",(0,a.jsx)(n.h3,{id:"4-knowledge-lookup-not-vector-rag",children:(0,a.jsx)(n.strong,{children:"4. Knowledge lookup (not vector RAG)"})}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.code,{children:"GeneralRAG"})," in this sample is a ",(0,a.jsx)(n.strong,{children:"MeTTa retriever"}),": pattern-match on the toy graph, then an LLM humanizes the result. It does ",(0,a.jsx)(n.strong,{children:"not"})," use embeddings or document RAG. Dynamic graph writes from LLM guesses are ",(0,a.jsx)(n.strong,{children:"off"})," unless ",(0,a.jsx)(n.code,{children:"LEARN=1"})," is set (unsafe for a product-knowledge assistant \u2014 invented APIs would be treated as graph truth)."]}),"\n",(0,a.jsx)(n.h2,{id:"core-components",children:(0,a.jsx)(n.strong,{children:"Core Components"})}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"agent.py"})}),": Main uAgent with Chat Protocol"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"metta/knowledge.py"})}),": Toy MeTTa graph (illustrative Fetch.ai snapshot \u2014 not live docs)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"metta/generalrag.py"})}),": MeTTa lookup helpers"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"metta/utils.py"})}),": Intent classification and query processing"]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"implementation-guide",children:(0,a.jsx)(n.strong,{children:"Implementation Guide"})}),"\n",(0,a.jsx)(n.h3,{id:"step-1-define-your-knowledge-domain",children:(0,a.jsx)(n.strong,{children:"Step 1: Define Your Knowledge Domain"})}),"\n",(0,a.jsxs)(n.p,{children:["Create ",(0,a.jsx)(n.code,{children:"metta/knowledge.py"}),". Keys are ",(0,a.jsx)(n.strong,{children:"snake_case"})," and must match what the classifier returns. Models match current ASI",":One"," IDs: ",(0,a.jsx)(n.code,{children:"asi1"}),", ",(0,a.jsx)(n.code,{children:"asi1-mini"}),", ",(0,a.jsx)(n.code,{children:"asi1-ultra"})," (",(0,a.jsx)(n.a,{href:"https://docs.asi1.ai/documentation/models",children:"models docs"}),")."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'from hyperon import MeTTa, E, S, ValueAtom\n\n# Toy snapshot last reviewed: 202
16-08-22. Prefer Innovation Lab + ASI:One docs for live truth.\n\n\ndef initialize_knowledge_graph(metta: MeTTa):\n    """Toy Fetch.ai / uAgents graph for the tutorial. Not official product docs."""\n    # Agent types \u2192 capabilities (Symbol objects)\n    metta.space().add_atom(E(S("capability"), S("uAgent"), S("microservice")))\n    metta.space().add_atom(E(S("capability"), S("uAgent"), S("message_handling")))\n    metta.space().add_atom(E(S("capability"), S("uAgent"), S("event_processing")))\n    metta.space().add_atom(E(S("capability"), S("uAgent"), S("REST_endpoints")))\n    metta.space().add_atom(E(S("capability"), S("ASI:One"), S("LLM_processing")))\n    metta.space().add_atom(E(S("capability"), S("ASI:One"), S("agent_discovery")))\n    metta.space().add_atom(E(S("capability"), S("ASI:One"), S("tool_calling")))\n    metta.space().add_atom(E(S("capability"), S("ASI:One"), S("OpenAI_compatible_API")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("hosted_agents")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("agent_discovery")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("agent_deployment")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("mailbox")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("integrated_IDE")))\n    metta.space().add_atom(E(S("capability"), S("Agentverse"), S("agent_search")))\n\n    # Communication\n    metta.space().add_atom(E(S("communication"), S("ctx.send"), S("async_delivery")))\n    metta.space().add_atom(E(S("communication"), S("ctx.send"), S("with_acknowledgements")))\n    metta.space().add_atom(E(S("communication"), S("ctx.send_and_receive"), S("request_response")))\n    metta.space().add_atom(E(S("communication"), S("chat_protocol"), S("structured_messaging")))\n    metta.space().add_atom(E(S("communication"), S("chat_protocol"), S("acknowledgements")))\n\n    # Deployment (accurate uptime language \u2014 not "always running")\n    metta.space().add_atom(E(S("deployment"), S("hosted_agents"), S("Agentverse_managed")))\n    metta.space().add_atom(E(S("deployment"), S("hosted_agents"), S("active_while_started")))\n    metta.space().add_atom(E(S("deployment"), S("local_agents"), S("self_hosted")))\n    metta.space().add_atom(E(S("deployment"), S("local_agents"), S("full_library_access")))\n    metta.space().add_atom(E(S("deployment"), S("mailbox_agents"), S("local_plus_Agentverse_inbox")))\n\n    # Adapters (match current Adapters examples)\n    metta.space().add_atom(E(S("adapter"), S("LangChain"), S("LangchainRegisterTool")))\n    metta.space().add_atom(E(S("adapter"), S("LangGraph"), S("LangchainRegisterTool")))\n    metta.space().add_atom(E(S("adapter"), S("CrewAI"), S("CrewaiRegisterTool")))\n    metta.space().add_atom(E(S("adapter"), S("A2A_inbound"), S("external_A2A_clients")))\n    metta.space().add_atom(E(S("adapter"), S("A2A_outbound"), S("A2A_as_uAgent")))\n\n    # Blockchain: identity/registration vs hosted runtime\n    metta.space().add_atom(E(S("blockchain"), S("Almanac"), S("agent_registry")))\n    metta.space().add_atom(E(S("blockchain"), S("agent_identity"), S("on_chain_verifiable_address")))\n    metta.space().add_atom(E(S("blockchain"), S("hosted_runtime"), S("managed_trusted_service")))\n\n    # Current ASI:One models (https://docs.asi1.ai/documentation/models)\n    metta.space().add_atom(E(S("specificInstance"), S("ASI:One"), S("asi1")))\n    metta.space().add_atom(E(S("specificInstance"), S("ASI:One"), S("asi1-mini")))\n    metta.space().add_atom(E(S("specificInstance"), S("ASI:One"), S("asi1-ultra")))\n    metta.space().add_atom(E(S("capability"), S("asi1"), S("general_purpose_default")))\n    metta.space().add_atom(E(S("capability"), S("asi1"), S("image_input")))\n    metta.space().add_atom(E(S("capability"), S("asi1"), S("configurable_reasoning")))\n    metta.space().add_atom(E(S("capability"), S("asi1-mini"), S("fastest_lightest")))\n    metta.space().add_atom(E(S("capability"), S("asi1-mini"), S("high_volume_routing")))\n    metta.space().add_atom(E(S("capability"), S("asi1-ultra"), S("most_capable")))\n    metta.space().add_atom(E(S("capability"), S("asi1-ultra"), S("deep_research_and_review")))\n\n    # Solutions (ValueAtom free text)\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("create_uagent"),\n            ValueAtom("pip install uagents; define Agent with name/seed/port; add handlers; run agent"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("hosted_agent"),\n            ValueAtom("use Agentverse IDE, write Python, click Start; agent is active while started"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("local_agent"),\n            ValueAtom("define port/endpoint, run locally, manage process uptime yourself"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("mailbox_agent"),\n            ValueAtom("set mailbox=True, run locally, Connect \u2192 Mailbox in Agentverse inspector"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("agent_messaging"),\n            ValueAtom("ctx.send for async (+ ChatAcknowledgement); ctx.send_and_receive for sync request/response"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("chat_protocol"),\n            ValueAtom("import ChatMessage/ChatAcknowledgement/TextContent; include chat_protocol_spec"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("LangChain_integration"),\n            ValueAtom("use LangchainRegisterTool from uagents_adapter; wrap agent function; see Adapters docs"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("LangGraph_integration"),\n            ValueAtom("wrap LangGraph executor; register with LangchainRegisterTool (same tool as LangChain examples)"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("CrewAI_integration"),\n            ValueAtom("use CrewaiRegisterTool from uagents_adapter; wrap crew handler"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("search_agents"),\n            ValueAtom(\n                "POST https://agentverse.ai/v1/search/agents with auth + JSON filters; "\n                "see Searching agents docs"\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("mailbox_setup"),\n            ValueAtom("enable Mailbox (older name: Mailroom) so unreachable agents queue messages until reconnect"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("ASI:One_API_setup"),\n            ValueAtom("create key at https://asi1.ai/dashboard/api-keys; use OpenAI-compatible base https://api.asi1.ai/v1"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("solution"),\n            S("model_selection"),\n            ValueAtom("asi1 default; asi1-mini for speed/cost; asi1-ultra for hardest tasks \u2014 https://docs.asi1.ai/documentation/models"),\n        )\n    )\n\n    # Considerations\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("hosted_agents"),\n            ValueAtom("curated libraries only; active while started / inactive when stopped; plan limits apply; no public uptime SLA"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("local_agents"),\n            ValueAtom("full library access; you manage process uptime and reachability"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("mailbox_agents"),\n            ValueAtom("local process must stay running; Mailbox queues when briefly unreachable"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("ctx.send"),\n            ValueAtom("async delivery; pair with ChatAcknowledgement in Chat Protocol; use send_and_receive when you need a reply"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("Agentverse"),\n            ValueAtom("best-effort availability; hosted IDE is a trusted managed runtime, not trustless execution"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("ASI:One"),\n            ValueAtom("API dependency and token costs; model choice trades latency, depth, and price"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("asi1-mini"),\n            ValueAtom("fastest and lightest; trade depth and response length for speed"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("asi1-ultra"),\n            ValueAtom("highest quality for hard tasks; expect higher latency and cost"),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("consideration"),\n            S("Almanac"),\n            ValueAtom("on-chain registry for discovery; registration has overhead"),\n        )\n    )\n\n    # FAQ keys must match query_faq (not the raw user sentence) \u2014 one definition of ASI:One\n    metta.space().add_atom(\n        E(S("faq"), S("hi"), ValueAtom("Hello! I am a toy Fetch.ai/uAgents MeTTa assistant. How can I help?"))\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("what_is_fetchai"),\n            ValueAtom(\n                "Fetch.ai builds tools for autonomous agents: uAgents, Agentverse hosting/discovery, "\n                "and ASI:One for LLM + agent routing."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("what_are_uagents"),\n            ValueAtom(\n                "uAgents are lightweight agent microservices for messaging, events, REST, and protocols "\n                "in the Fetch.ai network."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("create_uagent"),\n            ValueAtom(\n                "Install uagents, define an Agent with a stable seed, add handlers, and run. "\n                "See uAgent creation docs."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("hosted_vs_local"),\n            ValueAtom(\n                "Hosted agents run in the Agentverse IDE (curated packages, active while started). "\n                "Local agents run on your machine with any packages; use Mailbox to stay reachable."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("mailbox_agent"),\n            ValueAtom(\n                "Set mailbox=True, run locally, open the inspector, Connect \u2192 Mailbox. "\n                "Older docs may say Mailroom for the same inbox idea."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("what_is_asi_one"),\n            ValueAtom(\n                "ASI:One is an AI platform and LLM API for language, reasoning, coding, and finding "\n                "Agentverse agents to help with tasks. Models: asi1, asi1-mini, asi1-ultra."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("asi_one_api_key"),\n            ValueAtom("Create a key at https://asi1.ai/dashboard/api-keys and store it in .env as ASI_ONE_API_KEY."),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("which_asi_one_model"),\n            ValueAtom(\n                "Use asi1 by default; asi1-mini for fast/cheap high-volume work; asi1-ultra when quality "\n                "beats latency. See https://docs.asi1.ai/documentation/models"\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("what_is_agentverse"),\n            ValueAtom(\n                "Agentverse is a cloud platform to build, host, and discover agents. Hosted agents are "\n                "active while started and inactive when stopped; availability is best-effort."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("search_agents"),\n            ValueAtom(\n                "POST https://agentverse.ai/v1/search/agents with Authorization and JSON filters. "\n                "See Searching agents docs."\n            ),\n        )\n    )\n    metta.space().add_atom(\n        E(\n            S("faq"),\n            S("langchain_uagents"),\n            ValueAtom(\n                "Yes \u2014 wrap your LangChain agent and register with LangchainRegisterTool from uagents_adapter."\n            ),\n        )\n    )\n'})}),"\n",(0,a.jsxs)(n.p,{children:["Worked FAQ example: user asks ",(0,a.jsx)(n.code,{children:"How do I create a uAgent?"})," \u2192 classifier keyword ",(0,a.jsx)(n.code,{children:"create_uagent"})," \u2192 graph key ",(0,a.jsx)(n.code,{children:"create_uagent"}
1)," \u2192 seeded steps."]}),"\n",(0,a.jsxs)(n.p,{children:[(0,a.jsx)(n.strong,{children:"Limitation:"})," the classifier extracts ",(0,a.jsx)(n.strong,{children:"one"})," keyword. Sample queries below use keys that match the seed graph."]}),"\n",(0,a.jsx)(n.h3,{id:"step-2-implement-metta-lookup",children:(0,a.jsx)(n.strong,{children:"Step 2: Implement MeTTa lookup"})}),"\n",(0,a.jsxs)(n.p,{children:["Create ",(0,a.jsx)(n.code,{children:"metta/generalrag.py"}),":"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'import re\nfrom hyperon import MeTTa, E, S, ValueAtom\n\n# Allow ASI:One model IDs (asi1-mini) and namespaced keys (ASI:One)\nSYMBOL_PATTERN = re.compile(r"^[a-zA-Z0-9_:.-]+$")\n\n\ndef to_symbol(token: str):\n    """Encode multi-word names; reject tokens that would break MeTTa."""\n    if token is None:\n        return None\n    symbol = (\n        str(token)\n        .strip()\n        .strip(\'"\')\n        .replace("\'", "")\n        .replace("\\u2019", "")\n        .replace(" ", "_")\n    )\n    if not SYMBOL_PATTERN.fullmatch(symbol):\n        return None\n    return symbol\n\n\ndef atom_to_str(atom) -> str:\n    """Parse both Symbol and ValueAtom results."""\n    try:\n        obj = atom.get_object()\n        if obj is not None and hasattr(obj, "value"):\n            return str(obj.value)\n    except Exception:\n        pass\n    return str(atom).strip(\'"\')\n\n\nclass GeneralRAG:\n    """MeTTa knowledge lookup (not embedding RAG)."""\n\n    def __init__(self, metta_instance: MeTTa):\n        self.metta = metta_instance\n\n    def _run_match(self, relation: str, subject: str):\n        symbol = to_symbol(subject)\n        if not symbol:\n            return []\n        query_str = f"!(match &self ({relation} {symbol} $x) $x)"\n        results = self.metta.run(query_str)\n        if not results:\n            return []\n        values = []\n        for row in results:\n            if row and len(row) > 0:\n                values.append(atom_to_str(row[0]))\n        return list(dict.fromkeys(values))\n\n    def query_capability(self, capability):\n        return self._run_match("capability", capability)\n\n    def get_solution(self, problem):\n        return self._run_match("solution", problem)\n\n    def get_consideration(self, topic):\n        return self._run_match("consideration", topic)\n\n    def query_faq(self, question_or_key):\n        key = to_symbol(question_or_key)\n        if not key:\n            return None\n        results = self._run_match("faq", key)\n        return results[0] if results else None\n\n    def get_specific_models(self, model: str):\n        """Return specificInstance children (e.g. ASI:One \u2192 asi1, asi1-mini, asi1-ultra)."""\n        return self._run_match("specificInstance", model)\n\n    def query_all_specific_capabilities(self, model: str):\n        """Return capabilities for each specificInstance under a parent model family."""\n        parent = to_symbol(model)\n        if not parent:\n            return []\n        query_str = (\n            f"!(match &self "\n            f"(, (specificInstance {parent} $specificInstance) "\n            f"(capability $specificInstance $specificCapability)) "\n            f"($specificInstance $specificCapability))"\n        )\n        results = self.metta.run(query_str)\n        if not results:\n            return []\n        pairs = []\n        for row in results:\n            if row and len(row) >= 1:\n                pairs.append(\n                    atom_to_str(row[0])\n                    if len(row) == 1\n                    else " ".join(atom_to_str(a) for a in row)\n                )\n        return list(dict.fromkeys(pairs))\n\n    def add_knowledge(self, relation_type, subject, object_value):\n        rel = to_symbol(relation_type)\n        subj = to_symbol(subject)\n        if not rel or not subj or object_value is None:\n            return "Skipped invalid knowledge"\n\n        # Keep seed conventions: capability/adapter/deployment/communication/blockchain/specificInstance \u2192 S\n        # solution/consideration/faq \u2192 ValueAtom\n        symbol_relations = {\n            "capability",\n            "adapter",\n            "deployment",\n            "communication",\n            "blockchain",\n            "specificInstance",\n        }\n        if rel in symbol_relations:\n            obj = to_symbol(object_value)\n            if not obj:\n                return "Ski
1pped invalid object symbol"\n            atom_obj = S(obj)\n        else:\n            atom_obj = ValueAtom(str(object_value))\n\n        self.metta.space().add_atom(E(S(rel), S(subj), atom_obj))\n        return f"Added {rel}: {subj} -> {object_value}"\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Key Methods:"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query_capability()"})}),": Features for a concept key"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsxs)(n.strong,{children:[(0,a.jsx)(n.code,{children:"get_solution()"})," / ",(0,a.jsx)(n.code,{children:"get_consideration()"})]}),": Free-text ValueAtoms"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"query_faq()"})}),": FAQ by stable key (",(0,a.jsx)(n.code,{children:"hi"}),", ",(0,a.jsx)(n.code,{children:"create_uagent"}),", ",(0,a.jsx)(n.code,{children:"what_is_asi_one"}),"), not the raw sentence"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsxs)(n.strong,{children:[(0,a.jsx)(n.code,{children:"get_specific_models()"})," / ",(0,a.jsx)(n.code,{children:"query_all_specific_capabilities()"})]}),": Wired for ASI",":One"," model questions"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"add_knowledge()"})}),": Same atom types as seed data (used only when ",(0,a.jsx)(n.code,{children:"LEARN=1"}),")"]}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"step-3-query-processing",children:(0,a.jsx)(n.strong,{children:"Step 3: Query processing"})}),"\n",(0,a.jsxs)(n.p,{children:["Create ",(0,a.jsx)(n.code,{children:"metta/utils.py"}),". Fallback ",(0,a.jsx)(n.code,{children:"if not prompt:"})," sits at ",(0,a.jsx)(n.strong,{children:"function scope"})," after all intent branches. Default path does ",(0,a.jsx)(n.strong,{children:"not"})," write LLM output into the graph."]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'import json\nimport os\n\nfrom openai import OpenAI\n\nfrom .generalrag import GeneralRAG, to_symbol\n\nDISCLAIMER = (\n    "Toy demo only. This MeTTa graph is a dated snapshot, not live Fetch.ai docs. "\n    "Prefer Innovation Lab and ASI:One documentation for production guidance."\n)\nLEARN = os.getenv("LEARN") == "1"\n\n# Map common classifier outputs onto seeded keys\nKEYWORD_ALIASES = {\n    "hosted": "hosted_agents",\n    "local": "local_agents",\n    "mailbox": "mailbox_agents",\n    "uagent": "uAgent",\n    "uagents": "uAgent",\n    "asi1": "ASI:One",\n    "asi:one": "ASI:One",\n    "agentverse": "Agentverse",\n    "langchain": "LangChain",\n    "langgraph": "LangGraph",\n    "crewai": "CrewAI",\n    "create": "create_uagent",\n    "fast": "asi1-mini",\n    "model": "ASI:One",\n}\n\n\nclass LLM:\n    def __init__(self, api_key):\n        self.client = OpenAI(\n            api_key=api_key,\n            base_url="https://api.asi1.ai/v1",\n        )\n\n    def create_completion(self, prompt, max_tokens=800):\n        completion = self.client.chat.completions.create(\n            messages=[{"role": "user", "content": prompt}],\n            model="asi1",\n            max_tokens=max_tokens,\n        )\n        return completion.choices[0].message.content\n\n\ndef normalize_keyword(keyword):\n    if not keyword:\n        return None\n    raw = str(keyword).strip()\n    aliased = KEYWORD_ALIASES.get(raw.lower().replace(" ", "_"), raw)\n    return to_symbol(aliased)\n\n\ndef get_intent_and_keyword(query, llm):\n    """Agent-side ASI:One call: classify intent and extract one keyword."""\n    prompt = (\n        f"Given the query: \'{query}\'\\n"\n        "Classify the intent as one of: \'capability\', \'solution\', \'consideration\', \'faq\', \'model\', or \'unknown\'.\\n"\n        "Extract the most relevant single keyword. Use snake_case for multi-word names "\n        "(e.g. create_uagent, hosted_agents, model_selection).\\n"\n        "For greetings like Hi/Hello, intent=faq and keyword=hi.\\n"\n        "For \'how do I create a uAgent\', intent=faq and keyword=create_uagent.\\n"\n        "For \'what is ASI:One\', intent=faq and keyword=what_is_asi_one.\\n"\n        "For \'which ASI:One model for fast responses\', intent=model and keyword=ASI:One.\\n"\n        "Return *only* JSON:\\n"\n        \'{ "intent": "<classified_intent>", "keyword": "<extracted_keyword>" }\'\n    )\n    response = llm.create_completion(prompt)\n    try:\n        cleaned = response.strip()\n        if cleaned.startswith("```"):\n            cleaned = "\\n".join(cleaned.split("\\n")[1:])\n        if cleaned.endswith("```"):\n            cleaned = "\\n".join(cleaned.split("\\n")[:-1])\n        result = json.loads(cleaned.strip())\n        return result["intent"], result.get("keyword")\n    except (json.JSONDecodeError, KeyError):\n        return "unknown", None\n\n\ndef generate_knowledge_response(query, intent, keyword, llm):\n    """Optional LLM guess. Do not persist unless LEARN=1."""\n    if intent == "capability":\n        prompt = (\n            f"Query: \'{query}\'\\n"\n            f"The concept \'{keyword}\' is not in the toy graph. Suggest one short capability phrase. "\n            f"Return only that phrase. Remind it is unverified."\n        )\n    elif intent == "solution":\n        prompt = (\n            f"Query: \'{query}\'\\n"\n            f"No solution for \'{keyword}\' in the toy graph. Suggest concise steps. Return only that text."\n        )\n    elif intent == "consideration":\n        prompt = (\n            f"Query: \'{query}\'\\n"\n            f"No considerations for \'{keyword}\'. Suggest brief limitations. Return only that text."\n        )\n    elif intent in ("faq", "model"):\n        prompt = (\n            f"Query: \'{query}\'\\n"\n            "Provide a concise Fetch.ai/uAgents answer and say it is not from the verified toy graph. "\n            "Return only the answer."\n        )\n    else:\n        return None\n    return llm.create_completion(prompt)\n\n\ndef _join(items, cap=8):\n    items = [i for i in (items or []) if i]\n    if not items:\n        return "none in toy graph"\n    return ", ".join(items[:cap])\n\n\ndef process_query(query, rag: GeneralRAG, llm: LLM):\n    intent, keyword = get_intent_and_keyword(query, llm)\n    
1keyword = normalize_keyword(keyword)\n    prompt = ""\n\n    if intent == "faq":\n        faq_key = keyword or to_symbol(query)\n        faq_answer = rag.query_faq(faq_key) if faq_key else None\n        if faq_answer:\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"FAQ Answer: \'{faq_answer}\'\\n"\n                "Humanize with a helpful developer tone. Keep the toy-demo meaning."\n            )\n        else:\n            new_answer = generate_knowledge_response(query, intent, keyword, llm)\n            if LEARN and faq_key and new_answer:\n                rag.add_knowledge("faq", faq_key, new_answer)\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"FAQ Answer (unverified LLM suggestion): \'{new_answer}\'\\n"\n                "Humanize helpfully. Do not present this as official Fetch.ai documentation."\n            )\n    elif intent == "model" and keyword:\n        models = rag.get_specific_models(keyword)\n        caps = rag.query_all_specific_capabilities(keyword)\n        model_selection = rag.get_solution("model_selection")\n        if models or caps or model_selection:\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Family: {keyword}\\n"\n                f"Models in toy graph: {_join(models)}\\n"\n                f"Per-model capabilities: {_join(caps, cap=12)}\\n"\n                f"Selection guidance: {_join(model_selection)}\\n"\n                "Recommend current IDs only (asi1 / asi1-mini / asi1-ultra). "\n                "For fast responses, prefer asi1-mini."\n            )\n        else:\n            suggestion = generate_knowledge_response(query, intent, keyword, llm)\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Model guidance (unverified LLM suggestion): {suggestion}\\n"\n                "Say this is not from the verified toy graph. Prefer docs.asi1.ai models page."\n            )\n    elif intent == "capability" and keyword:\n        capabilities = rag.query_capability(keyword)\n        if not capabilities:\n            capability = generate_knowledge_response(query, intent, keyword, llm)\n            if LEARN and capability:\n                rag.add_knowledge("capability", keyword, capability)\n            solutions = rag.get_solution(keyword) or []\n            considerations = rag.get_consideration(keyword) or []\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Concept: {keyword}\\n"\n                f"Capabilities (unverified LLM suggestion): {capability}\\n"\n                f"Solutions in graph: {_join(solutions)}\\n"\n                f"Considerations: {_join(considerations)}\\n"\n                "Be explicit that suggestions outside the graph are unverified."\n            )\n        else:\n            solutions = rag.get_solution(keyword) or []\n            considerations = rag.get_consideration(keyword) or []\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Concept: {keyword}\\n"\n                f"Capabilities: {_join(capabilities)}\\n"\n                f"Solutions: {_join(solutions)}\\n"\n                f"Considerations: {_join(considerations)}\\n"\n                "Generate a concise, helpful response from the toy graph only."\n            )\n    elif intent == "solution" and keyword:\n        solutions = rag.get_solution(keyword)\n        if solutions:\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Problem: {keyword}\\n"\n                f"Solutions: {_join(solutions)}\\n"\n                "Provide a helpful suggestion from the toy graph only."\n            )\n        else:\n            solution = generate_knowledge_response(query, intent, keyword, llm)\n            if LEARN and solution:\n                rag.add_knowledge("solution", keyword, solution)\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Problem: {keyword}\\n"\n                f"Solution (unverified LLM suggestion): {solution}\\n"\n                "Say this is not from the verified toy graph."\n            )\n    elif intent == "consideration" and keyword:\n        considerations = rag.get_consideration(keyword) or []\n        if considerations:\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Topic: {keyword}\\n"\n                f"Considerations: {_join(considerations)}\\n"\n                "Explain briefly from the toy graph."\n            )\n        else:\n            consideration = generate_knowledge_response(query, intent, keyword, llm)\n            if LEARN and consideration:\n                rag.add_knowledge("consideration", keyword, consideration)\n            prompt = (\n                f"Query: \'{query}\'\\n"\n                f"Topic: {keyword}\\n"\n                f"Considerations (unverified LLM suggestion): {consideration}\\n"\n                "Do not present this as official product policy."\n            )\n\n    if not prompt:\n        prompt = (\n            f"Query: \'{query}\'\\n"\n            "No specific info found in the toy graph. Offer general Fetch.ai/uAgents assistance "\n            "and point to Innovation Lab docs."\n        )\n\n    prompt += (\n        f"\\nAlways start the answer with: {DISCLAIMER}\\n"\n        "Then give the helpful content. Do not invent obsolete ASI:One model IDs "\n        "(no asi1-fast / asi1-extended / asi1-agentic / asi1-graph)."\n    )\n    response = llm.create_completion(prompt, max_tokens=800)\n    text = (response or "").strip()\n    if DISCLAIMER.lower() not in text.lower():\n        text = f"{DISCLAIMER}\\n\\n{text}"\n    return {"selected_question": query, "humanized_answer": text}\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Intent Classification (runs in the agent, after Chat Protocol receives text):"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"capability"}),": features for a concept (",(0,a.jsx)(n.code,{children:"uAgent"}),", ",(0,a.jsx)(n.code,{children:"Agentverse"}),", ",(0,a.jsx)(n.code,{children:"ASI:One"}),")"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"solution"}),": how-to keys (",(0,a.jsx)(n.code,{children:"create_uagent"}),", ",(0,a.jsx)(n.code,{children:"search_agents"}),", ",(0,a.jsx)(n.code,{children:"model_selection"}),")"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"consideration"}),": limits for a topic (",(0,a.jsx)(n.code,{children:"hosted_agents"}),", ",(0,a.jsx)(n.code,{children:"asi1-mini"}),")"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"faq"}),": keyed FAQs (",(0,a.jsx)(n.code,{children:"hi"}),", ",(0,a.jsx)(n.code,{children:"what_is_asi_one"}),", ",(0,a.jsx)(n.code,{children:"create_uagent"}),")"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"model"}),": lists ",(0,a.jsx)(n.code,{children:"specificInstance"})," children and per-model capabilities"]}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"step-4-configure-agent",children:(0,a.jsx)(n.strong,{children:"Step 4: Configure Agent"})}),"\n",(0,a.jsxs)(n.p,{children:["Create ",(0,a.jsx)(n.code,{children:"agent.py"})," at the project root (not inside ",(0,a.jsx)(n.code,{children:"metta/"}),"):"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-python",children:'from datetime import datetime, timezone\nfrom uuid import uuid4\nimport os\nimport sys\n\nfrom dotenv import load_dotenv\nfrom uagents import Context, Protocol, Agent\nfrom hyperon import MeTTa\n\nfrom uagents_core.contrib.protocols.chat import (\n    ChatAcknowledgement,\n    ChatMessage,\n    EndSessionContent,\n    StartSessionContent,\n    TextContent,\n    chat_protocol_spec,\n)\n\nfrom metta.generalrag import GeneralRAG\nfrom metta.knowledge import initialize_knowledge_graph\nfrom metta.utils import LLM, process_query, DISCLAIMER\n\nload_dotenv()\n\napi_key = os.getenv("ASI_ONE_API_KEY")\nagent_seed = os.getenv("AGENT_SEED")\n\nif not api_key:\n    print("Missing ASI_ONE_API_KEY. Create a key at https://asi1.ai/dashboard/api-keys and put it in .env")\n    sys.exit(1)\n\nif not agent_seed:\n    print("Missing AGENT_SEED. Set a unique local seed in .env (do not commit secrets).")\n    sys.exit(1)\n\nagent = Agent(\n    name="Fetch.ai Knowledge MeTTa Assistant",\n    seed=agent_seed,\n    port=8005,\n    mailbox=True,\n    publish_agent_details=True,\n)\n\n\ndef create_text_chat(text: str, end_session: bool = False) -> ChatMessage:\n    content = [TextContent(type="text", text=text)]\n    if end_session:\n        content.append(EndSessionContent(type="end-session"))\n    return ChatMessage(\n        timestamp=datetime.now(timezone.utc),\n        msg_id=uuid4(),\n        content=content,\n    )\n\n\nmetta 
1= MeTTa()\ninitialize_knowledge_graph(metta)\nrag = GeneralRAG(metta)\nllm = LLM(api_key=api_key)\n\nchat_proto = Protocol(spec=chat_protocol_spec)\n\n\n@chat_proto.on_message(ChatMessage)\nasync def handle_message(ctx: Context, sender: str, msg: ChatMessage):\n    ctx.storage.set(str(ctx.session), sender)\n    await ctx.send(\n        sender,\n        ChatAcknowledgement(\n            timestamp=datetime.now(timezone.utc),\n            acknowledged_msg_id=msg.msg_id,\n        ),\n    )\n\n    for item in msg.content:\n        if isinstance(item, StartSessionContent):\n            ctx.logger.info(f"Got a start session message from {sender}")\n            continue\n        elif isinstance(item, TextContent):\n            user_query = item.text.strip()\n            ctx.logger.info(f"Got a Fetch.ai/uAgents query from {sender}: {user_query}")\n            try:\n                response = process_query(user_query, rag, llm)\n                answer_text = response.get(\n                    "humanized_answer",\n                    f"{DISCLAIMER}\\n\\nI could not process your query.",\n                )\n                await ctx.send(sender, create_text_chat(answer_text))\n            except Exception as e:\n                ctx.logger.error(f"Error processing Fetch.ai/uAgents query: {e}")\n                await ctx.send(\n                    sender,\n                    create_text_chat(\n                        f"{DISCLAIMER}\\n\\nI hit an error processing that query. Please try again."\n                    ),\n                )\n        else:\n            ctx.logger.info(f"Got unexpected content from {sender}")\n\n\n@chat_proto.on_message(ChatAcknowledgement)\nasync def handle_ack(ctx: Context, sender: str, msg: ChatAcknowledgement):\n    ctx.logger.info(\n        f"Got an acknowledgement from {sender} for {msg.acknowledged_msg_id}"\n    )\n\n\nagent.include(chat_proto, publish_manifest=True)\n\nif __name__ == "__main__":\n    agent.run()\n'})}),"\n",(0,a.jsx)(n.p,{children:(0,a.jsx)(n.strong,{children:"Agent Features:"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["Toy MeTTa lookup only \u2014 ",(0,a.jsx)(n.strong,{children:"not"})," live product documentation"]}),"\n",(0,a.jsxs)(n.li,{children:["Every reply includes a ",(0,a.jsx)(n.strong,{children:"snapshot / prefer official docs"})," disclaimer"]}),"\n",(0,a.jsxs)(n.li,{children:["Does ",(0,a.jsx)(n.strong,{children:"not"})," persist unverified LLM output into the graph unless ",(0,a.jsx)(n.code,{children:"LEARN=1"})]}),"\n",(0,a.jsxs)(n.li,{children:["Agent LLM (ASI",":One",") classifies intent after Chat Protocol receives text"]}),"\n",(0,a.jsxs)(n.li,{children:["Compatible with ASI",":One"," via Chat Protocol and Agentverse mailbox (",(0,a.jsx)(n.code,{children:"mailbox=True"}),")"]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"detailed-working-step-by-step",children:(0,a.jsx)(n.strong,{children:"Detailed Working (Step-by-Step)"})}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["User sends a query through ASI",":One"," chat (or Inspector chat)."]}),"\n",(0,a.jsxs)(n.li,{children:["Chat Protocol handler receives ",(0,a.jsx)(n.code,{children:"TextContent"}),"."]}),"\n",(0,a.jsxs)(n.li,{children:["The ",(0,a.jsx)(n.strong,{children:"agent"})," calls ASI",":One"," (",(0,a.jsx)(n.code,{children:"get_intent_and_keyword"}),") to classify intent and one keyword."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"GeneralRAG"})," runs MeTTa ",(0,a.jsx)(n.code,{children:"match"})," queries on the toy graph."]}),"\n",(0,a.jsxs)(n.li,{children:["Reply is humanized, disclaimer is prepended, and Chat Protocol sends a ",(0,a.jsx)(n.strong,{children:"string"})," (not a dict)."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"testing-and-deployment",children:(0,a.jsx)(n.strong,{children:"Testing and Deployment"})}),"\n",(0,a.jsx)(n.h3,{id:"local-testing-mailbox",children:(0,a.jsx)(n.strong,{children:"Local Testing (mailbox)"})}),"\n",(0,a.jsxs)(n.p,{children:["Numbered steps matching current uAgents + Agentverse. See also ",(0,a.jsx)(n.a,{href:"/docs/agent-creation/uagent-creation#mailbox-agents",children:"Mailbox agents"})," and ",(0,a.jsx)(n.a,{href:"/docs/agent-creation/uagent-creation",children:"uAgent creation"}),"."]}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["\n",(0,a.jsxs)(n.p,{children:["Log in to ",(0,a.jsx)(n.a,{href:"https://agentverse.ai",children:"Agentverse"}),"."]}),"\n"]}),"\n",(0,a.jsxs)(n.li,{children:["\n",(0,a.jsxs)(n.p,{children:["From ",(0,a.jsx)(n.code,{children:"project/"}),", with venv active and ",(0,a.jsx)(n.code,{children:".env"})," set:"]}
1),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-bash",children:"python3 agent.py\n"})}),"\n",(0,a.jsxs)(n.p,{children:["Windows: ",(0,a.jsx)(n.code,{children:"py -3.10 agent.py"}),"."]}),"\n"]}),"\n",(0,a.jsxs)(n.li,{children:["\n",(0,a.jsx)(n.p,{children:"In the console, copy the inspector URL (it includes your agent address). Expected lines look like:"}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-text",children:"INFO:     [Fetch.ai Knowledge MeTTa Assistant]: Starting agent with address: agent1q...\nINFO:     [Fetch.ai Knowledge MeTTa Assistant]: Agent inspector available at https://agentverse.ai/inspect/?uri=http%3A//127.0.0.1%3A8005&address=agent1q...\nINFO:     [Fetch.ai Knowledge MeTTa Assistant]: Starting mailbox client for https://agentverse.ai\nINFO:     [mailbox]: Successfully registered as mailbox agent in Agentverse\n"})}),"\n",(0,a.jsxs)(n.p,{children:["If you see ",(0,a.jsx)(n.code,{children:"Missing ASI_ONE_API_KEY"}),", stop and fix ",(0,a.jsx)(n.code,{children:".env"})," \u2014 the agent exits before ",(0,a.jsx)(n.code,{children:"agent.run()"}),"."]}),"\n"]}),"\n",(0,a.jsxs)(n.li,{children:["\n",(0,a.jsxs)(n.p,{children:["Open the inspector URL while logged in. Choose ",(0,a.jsx)(n.strong,{children:"Connect"})," \u2192 ",(0,a.jsx)(n.strong,{children:"Mailbox"})," (Agentverse issues the mailbox token; you do not paste Python ",(0,a.jsx)(n.code,{children:"import mailbox"}),")."]}),"\n"]}),"\n",(0,a.jsxs)(n.li,{children:["\n",(0,a.jsxs)(n.p,{children:["Use ",(0,a.jsx)(n.strong,{children:"Chat with Agent"})," on the Inspector/profile, or continue to ASI",":One"," below. Keep ",(0,a.jsx)(n.code,{children:"agent.py"})," running."]}),"\n"]}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"sample-queries-aligned-with-one-keyword-lookup",children:(0,a.jsx)(n.strong,{children:"Sample queries (aligned with one-keyword lookup)"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"Hi"})," \u2192 FAQ key ",(0,a.jsx)(n.code,{children:"hi"})," (greeting)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"How do I create a uAgent?"})," \u2192 FAQ key ",(0,a.jsx)(n.code,{children:"create_uagent"})," (seeded install steps)"]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"What is the difference between hosted and local agents?"})," \u2192 FAQ key ",(0,a.jsx)(n.code,{children:"hosted_vs_local"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"How do agents communicate with each other?"})," \u2192 solution key ",(0,a.jsx)(n.code,{children:"agent_messaging"})," / capability around ",(0,a.jsx)(n.code,{children:"chat_protocol"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"How can I integrate LangChain with uAgents?"})," \u2192 FAQ key ",(0,a.jsx)(n.code,{children:"langchain_uagents"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"Which ASI:One model is best for fast responses?"})," \u2192 intent ",(0,a.jsx)(n.code,{children:"model"})," \u2192 ",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"asi1-mini"})})," among ",(0,a.jsx)(n.code,{children:"asi1"})," / ",(0,a.jsx)(n.code,{children:"asi1-mini"})," / ",(0,a.jsx)(n.code,{children:"asi1-ultra"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.code,{children:"What is ASI:One?"})," \u2192 single FAQ key ",(0,a.jsx)(n.code,{children:"what_is_asi_one"})]}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"query-your-agent-from-asi",children:(0,a.jsxs)(n.strong,{children:["Query your agent from ASI",":One"]})}),"\n",(0,a.jsxs)(n.p,{children:["ASI",":One"," discovers mailbox agents that are running, registered, and using Chat Protocol. README/handle tips: ",(0,a.jsx)(n.a,{href:"/docs/agentverse/searching-agents",children:"Searching agents"}),". Chat UI: ",(0,a.jsxs)(n.a,{href:"https://chat.asi1.ai/",children:["ASI",":One"," Chat"]}),"."]}),"\n",(0,a.jsxs)(n.ol,{children:["\n",(0,a.jsxs)(n.li,{children:["Copy the agent address from the console (",(0,a.jsx)(n.code,{children:"agent1q..."}),"). Optionally set a handle on the Agentverse profile."]}),"\n",(0,a.jsxs)(n.li,{children:["Open ",(0,a.jsxs)(n.a,{href:"https://asi1.ai/",children:["ASI",":One"]}),", sign in with Google or the ASI",":One"," wallet, and start a new chat."]}),"\n",(0,a.jsxs)(n.li,{children:["Toggle ",(0,a.jsx)(n.strong,{children:"Agents"})," so ASI",":One"," can call Agentverse agents."]}),"\n",(0,a.jsxs)(n.li,{children:["Paste the address or ",(0,a.jsx)(n.code,{children:"@handle"})," and send a sample query such as ",(0,a.jsx)(n.code,{children:"How do I create a uAgent?"})]}),"\n",(0,a.jsx)(n.li,{children:"Expect a reply that starts with the toy-demo disclaimer and mentions pip install / Agent / handlers from the seeded FAQ. The local console should log the incoming chat message."}),"\n"]}),"\n",(0,a.jsx)(n.h3,{id:"expected-output",children:(0,a.jsx)(n.strong,{children:"Expected output"})}),"\n",(0,a.jsxs)(n.p,{children:["Startup (shape of logs; address is unique to your ",(0,a.jsx)(n.code,{children:"AGENT_SEED"}),"):"]}),"\n",(0,a.jsx)(n.pre,{children:(0,a.jsx)(n.code,{className:"language-text",children:"INFO:     [Fetch.ai Knowledge MeTTa Assistant]: Starting agent with address: agent1q...\nINFO:     [Fetch.ai Knowledge MeTTa Assistant]: Agent inspector available at https://agentverse.ai/inspect/?uri=...\nINFO:     [mailbox]: Successfully registered as mailbox agent in Agentverse\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example chat:"}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"You:"})," ",(0,a.jsx)(n.code,{children:"How do I create a uAgent?"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Agent:"})," Starts with ",(0,a.jsx)(n.em,{children:"Toy demo only..."})," then, from the toy graph, summarizes install \u2192 define ",(0,a.jsx)(n.code,{children:"Agent"})," with seed \u2192 handlers \u2192 run."]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"You:"})," ",(0,a.jsx)(n.code,{children:"Which ASI:One model is best for fast responses?"})]}),"\n",(0,a.jsxs)(n.li,{children:[(0,a.jsx)(n.strong,{children:"Agent:"})," Recommends ",(0,a.jsx)(n.strong,{children:(0,a.jsx)(n.code,{children:"asi1-mini"})})," among current models ",(0,a.jsx)(n.code,{children:"asi1"})," / ",(0,a.jsx)(n.code,{children:"asi1-mini"})," / ",(0,a.jsx)(n.code,{children:"asi1-ultra"})," (does not mention obsolete model IDs)."]}),"\n"]}),"\n",(0,a.jsx)(n.h2,{id:"notes",children:(0,a.jsx)(n.strong,{children:"Notes"})}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsxs)(n.li,{children:["Shared MeTTa + uAgent skeleton with ",(0,a.jsx)(n.a,{href:"/docs/examples/singularityNet/medical-agent-metta",children:"Medical"})," and ",(0,a.jsx)(n.a,{href:"/docs/examples/singularityNet/financial-a
1dvisor-agent-metta",children:"Financial"})," pages; swap the domain graph, keep the package layout and ",(0,a.jsx)(n.code,{children:"LEARN"})," gate."]}),"\n",(0,a.jsxs)(n.li,{children:["For Agentverse uptime, Mailbox naming, Search API, and adapters, trust ",(0,a.jsx)(n.a,{href:"/docs/agentverse/agentverse",children:"Agentverse Overview"}),", ",(0,a.jsx)(n.a,{href:"/docs/agentverse/searching-agents",children:"Searching agents"}),", and ",(0,a.jsx)(n.a,{href:"/docs/examples/adapters/langgraph-adapter",children:"Adapters"})," \u2014 not this toy graph."]}),"\n",(0,a.jsxs)(n.li,{children:["Do not set ",(0,a.jsx)(n.code,{children:"LEARN=1"})," if you care about inventing Fetch.ai \u201cfacts\u201d into the graph."]}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,a.jsx)(n,{...e,children:(0,a.jsx)(c,{...e})}):c(e)}},1383:(e,n,t)=>{t.d(n,{A:()=>s});const s=t.p+"assets/images/fetchai-knowledge-assistant-workflow-37417ea9fa3f752f34b25083394205f0.png"},28453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>r});var s=t(96540);const a={},i=s.createContext(a);function o(e){const n=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function r(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(a):e.components||a:o(e.components),s.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.