Basic Skills
Basic Skills Example.
1"""2Basic Skills3=============================45Basic Skills Example.6"""78from pathlib import Path910from kern.agent import Agent11from kern.models.openai import OpenAIResponses12from kern.skills import LocalSkills, Skills1314# ---------------------------------------------------------------------------15# Create Agent16# ---------------------------------------------------------------------------17# Get the skills directory relative to this file18skills_dir = Path(__file__).parent / "sample_skills"1920# Create an agent with skills loaded from the directory21agent = Agent(22 name="Code Review Agent",23 model=OpenAIResponses(id="gpt-5.2"),24 skills=Skills(loaders=[LocalSkills(str(skills_dir))]),25 instructions=[26 "You are a helpful assistant with access to specialized skills.",27 ],28 markdown=True,29)303132# ---------------------------------------------------------------------------33# Run Agent34# ---------------------------------------------------------------------------35if __name__ == "__main__":36 # Ask the agent to review some code37 agent.print_response(38 "Review this Python code and provide feedback:\n\n"39 "```python\n"40 "def calculate_total(items):\n"41 " total = 0\n"42 " for i in range(len(items)):\n"43 " total = total + items[i]['price'] * items[i]['quantity']\n"44 " return total\n"45 "```"46 )Run the Example
1# Clone and setup repo2git clone https://github.com/kern-ai/kern.git3cd kern/cookbook/02_agents/16_skills45# Create and activate virtual environment6./scripts/demo_setup.sh7source .venvs/demo/bin/activate89python basic_skills.py