Official SDKs

Deploy multi-chain AI agents in 5 lines of code

Py

Python SDK

Official Python client for Valence API

Installation

pip install valence-sdk

Quick Start

from valence import Valence

# Initialize client
client = Valence(api_key="vln_live_...")

# Deploy an agent
agent = client.agents.create(
    name="My Trading Bot",
    operation_type="monitor",
    chain_ids=[1, 3]  # Ethereum + Arbitrum
)

print(f"Agent {agent['name']} deployed!")

Features

✓ Agents
Create, manage, and monitor AI agents
✓ Events
Real-time activity feed and logs
✓ Meta-Agents
Orchestrate multiple sub-agents
✓ Workflows
Multi-step cross-chain operations
✓ Webhooks
Subscribe to events with HMAC signatures
✓ Wallets
Query agent wallets and transactions
JS

JavaScript/TypeScript SDK

Official Node.js client for Valence API

Installation

npm install valence-sdk
# or
yarn add valence-sdk

Quick Start

import { Valence } from 'valence-sdk';

// Initialize client
const client = new Valence({ apiKey: 'vln_live_...' });

// Deploy an agent
const agent = await client.agents.create({
  name: 'My Trading Bot',
  operationType: 'monitor',
  chainIds: [1, 3] // Ethereum + Arbitrum
});

console.log(`Agent ${agent.name} deployed!`);

TypeScript Support

import { Valence, Agent, Event } from 'valence-sdk';

const client = new Valence({ apiKey: 'vln_live_xxx' });
const agents: Agent[] = await client.agents.list();

Features

✓ Full TypeScript
Complete type definitions included
✓ Async/Await
Promise-based API with modern syntax
✓ Same API
Identical features as Python SDK
✓ Node.js 16+
Works with all modern Node versions

Common Examples

Create a Multi-Chain Monitor

Python
agent = client.agents.create(
    name="DEX Monitor",
    operation_type="monitor",
    chain_ids=[1, 3, 4],
    description="Monitors DEX trades"
)

print(f"Agent ID: {agent['id']}")
JavaScript
const agent = await client.agents.create({
  name: 'DEX Monitor',
  operationType: 'monitor',
  chainIds: [1, 3, 4],
  description: 'Monitors DEX trades'
});

console.log(`Agent ID: ${agent.id}`);

Subscribe to Webhooks

Python
webhook = client.webhooks.create(
    url="https://myapp.com/webhooks",
    events=["agent.created", "event.created"]
)

secret = webhook['secret']
JavaScript
const webhook = await client.webhooks.create({
  url: 'https://myapp.com/webhooks',
  events: ['agent.created', 'event.created']
});

const secret = webhook.secret;

Create a Meta-Agent

Python
meta_agent = client.meta_agents.create(
    name="Coordinator",
    strategy={
        "type": "load_balanced",
        "decision_criteria": "latency"
    },
    chains=[1, 3, 4, 5]
)
JavaScript
const metaAgent = await client.metaAgents.create({
  name: 'Coordinator',
  strategy: {
    type: 'load_balanced',
    decisionCriteria: 'latency'
  },
  chains: [1, 3, 4, 5]
});

Create a Multi-Step Workflow

Python
workflow = client.workflows.create(
    name="Cross-chain swap",
    trigger_type="manual",
    steps=[
        {
            "step_order": 1,
            "step_type": "monitor",
            "agent_id": 42,
            "chain_id": 1
        }
    ]
)
JavaScript
const workflow = await client.workflows.create({
  name: 'Cross-chain swap',
  triggerType: 'manual',
  steps: [
    {
      stepOrder: 1,
      stepType: 'monitor',
      agentId: 42,
      chainId: 1
    }
  ]
});

Query Agent Wallets

Python
wallets = client.wallets.get_agent_wallets(
    agent_id=42
)

for wallet in wallets['wallets']:
    print(f"{wallet['chain']}: {wallet['address']}")
JavaScript
const result = await client.wallets.getAgentWallets(42);

result.wallets.forEach(wallet => {
  console.log(`${wallet.chain}: ${wallet.address}`);
});

Need Help?