➕ Adding New Skills¶
All skills added to this repository must be defined as native Python objects extending the
BaseSkillclass frommirai-agent-core.
You should define both simple, read-only standard skills and powerful, raw API integrations. Security and role-based access are handled downstream by the client, meaning you should write these skills to be as comprehensive and capable as possible.
📖 Example A: A Standard, Read-Only Skill¶
Inherently safe skills (like fetching public data) do not require downstream wrapping.
# src/mirai_shared_skills/weather.py
from mirai_core.core.types import BaseSkill
class WeatherSkill(BaseSkill):
name = "Weather API"
description = "Fetches real-time weather data."
instructions = "When asked about the weather, strictly use the provided tools."
def get_tools(self):
# Return a list of your custom Pydantic AI tools here
return [my_weather_tool]
⚡ Example B: A Raw Skill¶
For capabilities that modify internal state (Databases, CRMs, ticket systems), write the skill "raw". Include all necessary tools, even destructive ones. Client applications will selectively expose these tools using declarative policies.
# src/mirai_shared_skills/database.py
from mirai_core.core.types import BaseSkill
from mirai_core.capabilities.tools import tool_from_function
class RawDatabaseSkill(BaseSkill):
name = "Database Operations"
description = "Executes queries against the central database."
instructions = "Use these tools to query and modify database records."
def get_tools(self):
async def db__select_records(query: str) -> str:
return "..."
async def db__update_record(table: str, data: dict) -> str:
return "..."
async def db__drop_table(table: str) -> str:
return "..."
return [
tool_from_function(async_fn=db__select_records),
tool_from_function(async_fn=db__update_record),
tool_from_function(async_fn=db__drop_table),
]