Skip to main content
No dependencies, types included. It runs on Node 18+, Deno, Bun and Cloudflare Workers. Keep your API key on the server: the SDK isn’t meant for browsers.
The SDK (0.16) covers agents (with their versions, files and procedures), sessions, tasks, conversations (reading them, and deciding their requests), webhooks, evals and the audit log. Talking to an agent (/responses), uploads, and computers and pools aren’t in it yet: call those with fetch, as in the quickstart. Agent files are written as text (files.write); send other kinds as base64 data with the API.

Quickstart

run() starts the task and follows it to the end. When the agent asks something, it calls onQuestion and sends back what you return. When the agent wants to do something consequential, it calls onApproval: return true or 'approve' to allow it, false or 'deny' to refuse, or { decision: 'deny', note: 'why' }. If a question or approval comes up and you didn’t pass a handler, run() throws NeedsInputError (with error.task, which stays paused: decide it with gh.conversations) instead of waiting forever, except for questions and approvals the customer can answer or decide on their screen (below).

Questions and approvals

A task never asks. When the agent needs an answer or a yes, the task pauses (status: 'paused'; paused_for says which request) and the request is put to its conversation (task.conversation_id; every task has one). Whoever may decide it does so there, and the same task carries on. task.pending is the open request, with its conversation_id.
run() does this for you with onQuestion and onApproval. The first decision counts: a later one throws ConflictError with extra.code === 'already_decided' and extra.decided_by ({ type: 'person' } is the customer, { type: 'team', … } you), or 'not_pending' when the task has ended. gh.tasks.respond() is gone: POST /v1/tasks/{task_id}/respond answers 409 with code: "decide_in_conversation".

The customer answers too

Unless the agent turns it off (customer_answers: false), the agent’s questions also appear on the customer’s screen, and they can answer them there. question.customer_can_answer says whether they can answer the open one. The first answer is used, from them or from you.
  • Without onQuestion, run() leaves those questions to the customer and keeps following the task (pass timeout to give up eventually). It throws NeedsInputError only for a question they can’t answer.
  • With onQuestion, return null to leave one to them. If they answer while your handler works, your answer is refused with a 409 and run() carries on.
  • gh.conversations.answer() after they answered throws ConflictError with extra.code === 'already_decided' and extra.decided_by.type === 'person'.
  • The answer event has data.answered_by ('customer' or 'operator'), and the conversation.question_answered webhook carries the question as answered and who gave it (question.answer.by).
Approvals work the same way. Unless the agent turns it off (customer_approvals: false), the customer can approve or deny the agent’s approval requests on their screen, and approval.customer_can_approve says whether they can decide the open one.
  • Without onApproval, run() leaves those approvals to the customer and keeps following. With onApproval, return null to leave one to them.
  • gh.conversations.decide() after they decided throws ConflictError with extra.code === 'already_decided' and extra.decided_by.type === 'person'.
  • The approved and denied events have data.answered_by, and the conversation.approval_decided webhook carries the approval as decided and who made the decision (approval.decision.by). answered_by is 'timeout' when nobody decided within the agent’s approval_timeout_minutes, so it was denied.

Guardrails

An agent’s guardrails are rules Eager enforces on every step, whatever the model says. Send only the keys to change; null resets one to its default.
A refused step is a blocked event: message says what didn’t happen and why, and data.guardrail (the GuardrailDecision type) has the rule and the decision. The agent plans around it, and a stop decision ends the task. run() needs no handler for any of this.

Evals

Measure how often an agent fixes a problem: a test case is a problem on a fresh machine and a way to tell it’s fixed (a check script that prints True, a rubric a model judges, or both). Group cases into a test set, run it against your agents with a few tries each, and read the pass rates. See Evals.
Start states are the machines tries start from: an image like win10-22h2, or one you build by script, by instruction (an Eager task sets it up), or by hand. Runners are the processes that host the machines: Eager’s, or your own.

Versions

Save changes to an agent’s draft without changing what runs, try the draft on a task, then publish it as the next version:
gh.agents.update() still changes the agent right away, as a new version. agent_version also takes a number, to run an earlier version. Each task says which it ran (agent_version, agent_draft) and who started it (created_by).

Tools and files

An agent has its own file system (on by default), and can call your HTTP tools:
Each tool call is the API’s own call: here a GET of https://api.acme.com/v1/orders/42, unsigned. Each call is a tool event in the task. See HTTP tools for open calls (methods) and headers.

Cloud browsers

A session can run on a cloud browser Eager hosts instead of a person’s computer: no app, no invite link. It’s connected when create() returns.

Conversations

Chats with your agents (in the console, your website’s widget or over the API), to read:

Escalations

What needs your team: approvals and questions only your team can decide, procedure runs that failed, and runs that worked another way, with the procedure rewritten to match:
dismiss and reject resolve one without changing anything. Approvals and questions are decided in their conversation.

Audit log

See Audit log for the actions and actors.

Client

Reads, deletes and task starts that carry a request_id are retried. Other writes are not.

Resources

Every list() returns one page ({ data, has_more, next_cursor }) and takes limit and cursor (agents, versions, files and runners come whole without either, as before they paged); include: 'total_count' adds total_count, and q searches (see search). listAll() walks every page for you:

Webhooks

verifyWebhook needs the raw body, compares in constant time and rejects deliveries older than 5 minutes ({ tolerance } in seconds). It throws WebhookVerificationError. See Webhooks.

Errors

Every error extends EagerError, with status, type, message and extra: InvalidRequestError (400), AuthenticationError (401), PaymentRequiredError (402, when the org’s balance can’t pay for the task: extra.code is insufficient_balance, auto_topup_limit_reached or card_needs_attention), PermissionDeniedError (403), NotFoundError (404), ConflictError (409, for example extra.active_task_id when a task is already running, or extra.code: 'already_decided' with extra.decided_by when someone answered a question or decided an approval first, 'not_pending' when its task has ended), RateLimitError (429, including too many tasks running at once in the org, with extra.code: 'concurrency_limit'), APIError (5xx, including 503 with extra.code: 'model_unavailable' when the agent’s model can’t run right now), APIConnectionError, TimeoutError, NeedsInputError and SessionExpiredError.