Skip to content

🚀 Quickstart

Once installed, standard (inherently safe) skills can be directly imported and injected into your client application's agent engine.

Here is a minimal example using the WeatherSkill alongside the DynamicAgentEngine and SemanticRouter from mirai-agent-core.

import asyncio
from mirai_core.core.providers import ProviderConfig, make_llm
from mirai_core.agents.engine import DynamicAgentEngine
from mirai_core.agents.router import SemanticRouter

# 1. Import the shared skill
from mirai_shared_skills.weather import WeatherSkill

async def main():
    # 2. Configure the LLM provider
    config = ProviderConfig(provider="openai", model="gpt-4o")
    router = SemanticRouter(model=make_llm(config))

    # 3. Instantiate the standard skill
    weather_skill = WeatherSkill()

    # 4. Build the engine
    engine = DynamicAgentEngine(
        provider=config,
        base_prompt="You are a helpful weather assistant.",
        skills=[weather_skill],
        router=router,
    )

    # 5. Run the streaming event loop
    async for event in engine.stream_run("What is the weather in Tokyo?"):
        if isinstance(event, dict) and event.get("type") == "TEXT_MESSAGE_CONTENT":
            print(event["content"], end="", flush=True)

if __name__ == "__main__":
    asyncio.run(main())

For skills that modify data (like databases or SaaS platforms), see the Security Policies guide.