DocsGuides
Skills
A skill is a reusable workflow, written as a SKILL.md file and stored on
the Computer. Ask Pine's skill author to draft one from a turn the agent
completed or from a person's demonstration, review the draft, then activate it.
Every session's agent on that Computer can then use it. A skill describes the
pages involved, the steps, and the errors to watch for.
The examples show each server SDK.
The SKILL.md format
A skill is a Markdown file with YAML frontmatter. Pine's skill author writes it, and you read it before agents use it. A typical skill:
---
name: book-x-supplier-flight
description: "Book a flight on the X Supplier portal: sign in, search, hold a seat, confirm."
origin: "book.x-supplier.example"
---
# Booking a flight on X Supplier
## When this skill applies
- The goal is to book a flight, and the site is book.x-supplier.example.
## Steps
1. Open /portal/login. The SSO button is in the top right.
2. After SSO, open the "Travel" tile on the dashboard.
3. Search with MM/DD/YYYY dates and IATA airport codes.
4. "Hold seat" is a soft confirmation. The booking happens on the next
page, with the "Confirm" button.
## Watch for
- A captcha on the SSO page: ask a person to take over.
- A "Hold expired" banner: holds last 10 minutes. Start again from the search.
name identifies the skill on the Computer. description helps an agent pick
the right skill from a list. origin records the site the skill was learned on;
it's for your records and doesn't limit where the skill is used. The body is
the workflow itself.
How a skill becomes active
- You ask for a draft with
learn,teachorrefine, or upload aSKILL.mdyou wrote. - The draft is saved as a new
pendingversion of the skill. - You read the draft's
SKILL.md. - You activate that version, and agents use it from then on.
A version's status is pending (a draft waiting for review), active (served
to agents), inactive (deactivated, or replaced by another version) or
deleted (kept for audit). Drafting never activates a skill. Review is the
safeguard: a skill steers other agents through your systems, so a person reads
it before any agent does.
Draft a skill
There are two ways to ask Pine's skill author for a draft:
session.learndrafts from the session's latest turn. The skill author reads what the agent did and writes aSKILL.mdfor it. The turn must have finished ascompleted. No demonstration is needed.session.teach(goal:)drafts from a person's demonstration. A person takes control of the session, performs the flow and releases control, which completes a handoff. Use it for workflows the agent couldn't work out alone. The draft is markedtainted, because a demonstration may touch a sign-in, MFA or payment field.
# Draft from the agent's turn:
session.agent.run("Book a flight from SFO to JFK next Tuesday on X Supplier.")
# ... wait for the turn to complete ...
result = session.learn # waits for the skill author to finish
result.learned? # true when a draft was saved
result.draft # the new version's record: name, version, status "pending"
result.reason # why no draft was written, when learned? is false
# Draft from a person's demonstration:
computer.take_control(name: session.name)
# ... the person performs the flow on the desktop ...
computer.release_control(name: session.name)
demo = session.teach(goal: "Book a flight on X Supplier.")
if demo.needs_clarification?
demo = demo.clarify("The 'Hold seat' button is a soft confirmation.") # answers demo.questions
end
demo.taught? # true when a draft was saved; demo.draft is its record
// Go starts an author run and returns at once; its result is the run's last event.
authorResult := func(run *pine.AuthorRun) (reason string, author pine.AuthorResult, err error) {
_, err = session.AuthorEvents(ctx, run.AuthorID, "", func(data []byte) error {
var event struct {
Type string `json:"type"`
Payload struct {
TerminalReason string `json:"terminal_reason"`
Author pine.AuthorResult `json:"author"`
} `json:"payload"`
}
if err := json.Unmarshal(data, &event); err != nil || event.Type != "result" {
return err
}
reason, author = event.Payload.TerminalReason, event.Payload.Author
return nil
})
return reason, author, err
}
// Draft from the agent's turn:
if _, err := session.Agent().Run(ctx, "Book a flight from SFO to JFK next Tuesday on X Supplier.", pine.RunOptions{}); err != nil {
return err
}
// ... wait for the turn to complete ...
run, err := session.StartLearn(ctx, "")
if err != nil {
return err
}
reason, author, err := authorResult(run) // waits for the skill author to finish
if err != nil {
return err
}
learned := reason == "draft_registered" // true when a draft was saved
draft := author.Draft // the new version's record: name, version, status "pending"
// Otherwise reason says why no draft was written, for example "not_reusable".
// Draft from a person's demonstration:
if _, err := computer.TakeControl(ctx, session.Name()); err != nil {
return err
}
// ... the person performs the flow on the desktop ...
if _, err := computer.ReleaseControl(ctx, session.Name()); err != nil {
return err
}
goal := "Book a flight on X Supplier."
if run, err = session.StartTeach(ctx, goal, pine.TeachOptions{}); err != nil {
return err
}
if reason, author, err = authorResult(run); err != nil {
return err
}
if reason == "clarification_requested" {
run, err = session.StartTeach(ctx, goal, pine.TeachOptions{
HandoffID: author.HandoffID,
Clarifications: "The 'Hold seat' button is a soft confirmation.", // answers author.Questions
})
if err != nil {
return err
}
if reason, author, err = authorResult(run); err != nil {
return err
}
}
taught := reason == "draft_registered" // true when a draft was saved; author.Draft is its record
// Draft from the agent's turn:
await session.agent.run("Book a flight from SFO to JFK next Tuesday on X Supplier.");
// ... wait for the turn to complete ...
const result = await session.learn(); // waits for the skill author to finish
result.learned; // true when a draft was saved
result.draft; // the new version's record: name, version, status "pending"
result.reason; // why no draft was written, when learned is false
// Draft from a person's demonstration:
await computer.takeControl(session.name);
// ... the person performs the flow on the desktop ...
await computer.releaseControl(session.name);
const goal = "Book a flight on X Supplier.";
let demo = await session.teach(goal);
if (demo.needsClarification) {
demo = await session.teach(goal, {
handoffId: demo.handoffId,
clarifications: "The 'Hold seat' button is a soft confirmation.", // answers demo.questions
});
}
demo.taught; // true when a draft was saved; demo.draft is its record
# Draft from the agent's turn:
session.agent.run("Book a flight from SFO to JFK next Tuesday on X Supplier.")
# ... wait for the turn to complete ...
result = session.learn() # waits for the skill author to finish
result.learned # True when a draft was saved
result.draft # the new version's record: name, version, status "pending"
result.reason # why no draft was written, when learned is False
# Draft from a person's demonstration:
computer.take_control(session.name)
# ... the person performs the flow on the desktop ...
computer.release_control(session.name)
goal = "Book a flight on X Supplier."
demo = session.teach(goal)
if demo.needs_clarification:
demo = session.teach(
goal,
handoff_id=demo.handoff_id,
clarifications="The 'Hold seat' button is a soft confirmation.", # answers demo.questions
)
demo.taught # True when a draft was saved; demo.draft is its record
result.draft is the version's record (its name, version number and status),
not its text. Read the text from the drafts list below.
teach uses the session's latest handoff unless you pass handoff_id:. A
session keeps its five most recent handoffs for 24 hours; list them with
session.handoffs(limit:, before:), which returns next_before when older
ones remain. With no handoff to learn from, teach returns
409 /errors/handoff-unavailable.
learn and teach wait while the skill author works, usually 30 seconds to 3
minutes, and raise an error (PineSandbox::Error in Ruby) if the author run
fails, is canceled, or is interrupted by a restart of the Computer's services;
retry in the last case. In Go, StartLearn and StartTeach return at once, and
the example follows AuthorEvents to the run's terminal reason. To start a run without waiting, see
Run the skill author without waiting.
Agent: skill author runs explains how author
runs relate to the agent's event stream.
Review and activate
The SDKs manage skills on the Computer through computer.skills
(computer.Skills() in Go):
computer.skills.drafts # pending drafts, each with its SKILL.md body
computer.skills.activate("book-x-supplier-flight", version: 1)
computer.skills.deactivate("book-x-supplier-flight")
computer.skills.list # Pine's skills and your active ones, with `enabled` for each
computer.skills.get("book-x-supplier-flight") # skill fields and full SKILL.md; no numbered version
computer.skills.versions("book-x-supplier-flight") # version records with status; no SKILL.md body
computer.skills.version("book-x-supplier-flight", version: 1) # one version with its SKILL.md
computer.skills.delete("book-x-supplier-flight", version: 1) # remove a version; stops serving it if active
// Each call returns the JSON and an error.
skills := computer.Skills()
skills.Drafts(ctx) // pending drafts, each with its SKILL.md body
skills.Activate(ctx, "book-x-supplier-flight", 1)
skills.Deactivate(ctx, "book-x-supplier-flight")
skills.List(ctx) // Pine's skills and your active ones, with `enabled` for each
skills.Get(ctx, "book-x-supplier-flight") // skill fields and full SKILL.md; no numbered version
skills.Versions(ctx, "book-x-supplier-flight") // version records with status; no SKILL.md body
skills.Version(ctx, "book-x-supplier-flight", 1) // one version with its SKILL.md
skills.DeleteVersion(ctx, "book-x-supplier-flight", 1) // remove a version; stops serving it if active
await computer.skills.drafts(); // pending drafts, each with its SKILL.md body
await computer.skills.activate("book-x-supplier-flight", 1);
await computer.skills.deactivate("book-x-supplier-flight");
await computer.skills.list(); // Pine's skills and your active ones, with `enabled` for each
await computer.skills.get("book-x-supplier-flight"); // skill fields and full SKILL.md; no numbered version
await computer.skills.versions("book-x-supplier-flight"); // version records with status; no SKILL.md body
await computer.skills.version("book-x-supplier-flight", 1); // one version with its SKILL.md
await computer.skills.deleteVersion("book-x-supplier-flight", 1); // remove a version; stops serving it if active
computer.skills.drafts() # pending drafts, each with its SKILL.md body
computer.skills.activate("book-x-supplier-flight", 1)
computer.skills.deactivate("book-x-supplier-flight")
computer.skills.list() # Pine's skills and your active ones, with `enabled` for each
computer.skills.get("book-x-supplier-flight") # skill fields and full SKILL.md; no numbered version
computer.skills.versions("book-x-supplier-flight") # version records with status; no SKILL.md body
computer.skills.version("book-x-supplier-flight", 1) # one version with its SKILL.md
computer.skills.delete_version("book-x-supplier-flight", 1) # remove a version; stops serving it if active
In the Console, the Playground's Skills tab shows the same drafts, active skills and inactive versions, so a person can read a draft and activate it there. It uses the same routes.
A skill is served only after you activate it. A draft steers no agent: an
unreviewed skill could carry assumptions that harm later runs. Activation
updates what the Computer's agents are offered before the call returns. An
unknown version returns 404, a deleted one 410, and activating more skills
than the Computer's limit allows 409. Replacing an active version removes
the old copy first, so a failure partway can leave the skill unserved until
you activate it again, which is safe to retry.
Deactivating keeps the versions, so you can activate one again; a turn already
running keeps instructions it has loaded.
get returns an active skill's name, description, source and origin,
plus its full SKILL.md as body. It can also include tools,
unsupported_tools, hidden, version, switchable and enabled.
It carries no numbered version: version, when present, is the string from
the SKILL.md frontmatter. Pine's skills are listed by name and description
only.
versions returns the versions not deleted, newest first, without their text.
Each record has id, name, an integer version, status, created_at and
sha256. It can also include activated_at, created_by, source_session,
origin, reason and tainted. The numbered version in effect is the entry
whose status is active.
How agents use active skills
You can let the agent find a skill, or select one for a run.
Discovery
Pine's agent sees the name and description of every active skill and follows one when the goal matches. It sees "book-x-supplier-flight: Book a flight on the X Supplier portal" and uses it for a goal about booking on X Supplier. Activate a skill, and later runs find it with no code change.
Selection with run(skills:)
When your application already knows which skill a run needs, select it:
session.agent.run(
"Book a flight from SFO to JFK for Tuesday.",
skills: ["book-x-supplier-flight"],
)
turn, err := session.Agent().Run(ctx, "Book a flight from SFO to JFK for Tuesday.", pine.RunOptions{
Skills: []string{"book-x-supplier-flight"},
})
const turn = await session.agent.run("Book a flight from SFO to JFK for Tuesday.", {
skills: ["book-x-supplier-flight"],
});
turn = session.agent.run(
"Book a flight from SFO to JFK for Tuesday.",
skills=["book-x-supplier-flight"],
)
The agent receives each selected skill's full workflow as required guidance for the run, not as a suggestion.
- Selection applies to the turn
runstarts and to each turn that continues it after you answer a question. A steer doesn't change it, and eachrunselects again. - Other active skills stay available, with or without
skills:. - Memory belongs to the session. A later run may recall a skill used
earlier. Use
session.agent.reset(expected_task_id: observed_task_id)before unrelated work if you want a clean start. - Only active learned skills can be selected. Pine's own skills, inactive
skills and unknown names are rejected with
400.
Use the task ID your UI observed (agent.status.task_id), and refresh on a
stale-task conflict; do not fetch a new ID merely to retry the reset.
Start from a scaffold
learn and teach take an optional scaffold:, a starting SKILL.md of up
to 32 KiB. The skill author keeps its structure (frontmatter, headings,
parameter names) and fills in the body. Use it when you already know the shape
of the workflow and want the skill author to fill in the details:
scaffold = <<~MD
---
name: file-quarterly-expense
description: "File a quarterly expense in the internal portal."
---
# Steps
1. Open expense.internal.example
2. ...
MD
session.teach(goal: "File a quarterly expense.", scaffold: scaffold)
scaffold := `---
name: file-quarterly-expense
description: "File a quarterly expense in the internal portal."
---
# Steps
1. Open expense.internal.example
2. ...
`
run, err := session.StartTeach(ctx, "File a quarterly expense.", pine.TeachOptions{Scaffold: scaffold})
const scaffold = `---
name: file-quarterly-expense
description: "File a quarterly expense in the internal portal."
---
# Steps
1. Open expense.internal.example
2. ...
`;
await session.teach("File a quarterly expense.", { scaffold });
scaffold = """\
---
name: file-quarterly-expense
description: "File a quarterly expense in the internal portal."
---
# Steps
1. Open expense.internal.example
2. ...
"""
session.teach("File a quarterly expense.", scaffold=scaffold)
An empty scaffold means no scaffold. In Ruby, clarify sends the same scaffold
again in the clarification round; in the other SDKs, pass scaffold again with
clarifications.
Refine or upload a skill
session.start_refine(skill:, version:, guidance:) revises an existing version
from a plain-language instruction of up to 64 KiB, such as "make the date a
parameter". The version's SKILL.md is the starting point. If the session has
a completed turn, the skill author also uses what that turn did as evidence, so
choose the session you refine from. The result is a new pending version of
the same skill; a draft whose name or origin doesn't match the original is
refused.
Upload a SKILL.md you wrote yourself with author_skill (AuthorSkill in Go,
authorSkill in TypeScript). Its frontmatter name must match the skill name
you pass. The text is checked for anything that looks like a secret (422 if
it finds one) and saved as a pending version. The call returns the new
version's record, including its integer version and status: pending.
After reviewing your SKILL.md, upload it and activate the returned version:
skill_md = File.read("SKILL.md")
draft = session.author_skill(
name: "book-x-supplier-flight",
skill_md: skill_md,
reason: "Reuse the reviewed flight-booking workflow.",
)
computer.skills.activate("book-x-supplier-flight", version: draft.fetch("version"))
skillMD, err := os.ReadFile("SKILL.md")
if err != nil {
return err
}
draftJSON, err := session.AuthorSkill(ctx, "book-x-supplier-flight", string(skillMD),
"Reuse the reviewed flight-booking workflow.", pine.AuthorSkillOptions{})
if err != nil {
return err
}
var draft struct {
Version int `json:"version"`
}
if err := json.Unmarshal(draftJSON, &draft); err != nil {
return err
}
if _, err := computer.Skills().Activate(ctx, "book-x-supplier-flight", draft.Version); err != nil {
return err
}
import { readFile } from "node:fs/promises";
const skillMd = await readFile("SKILL.md", "utf8");
const draft = await session.authorSkill(
"book-x-supplier-flight", skillMd, "Reuse the reviewed flight-booking workflow.",
);
await computer.skills.activate("book-x-supplier-flight", draft.version as number);
from pathlib import Path
skill_md = Path("SKILL.md").read_text()
draft = session.author_skill(
skill_name="book-x-supplier-flight",
skill_md=skill_md,
reason="Reuse the reviewed flight-booking workflow.",
)
computer.skills.activate("book-x-supplier-flight", draft["version"])
Run the skill author without waiting
The SDKs also start author runs without waiting for them:
started = session.start_learn # also start_teach(goal: ...) and
# start_refine(skill: ..., version: ..., guidance: ...)
author_id = started["author_session"]
session.author_events(author_id: author_id) do |event|
next unless (result = event.result) # progress, until the last event
puts result["terminal_reason"] # for example "draft_registered"
end
# From another request, if you need to stop it:
session.cancel_author(author_id: author_id)
// Also StartTeach(ctx, goal, opts) and StartRefine(ctx, skill, version, guidance).
started, err := session.StartLearn(ctx, "")
if err != nil {
return err
}
authorID := started.AuthorID
_, err = session.AuthorEvents(ctx, authorID, "", func(data []byte) error {
var event struct {
Type string `json:"type"`
Payload struct {
TerminalReason string `json:"terminal_reason"`
} `json:"payload"`
}
if err := json.Unmarshal(data, &event); err != nil || event.Type != "result" {
return err // progress, until the last event
}
fmt.Println(event.Payload.TerminalReason) // for example "draft_registered"
return nil
})
// From another request, if you need to stop it:
_, err = session.CancelAuthor(ctx, authorID)
const started = await session.startLearn(); // also startTeach(goal, ...) and
// startRefine(skill, version, guidance)
const authorId = started.authorId;
for await (const event of session.authorEvents(authorId)) {
const result = event.result();
if (!result) continue; // progress, until the last event
console.log(result.terminalReason); // for example "draft_registered"
}
// From another request, if you need to stop it:
await session.cancelAuthor(authorId);
started = session.start_learn() # also start_teach(goal, ...) and
# start_refine(skill, version, guidance)
author_id = started.author_id
for event in session.author_events(author_id):
result = event.result()
if result is None: # progress, until the last event
continue
print(result.terminal_reason) # for example "draft_registered"
# From another request, if you need to stop it:
session.cancel_author(author_id)
start_teach also takes handoff_id:, clarifications: and scaffold:, and
start_learn takes scaffold:.
Each start call returns the 202 response (author_session, task_id, and
handoff_id for teach) at once. Follow the run with
session.author_events(author_id:) (session.AuthorEvents in Go), passing
author_session as author_id; pass last_event_id: to resume after a
disconnect. The stream ends with one result event whose
terminal_reason is draft_registered, clarification_requested,
not_reusable, registration_failed, canceled, failed,
storage_exhausted or coordinator_restarted (the Computer's services
restarted; start the run again); its author
holds the new draft, or the questions and handoff_id to answer.
cancel_author returns canceled: false when the run had already finished.
Use these from a web request handler behind a proxy with a short timeout, where
waiting minutes for the skill author isn't possible. learn and teach suit
callers that can wait: command-line tools, background workers and tests.
Pine's skills
The Computer also carries skills Pine provides. computer.skills.list shows
them with origin: "pine", including ones switched off (enabled: false).
Those marked
switchable (for example pdf or docx) can be switched off. Switch a skill
off when your tasks never need it, so the agent isn't offered it:
computer.skills.set_enabled("pdf", false)
_, err := computer.Skills().SetEnabled(ctx, "pdf", false)
await computer.skills.setEnabled("pdf", false);
computer.skills.set_enabled("pdf", False)
The switch belongs to the Computer and, like the rest of its saved state,
survives stop and start unless the Computer is ephemeral (created with
ephemeral: true, so it saves no state). It applies to the
agents the Computer starts next. For a session whose agent is already running,
call session.agent.reset(expected_task_id: observed_task_id), which also clears
that session's conversation.
enabled in the listing reports what the next agent is offered. A Pine skill
that isn't switchable is refused with 400; your own skills use activate
and deactivate instead.
To see which product features this Computer can use and the limits it applies,
call computer.capabilities (Ruby), computer.capabilities() (Python),
computer.Capabilities(ctx) (Go) or computer.capabilities() (TypeScript).
API reference
The skill routes are in the Computer API. Drafting,
reviewing and activating (/v2/sessions/{name}/learn, /teach, /refine,
/skills/author/{author_id}/events, /v1/skills/drafts,
/v1/skills/{name}/activate) are under Skills. The skill listing, Pine skill
switches and capabilities (/v1/skills, /v1/skills/{name},
/v1/skills/{name}/enabled, /v1/capabilities) are under Agent.