Osy#the first language built for agents
Agents firstAgentic appsWorkflowsDurable Execution — built inSecurityTestingThe editorThe UI modelOne program

Reference / Agent

Agents (calling a model like anything else you declared)

An `agent` is a declaration — instructions, tools, model — and calling it is calling a name. The first-day mistake is treating the call as a chat: you hand it the turns you want it to see, so what it remembers is what you passed, and every run is recorded as a task with its cost and outcome whether you look or not.

stable1 example compiled by CIagentllmovervieworientation

Summary#

An agent is something you declare, and calling it is calling a name. Its declaration supplies its instructions, its tools and its model, so the call site stays about what you are asking rather than about how the model is configured.

using Osyrin.Agents;

[Principal] entity User {
  [Required, MaxLength(100)] string DisplayName;
  security { allow read when IsAuthenticated; allow create when IsAuthenticated || IsAnonymous; }
}

agent Support {
  Purpose   = "Answer questions about an order.";
  Prompt    = "You answer order questions from the context you are given.";
  Principal = new User { DisplayName = "Support" };
}

string Answer(string question) {
  var turns = new List<Turn>();
  turns.Add(Turn.User(question));
  return Support.Ask(turns).Text;
}

Description#

You hand it the turns it should see. There is no hidden session: the question, the history worth replaying and the context you assembled are the argument (running an agent from your code). What it "remembers" is what you passed — see agent conversation memory (using Osyrin.Agents) for the shapes that are worth passing and the ones that are not.

Every run is a task, recorded. Cost, duration and outcome are captured whether or not you look (the agent task log (AgentTask)). watching a task run (task.Watch) follows one in flight, what the agent saw (task.Transcript) reads what it actually said and did, what a task cost, and what it did (task.Calls) lists the tools it reached for, and stopping work (task.Stop) ends one.

The model is a declaration, not a call-site argument. app.Models — the models an app admits, each with a name is how a model is named and default LLM model (app.DefaultModel) what a call gets when it names none — so changing which model an agent uses is an edit in one place, not a sweep of call sites.

A long-running agent is a workflow, not a loop you write. the agent loop (app.Agent, Loop) is the shape for repeated turns, and an agent asking a person (the human slot) is how a person is brought into one — which is a parking point, with everything the workflow area says about surviving a deploy. what an agent hands back (AgentDeliverable) is how a run's output becomes something the app holds.

The pages#

Run osy docs agent for the full listing.

See also#

Related

running an agent from your code

Call an agent you declared the way you would call anything else you declared — by name. You hand it the turns you want…

app.Models — the models an app admits, each with a name

`app.Models` declares more than one model your app may use, each under a name you choose. The name is what your code…

default LLM model (app.DefaultModel)

Declares the app's default LLM — the provider, model, API-key secret, and optional endpoint — as a single app-level…

agent conversation memory (using Osyrin.Agents)

A conversation is stored as a `ChatSession` plus its `ChatMessage` turns, so an agent asked a follow-up can refer back…

the agent task log (AgentTask)

Every piece of work an agent does is recorded as an `AgentTask` — which agent, what set it going, when it started and…

watching a task run (task.Watch)

Everything a task has done so far, then everything it does next, as one stream that ends when the task does. A watcher…

an agent asking a person (the human slot)

An agent that needs something only a person can supply does not guess and does not fail — it asks, and its work PARKS…

what an agent hands back (AgentDeliverable)

An agent presents its outcome as a LIST of deliverables, not a sentence: documents it wrote, files it produced, and…

the agent loop (app.Agent, Loop)

The workflow an agent's work runs INSIDE. A step of it means "run the agent until it finishes or asks for help" — the…

what a task cost, and what it did (task.Calls)

Every model call an agent task paid for, read off the task itself — the model, the turn, the tokens, the cache hits…