API Reference

Complete API reference for the AgenticWork SDK.

AgenticWork Class

The main client class for interacting with AgenticWork.

Constructor

new AgenticWork(config: AgenticWorkConfig)

Parameters:

Name
Type
Description

apiKey

string

Your AgenticWork API key

baseUrl

string

API base URL (default: https://chat.agenticwork.io)

timeout

number

Request timeout in ms (default: 30000)

Example:

const client = new AgenticWork({
  apiKey: 'aw_live_xxxx',
  baseUrl: 'https://chat.agenticwork.io',
  timeout: 60000
});

Methods

init()

Initialize the client and verify connection.

createAgent()

Create a new AI agent instance.

AgentConfig:

Name
Type
Description

name

string

Agent identifier

model

string

Model to use (e.g., claude-3-5-sonnet)

intelligenceLevel

number

0-100 cost/quality slider

systemPrompt

string

Optional system prompt

tools

string[]

Allowed MCP tools

getMCPTools()

Get list of available MCP tools.

Returns: Array of available tools with their schemas.


Agent Class

Represents a configured AI agent.

complete()

Get a complete response (non-streaming).

CompletionRequest:

Name
Type
Description

messages

Message[]

Conversation messages

tools

string[]

Tools to enable

maxTokens

number

Max response tokens

CompletionResponse:

Name
Type
Description

content

string

Response text

toolCalls

ToolCall[]

Any tool invocations

usage

Usage

Token usage stats

streamComplete()

Stream response tokens.

StreamChunk:

Name
Type
Description

type

string

text, tool_use, done

content

string

Chunk content

toolCall

ToolCall

Tool call data (if applicable)

Example:


Types

Message

ToolCall

Usage

MCPTool


Error Handling

Last updated