open-index/open-npm huggingface dataset:
npm package: @oness.ai/agent-sdk
Description: Canonical TypeScript Agent SDK workspace for Oness.
Latest version: 0.1.0

# @oness.ai/agent-sdk

Canonical TypeScript Agent SDK workspace for Oness.

This package keeps the original `BrainClient` surface, and adds:

- `OAgent` definitions with tools, handoffs, and guardrails
- `ToolLoopAgent` runtime-bound execution helper
- `DurableAgent` checkpoint/resume helper
- `streamAgent()` incremental event helper
- `connectMCP()` and `MCPServerConnection`
- runtime session/run/checkpoint bindings through `OnessAgentClient`

Boundary rules:

- typed client only
- auth/helper only
- contract binding only
- runtime remains the execution owner
- no backend business logic in the SDK

## Install

```bash
pnpm add @oness.ai/agent-sdk
```

## Quick Start

```ts
import {
  OnessAgentClient,
  ToolLoopAgent,
  createTool,
  createSessionId
} from "@oness.ai/agent-sdk";

const client = new OnessAgentClient({
  gatewayBaseUrl: "https://gateway.oness.dev",
  runtimeBaseUrl: "https://runtime.oness.dev",
  tenantId: "tenant_123",
  userId: "user_123",
  authToken: process.env.ONESS_TOKEN
});

const agent = new ToolLoopAgent({
  client,
  agent: {
    name: "researcher",
    instructions: "Find concise answers and call tools when needed.",
    model: "openrouter/openai/gpt-4.1",
    tools: [
      createTool({
        name: "web_search",
        description: "Search the web",
        inputSchema: {
          type: "object",
          properties: { q: { type: "string" } },
          required: ["q"]
        }
      })
    ]
  }
});

const sessionId = createSessionId();
await client.createSession({ sessionId, intent: "research a company" });
const run = await agent.run({
  sessionId,
  intent: "research a company",
  messages: [{ role: "user", content: "Summarize the company." }]
});

console.log(run.result?.answer);
```

## Examples

- [`examples/basic-agent.ts`](/Users/tws/Projects/oness/sdk/typescript/examples/basic-agent.ts)
- [`examples/durable-agent.ts`](/Users/tws/Projects/oness/sdk/typescript/examples/durable-agent.ts)
- [`examples/mcp-agent.ts`](/Users/tws/Projects/oness/sdk/typescript/examples/mcp-agent.ts)

## Brain Compatibility

`BrainClient` is still exported from `@oness.ai/agent-sdk`:

```ts
import { BrainClient } from "@oness.ai/agent-sdk";
```