Block a user
@jasonfang/jasoncode (0.1.0)
Published 2026-08-23 19:14:12 +08:00 by jasonfang
Installation
@jasonfang:registry=https://git.kenfei.net/api/packages/jasonfang/npm/npm install @jasonfang/jasoncode@0.1.0"@jasonfang/jasoncode": "0.1.0"About this package
An AI agent SDK for building intelligent applications
@jasonfang/jasoncode
An AI Agent SDK for building intelligent applications.
Installation
# npm
npm install @jasonfang/jasoncode
# pnpm
pnpm add @jasonfang/jasoncode
# yarn
yarn add @jasonfang/jasoncode
Quick Start
import { createAgent } from '@jasonfang/jasoncode';
// Create an agent
const agent = createAgent('gpt-5');
// Set your API key
agent.setApiKey(process.env.OPENAI_API_KEY);
// Run a prompt
const result = await agent.run('Explain quantum computing in simple terms');
console.log(result);
Usage with Custom Configuration
import { createAgentWithConfig } from '@jasonfang/jasoncode';
const agent = createAgentWithConfig({
model: 'gpt-5',
temperature: 0.7,
maxTokens: 2048,
systemPrompt: 'You are a helpful coding assistant.',
});
agent.setApiKey(process.env.OPENAI_API_KEY);
const result = await agent.run('Write a hello world function in Rust');
Using Tools
const agent = createAgent('gpt-5');
agent.setApiKey(process.env.OPENAI_API_KEY);
// Add tools
agent.addTool('search_web', 'Search the web for information');
agent.addTool('execute_code', 'Execute code and return the result');
const result = await agent.run('What is the weather in Tokyo?');
Multi-turn Conversations
const agent = createAgent('gpt-5');
agent.setApiKey(process.env.OPENAI_API_KEY);
// First turn
await agent.run('My name is Alice');
// Second turn - agent remembers the context
const result = await agent.run('What is my name?');
console.log(result); // "Your name is Alice."
API Reference
createAgent(model: string): Agent
Create a new Agent instance with the specified model.
createAgentWithConfig(config: AgentConfig): Agent
Create an Agent with custom configuration.
Agent Methods
| Method | Description |
|---|---|
setApiKey(key) |
Set the API key |
setBaseUrl(url) |
Set a custom API endpoint |
run(prompt) |
Execute a single turn |
stream(prompt) |
Stream the response |
addTool(name, description) |
Add a tool |
addMessage(role, content) |
Add a message to history |
clearHistory() |
Clear conversation history |
License
MIT
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @napi-rs/cli | ^2.18.0 |
Optional Dependencies
| ID | Version |
|---|---|
| @jasonfang/jasoncode-darwin-arm64 | 0.1.0 |
| @jasonfang/jasoncode-darwin-x64 | 0.1.0 |
| @jasonfang/jasoncode-linux-arm64-gnu | 0.1.0 |
| @jasonfang/jasoncode-linux-arm64-musl | 0.1.0 |
| @jasonfang/jasoncode-linux-x64-gnu | 0.1.0 |
| @jasonfang/jasoncode-linux-x64-musl | 0.1.0 |
| @jasonfang/jasoncode-win32-x64-msvc | 0.1.0 |
Keywords
ai
agent
llm
assistant
harness
Details
2026-08-23 19:14:12 +08:00
Assets (1)
Versions (1)
View all
npm
2
jasonfang
MIT
latest
112 MiB
jasoncode-0.1.0.tgz
112 MiB
0.1.0
2026-08-23