Use skills with agents
Attaching a SkillCatalog lets the agent discover instructions on demand and enables tools only when their required skill is active.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
import asyncio
from ish import Agent, SkillRegistry
skills = SkillRegistry()
skills.add_search_path("./.agents/skills")
agent = Agent(
model="gpt-4o-mini",
instructions="Help with the user's task. Use an available skill when relevant.",
skills=skills,
max_active_skills=5,
)
async def main() -> None:
try:
result = await agent.run("Review our deployment checklist and verify prerequisites.")
print(result.content)
finally:
agent.close()
asyncio.run(main())
import { Agent, IshClient, SkillCatalog } from "ish-harness";
const client = new IshClient();
const catalog = new SkillCatalog(client);
catalog.addSearchPath("./.agents/skills");
const agent = new Agent({
model: { provider: "openai_chat", name: "gpt-4o-mini" },
instructions: "Help with the user's task. Use an available skill when relevant.",
skill_catalog: catalog,
max_active_skills: 5,
});
const result = await agent.run("Review our deployment checklist and verify prerequisites.");
console.log(result.content);
agent.close();
catalog.close();
client.close();
use std::{env, io, sync::Arc};
use ish_harness::{Agent, OpenAIModel, SkillCatalog};
let catalog = SkillCatalog::new();
let (_loaded, _diagnostics) = catalog.add_search_path("./.agents/skills");
let model = OpenAIModel::new(
"gpt-4o-mini".into(),
"https://api.openai.com/v1".into(),
env::var("OPENAI_API_KEY")?,
0.2,
);
let agent = Agent::builder(Arc::new(model))
.instructions("Help with the user's task. Use an available skill when relevant.")
.skills(catalog, Some(5))
.build()
.map_err(io::Error::other)?;
let result = agent
.run("Review our deployment checklist and verify prerequisites.")
.await
.map_err(io::Error::other)?;
println!("{}", result.content);
client, err := ish.NewClient("")
if err != nil {
panic(err)
}
defer client.Close()
catalog, err := ish.NewSkillCatalog(client)
if err != nil {
panic(err)
}
defer catalog.Close()
if _, err := catalog.AddSearchPath("./.agents/skills"); err != nil {
panic(err)
}
req, err := catalog.AttachToAgent(ish.AgentRunRequest{
Model: &ish.AgentModel{Provider: "openai_chat", Name: "gpt-4o-mini"},
SystemPrompt: ish.StringPtr("Help with the user's task. Use an available skill when relevant."),
UserPrompt: ish.StringPtr("Review our deployment checklist and verify prerequisites."),
}, ish.IntPtr(5))
if err != nil {
panic(err)
}
result, err := client.RunAgent(req)
if err != nil {
panic(err)
}
fmt.Println(result["content"])
using Ish.Harness;
using var client = new IshClient();
using var catalog = new SkillCatalog(client);
catalog.AddSearchPath("./.agents/skills");
using var request = catalog.AttachToAgent(new AgentRunRequest
{
Model = new AgentModel { Provider = "openai_chat", Name = "gpt-4o-mini" },
SystemPrompt = "Help with the user's task. Use an available skill when relevant.",
UserPrompt = "Review our deployment checklist and verify prerequisites.",
}, maxActive: 5);
var result = client.Run(request);
Console.WriteLine(result.GetProperty("content").GetString());
import io.github.ishharness.IshClient;
import io.github.ishharness.SkillCatalog;
import java.nio.file.Path;
try (var client = new IshClient(Path.of(System.getenv("ISH_NATIVE_LIBRARY")));
var catalog = new SkillCatalog(client);
var request = new IshClient.AgentRequest(
"gpt-4o-mini",
"Help with the user's task. Use an available skill when relevant.",
"Review our deployment checklist and verify prerequisites.")
.provider("openai_chat")) {
catalog.addSearchPath("./.agents/skills");
catalog.attachTools(request, 5);
var result = client.runAgent(request);
System.out.println(result.path("content").asText());
}
A skill-enabled agent receives a short catalog, then reads and activates a skill only when it is relevant. The active skill's instructions are added to the model context; its gated tools become available at that point.
What happens when an agent activates a skill
Skill tools
A skill-enabled agent can search the catalog, read a skill's instructions or reference files, and activate a skill. The catalog search and file reads do not make a skill active; activation adds its instructions and enables any tools gated by that skill.
| Tool | Use it to |
|---|---|
search_skills | Find a relevant skill by name or description |
read_skill | Read instructions or a file within the skill directory |
activate_skill | Add a skill's instructions and enable its tools |
Limit the number of active skills
Set max_active_skills to bound how many skills remain active at once. Activating a skill already in the active set makes it recent; when the limit is reached, the least recently used skill is removed. Deactivation takes effect before the next model request.
Gate tools by skill
Use requires_skill for tools that should appear only while a named skill is active. The runtime hides inactive tools from the model and checks the requirement again before execution. For skill file layout and safe path rules, see Authoring Skills.