Skip to main content

Skill-powered AI agents implementing the Agent Skills specification with pydantic-ai

Project description

haiku.skills

Tests codecov

A skill system for pydantic-ai agents, implementing the Agent Skills specification.

Load skills from SKILL.md directories, Python entrypoints, or MCP servers and attach them to your agent as a SkillsCapability or SkillToolset. Skills run as isolated sub-agents by default, keeping your main agent's tool space clean regardless of how many skills you load.

Quick start

uv add haiku.skills
from pydantic_ai import Agent
from haiku.skills import SkillsCapability

agent = Agent(
    "anthropic:claude-sonnet-4-5-20250929",
    capabilities=[SkillsCapability(use_entrypoints=True)],
)

result = await agent.run("Analyze this dataset.")
print(result.output)

Or with explicit control over the toolset:

from pathlib import Path
from pydantic_ai import Agent
from haiku.skills import SkillToolset, build_system_prompt

toolset = SkillToolset(skill_paths=[Path("./skills")])
agent = Agent(
    "anthropic:claude-sonnet-4-5-20250929",
    instructions=build_system_prompt(toolset.skill_catalog),
    toolsets=[toolset],
)

How it works

Two execution modes:

  • Sub-agent mode (default): exposes a single execute_skill tool. Each invocation spins up a focused sub-agent with only that skill's instructions, tools, and token budget. The main agent never sees skill internals.
  • Direct mode (use_subagents=False): exposes skill tools directly to the main agent. No sub-agent LLM loops, lower latency, and the agent retains tool results in its conversation context.

Skill sources

Skills are discovered automatically and can come from three sources:

  • Filesystem: directories containing a SKILL.md file with scripts in Python, JavaScript, TypeScript, or shell
  • Entrypoints: Python packages that register via the haiku.skills entry_points group, with typed in-process tools, per-skill Pydantic state, and zero-config discovery
  • MCP servers: wrap any MCP server as a skill with skill_from_mcp

Additional Features

  • Per-skill state: Pydantic state models tracked per namespace; state deltas emitted as JSON Patch for the AG-UI protocol
  • AG-UI streaming: skill tool calls and state changes stream as ActivitySnapshotEvent and StateDeltaEvent for real-time UIs
  • Custom dependencies and lifespan: declare a deps_type to extend what skill tools see on ctx.deps; optionally attach a lifespan async context manager to allocate per-invocation resources (DB clients, caches, counters) that are disposed when the skill run ends
  • Signing and verification: identity-based skill signing via sigstore, verified at discovery time
  • CLI: haiku-skills list, validate, sign, verify, and an interactive chat TUI

Built-in skills

The repo ships several skill packages as references and for immediate use:

Skill Description
web Search (Brave) and fetch web pages with readability extraction
code-execution Sandboxed Python execution via Monty
image-generation Image generation with await llm() support
gmail Gmail integration
notifications System notifications

Each is a standalone package: uv add haiku-skills-web, uv add haiku-skills-code-execution, etc. They register via the haiku.skills entrypoints group and are discovered automatically.

Documentation

Full documentation at ggozad.github.io/haiku.skills.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

haiku_skills-0.16.0.tar.gz (256.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haiku_skills-0.16.0-py3-none-any.whl (32.8 kB view details)

Uploaded Python 3

File details

Details for the file haiku_skills-0.16.0.tar.gz.

File metadata

  • Download URL: haiku_skills-0.16.0.tar.gz
  • Upload date:
  • Size: 256.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for haiku_skills-0.16.0.tar.gz
Algorithm Hash digest
SHA256 e7bfa8141523912f3eb4469bf0b611408fa1e1e54707c9b475d0b3e04ea7ffbc
MD5 d9e79f7461b44cb05c6a3c3f6b313659
BLAKE2b-256 8c1298ea5ee4ca14d4053019b4ec4b22e39af8ae1bc054aea107c87f5ecb025e

See more details on using hashes here.

File details

Details for the file haiku_skills-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: haiku_skills-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 32.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for haiku_skills-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50dec4e24594dceadc781242cafb20ced3b1fe743fdb7035a081756fbb402aa1
MD5 8537b2f2fbf7dfbf4bbb2be3b44dfd23
BLAKE2b-256 55ca4cc0b026ee3e25d4b7f85267a210d1248988079fcac73649a09e9f9a5873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page