3939from pydantic_ai .ui import SSE_CONTENT_TYPE
4040from pydantic_ai .ui .ag_ui import AGUIAdapter
4141
42- __version__ = "0.2.10 "
42+ __version__ = "0.2.11 "
4343
4444logging .basicConfig (
4545 level = logging .INFO ,
6060DEFAULT_LLM_API_KEY = os .getenv ("LLM_API_KEY" , "ollama" )
6161DEFAULT_MCP_URL = os .getenv ("MCP_URL" , None )
6262DEFAULT_MCP_CONFIG = os .getenv ("MCP_CONFIG" , get_mcp_config_path ())
63- DEFAULT_SKILLS_DIRECTORY = os .getenv ("SKILLS_DIRECTORY " , get_skills_path () )
63+ DEFAULT_CUSTOM_SKILLS_DIRECTORY = os .getenv ("CUSTOM_SKILLS_DIRECTORY " , None )
6464DEFAULT_ENABLE_WEB_UI = to_boolean (os .getenv ("ENABLE_WEB_UI" , "False" ))
6565DEFAULT_SSL_VERIFY = to_boolean (os .getenv ("SSL_VERIFY" , "True" ))
6666
@@ -269,7 +269,7 @@ def create_agent(
269269 api_key : Optional [str ] = DEFAULT_LLM_API_KEY ,
270270 mcp_url : str = DEFAULT_MCP_URL ,
271271 mcp_config : str = DEFAULT_MCP_CONFIG ,
272- skills_directory : Optional [str ] = DEFAULT_SKILLS_DIRECTORY ,
272+ custom_skills_directory : Optional [str ] = DEFAULT_CUSTOM_SKILLS_DIRECTORY ,
273273 ssl_verify : bool = DEFAULT_SSL_VERIFY ,
274274) -> Agent :
275275 """
@@ -328,8 +328,7 @@ def create_agent(
328328 agent_toolsets .extend (mcp_toolset )
329329 logger .info (f"Connected to MCP Config JSON: { mcp_toolset } " )
330330
331- if skills_directory and os .path .exists (skills_directory ):
332- agent_toolsets .append (SkillsToolset (directories = [str (skills_directory )]))
331+ # Skills are loaded per-agent based on tags
333332
334333 agent_defs = {
335334 "person" : (CONTEXT_AGENT_PROMPT , "GitHub_Context_Agent" ),
@@ -379,6 +378,26 @@ def filter_func(ctx, tool_def, t=tag):
379378 else :
380379 pass
381380
381+ # Load specific skills for this tag
382+ skill_dir_name = f"github-{ tag .replace ('_' , '-' )} "
383+
384+ # Check custom skills directory
385+ if custom_skills_directory :
386+ skill_dir_path = os .path .join (custom_skills_directory , skill_dir_name )
387+ if os .path .exists (skill_dir_path ):
388+ tag_toolsets .append (SkillsToolset (directories = [skill_dir_path ]))
389+ logger .info (
390+ f"Loaded specialized skills for { tag } from { skill_dir_path } "
391+ )
392+
393+ # Check default skills directory
394+ default_skill_path = os .path .join (get_skills_path (), skill_dir_name )
395+ if os .path .exists (default_skill_path ):
396+ tag_toolsets .append (SkillsToolset (directories = [default_skill_path ]))
397+ logger .info (
398+ f"Loaded specialized skills for { tag } from { default_skill_path } "
399+ )
400+
382401 # Collect tool names for logging
383402 all_tool_names = []
384403 for ts in tag_toolsets :
@@ -698,7 +717,7 @@ def create_agent_server(
698717 api_key : Optional [str ] = DEFAULT_LLM_API_KEY ,
699718 mcp_url : str = DEFAULT_MCP_URL ,
700719 mcp_config : str = DEFAULT_MCP_CONFIG ,
701- skills_directory : Optional [str ] = DEFAULT_SKILLS_DIRECTORY ,
720+ custom_skills_directory : Optional [str ] = DEFAULT_CUSTOM_SKILLS_DIRECTORY ,
702721 debug : Optional [bool ] = DEFAULT_DEBUG ,
703722 host : Optional [str ] = DEFAULT_HOST ,
704723 port : Optional [int ] = DEFAULT_PORT ,
@@ -720,14 +739,30 @@ def create_agent_server(
720739 api_key = api_key ,
721740 mcp_url = mcp_url ,
722741 mcp_config = mcp_config ,
723- skills_directory = skills_directory ,
742+ custom_skills_directory = custom_skills_directory ,
724743 ssl_verify = ssl_verify ,
725744 )
726745
727- if skills_directory and os .path .exists (skills_directory ):
728- skills = load_skills_from_directory (skills_directory )
729- logger .info (f"Loaded { len (skills )} skills from { skills_directory } " )
730- else :
746+ # Always load default skills
747+
748+ skills = load_skills_from_directory (get_skills_path ())
749+
750+ logger .info (f"Loaded { len (skills )} default skills from { get_skills_path ()} " )
751+
752+ # Load custom skills if provided
753+
754+ if custom_skills_directory and os .path .exists (custom_skills_directory ):
755+
756+ custom_skills = load_skills_from_directory (custom_skills_directory )
757+
758+ skills .extend (custom_skills )
759+
760+ logger .info (
761+ f"Loaded { len (custom_skills )} custom skills from { custom_skills_directory } "
762+ )
763+
764+ if not skills :
765+
731766 skills = [
732767 Skill (
733768 id = "github_agent" ,
@@ -844,9 +879,9 @@ def agent_server():
844879 "--mcp-config" , default = DEFAULT_MCP_CONFIG , help = "MCP Server Config"
845880 )
846881 parser .add_argument (
847- "--skills-directory" ,
848- default = DEFAULT_SKILLS_DIRECTORY ,
849- help = "Directory containing agent skills" ,
882+ "--custom- skills-directory" ,
883+ default = DEFAULT_CUSTOM_SKILLS_DIRECTORY ,
884+ help = "Directory containing additional custom agent skills" ,
850885 )
851886 parser .add_argument (
852887 "--web" ,
@@ -894,7 +929,7 @@ def agent_server():
894929 api_key = args .api_key ,
895930 mcp_url = args .mcp_url ,
896931 mcp_config = args .mcp_config ,
897- skills_directory = args .skills_directory ,
932+ custom_skills_directory = args .custom_skills_directory ,
898933 debug = args .debug ,
899934 host = args .host ,
900935 port = args .port ,
@@ -917,12 +952,12 @@ def usage():
917952 "--api-key [ LLM API Key ]\n "
918953 "--mcp-url [ MCP Server URL ]\n "
919954 "--mcp-config [ MCP Server Config ]\n "
920- "--skills-directory [ Directory containing agent skills ]\n "
955+ "--custom- skills-directory [ Directory containing additional custom agent skills ]\n "
921956 "--web [ Enable Pydantic AI Web UI ]\n "
922957 "\n "
923958 "Examples:\n "
924959 " [Simple] github-agent \n "
925- ' [Complex] github-agent --host "value" --port "value" --debug "value" --reload --provider "value" --model-id "value" --base-url "value" --api-key "value" --mcp-url "value" --mcp-config "value" --skills-directory "value" --web\n '
960+ ' [Complex] github-agent --host "value" --port "value" --debug "value" --reload --provider "value" --model-id "value" --base-url "value" --api-key "value" --mcp-url "value" --mcp-config "value" --custom- skills-directory "value" --web\n '
926961 )
927962
928963
0 commit comments