def _pip(*pkgs):
AI

def _pip(*pkgs):

Marcus Chen
Marcus Chen

2 days ago

4 min read
63%

Unlock the Power of AI Agents: Build Skill-Augmented Agents with SkillNet

Want to build awesome AI agents that can actually *do* things? SkillNet provides a framework for finding, installing, testing, and organizing reusable AI skills. This tutorial will walk you through a SkillNet use case, showing you how to build AI agents for search, evaluation, graph analysis, and even task planning. You'll learn how to leverage SkillNet to create some seriously advanced AI agents.

Build Skill-Augmented AI Agents with SkillNet for Search, Evaluation, Graph Analysis, and Task Planning

Setting Up Your SkillNet Environment for AI Agent Development

Alright, first things first: let's get a SkillNet client set up with SDK and REST fallback. Why? Well, this makes sure the tutorial still works, even if the SDK throws a fit! We'll also configure API keys, model settings, GitHub stuff, and working directories to keep your AI agent project nice and tidy.

Here's the code to get you started:

import sys, subprocess def _pip(*pkgs): subprocess.run([sys.executable, "-m", "pip", "install", "-q", *pkgs], check=False) print("Installing dependencies (skillnet-ai, networkx, matplotlib, requests)...") _pip("skillnet-ai", "networkx", "matplotlib", "requests") import os, re, json, textwrap, pathlib, traceback import requests API_KEY = os.environ.get("API_KEY", "") BASE_URL = os.environ.get("BASE_URL", "https://api.openai.com/v1") MODEL = os.environ.get("SKILLNET_MODEL", "gpt-4o") GITHUB_TOKEN = os.environ.get("GITHUB_TOKEN", "") GITHUB_MIRROR = os.environ.get("GITHUB_MIRROR", "") if not API_KEY: try: from google.colab import userdata API_KEY = userdata.get("API_KEY") or "" except Exception: pass REST_BASE = "http://api-skillnet.openkg.cn/v1" WORKDIR = pathlib.Path("./skillnet_demo"); WORKDIR.mkdir(exist_ok=True) SKILLS_DIR = WORKDIR / "my_skills"; SKILLS_DIR.mkdir(exist_ok=True) def banner(title): line = "=" * 78 print(f"\n{line}\n {title}\n{line}")

This little snippet installs the necessary Python packages (skillnet-ai, networkx, matplotlib, and requests) and sets up the environment variables SkillNet needs. Plus, it defines a banner function to keep the output organized. But what's *really* going on here?

SkillNet's core feature is its ability to find relevant AI skills. But how does it stack up against traditional methods for AI skill discovery? Let's compare keyword search with semantic search to see how AI skills can be discovered based on different task requirements. We'll explore the nuances of AI skill search and which method delivers more relevant results.

banner("1) Initialize SkillNet client (SDK with REST fallback)") USE_SDK = False client = None try: from skillnet_ai import SkillNetClient client = SkillNetClient( api_key=API_KEY or None, base_url=BASE_URL, github_token=GITHUB_TOKEN or None, ) USE_SDK = True print("SDK loaded: skillnet_ai.SkillNetClient") except Exception as e: print(f"SDK unavailable ({e!r}); using REST fallback for search/download.") def _norm(item): if isinstance(item, dict): g = item.get else: g = lambda k, d=None: getattr(item, k, d) return { "skill_name": g("skill_name") or g("name") or "?", "skill_description": g("skill_description") or g("description") or "", "author": g("author") or "", "stars": g("stars") or 0, "skill_url": g("skill_url") or g("url") or "", "category": g("category") or "", } def search(q, mode="keyword", limit=5, min_stars=0, sort_by="stars", threshold=0.8): if USE_SDK: try: kw = dict(q=q, limit=limit, mode=mode) if mode == "keyword": kw.update(min_stars=min_stars, sort_by=sort_by) else: kw.update(threshold=threshold) res = client.search(**kw) return [_norm(x) for x in (res or [])] except Exception as e: print(f" [SDK search failed -> REST] {e!r}") params = {"q": q, "mode": mode, "limit": limit} if mode == "keyword": params.update(min_stars=min_stars, sort_by=sort_by) else: params.update(threshold=threshold) try: r = requests.get(f"{REST_BASE}/search", params=params, timeout=30) r.raise_for_status() return [_norm(x) for x in r.json().get("data", [])] except Exception as e: print(f" [REST search failed] {e!r}") return [] def show_results(results, title=""): if title: print(f"\n-- {title} --") if not results: print(" (no results / endpoint unreachable)") return for i, s in enumerate(results, 1): desc = textwrap.shorten(s["skill_description"], 70, placeholder="...") print(f" {i}. {s['skill_name']:
Marcus Chen

Marcus Chen

Senior Technology Analyst

Former software engineer turned tech journalist. 15 years covering Silicon Valley. Known for cutting through hype to find the real story.

technology

Topics

#pippkgs

Source

marktechpost

Read Original

Questions

Unlock the Power of AI Agents: Build Skill-Augmented Agents with SkillNet Want to build awesome AI agents that can actually *do* things? SkillNet provides a framework for finding, installing, testing...

Comments

Leave a Comment

Your email will not be published. Comments are moderated.

No comments yet. Be the first to share your thoughts!