MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / build_skill_create_agent

Function build_skill_create_agent

openkb/skill/creator.py:46–169  ·  view source on GitHub ↗

Build the openai-agents Agent for compiling one skill. Args: wiki_root: `` /wiki`` absolute path. skill_root: `` /output/skills/ `` absolute path. Will be created if it does not exist. skill_name: kebab-case slug, also the ``name:`` frontmatter val

(
    *,
    wiki_root: str,
    skill_root: str,
    skill_name: str,
    intent: str,
    model: str,
)

Source from the content-addressed store, hash-verified

44
45
46def build_skill_create_agent(
47 *,
48 wiki_root: str,
49 skill_root: str,
50 skill_name: str,
51 intent: str,
52 model: str,
53) -> Agent:
54 """Build the openai-agents Agent for compiling one skill.
55
56 Args:
57 wiki_root: ``<kb>/wiki`` absolute path.
58 skill_root: ``<kb>/output/skills/<name>`` absolute path. Will be
59 created if it does not exist.
60 skill_name: kebab-case slug, also the ``name:`` frontmatter value.
61 intent: the user&#x27;s natural-language description of what this skill
62 should do.
63 model: LiteLLM-formatted model name from KB config.
64 """
65 Path(skill_root).mkdir(parents=True, exist_ok=True)
66
67 wiki_schema = get_agents_md(Path(wiki_root))
68 instructions = load_prompt("skill_create").format(
69 intent=intent,
70 skill_name=skill_name,
71 wiki_schema=wiki_schema,
72 )
73
74 @function_tool
75 def list_wiki_dir(directory: str) -> str:
76 """List .md files in a wiki subdirectory (e.g. 'concepts')."""
77 return _list_wiki_dir_impl(directory, wiki_root)
78
79 @function_tool
80 def read_wiki_file(path: str) -> str:
81 """Read a wiki markdown file by path relative to wiki/ (e.g. 'concepts/attention.md')."""
82 return _read_wiki_file_impl(path, wiki_root)
83
84 @function_tool
85 def get_page_content(doc_name: str, pages: str) -> str:
86 """Get text content of specific pages from a PageIndex (long) document.
87
88 Use this to read the *source* of a long document at page-range
89 granularity. The summary page for the doc has a ``full_text``
90 frontmatter pointer plus a tree of section page ranges — use those
91 to target tight ranges, not the whole document.
92
93 Args:
94 doc_name: Document name without extension
95 (e.g. ``"attention-is-all-you-need"``).
96 pages: Page spec such as ``"3-5,7,10-12"``.
97 """
98 return _get_page_content_impl(doc_name, pages, wiki_root)
99
100 @function_tool
101 def get_image(image_path: str) -> ToolOutputImage | ToolOutputText:
102 """View an image from the wiki.
103

Callers 2

run_skill_createFunction · 0.85

Calls 4

get_agents_mdFunction · 0.90
load_promptFunction · 0.90
get_extra_headersFunction · 0.90
get_timeout_extra_argsFunction · 0.90