A3S Docs
A3S CodeExamples

Quick Start

Basic send, streaming, and multi-turn conversation

Quick Start

The simplest way to use A3S Code: create an agent, bind it to a workspace, and send a prompt.

IMPORTANT: You must configure permissive: true in SessionOptions, or you'll get the error: "confirmation manager isn't configured". This allows tools to execute without manual confirmation. See Security for production configurations.

Basic Send

import { Agent } from '@a3s-lab/code';

const agent = await Agent.create('~/.a3s/config.hcl');
const session = agent.session('/my-project', { permissive: true });

const result = await session.send('What files handle authentication?');
console.log(result.text);
console.log(`Tokens: ${result.totalTokens}`);

Run: node examples/agentic_loop_demo.ts Source: sdk/node/examples/agentic_loop_demo.ts

import a3s_code

agent = a3s_code.Agent.create("~/.a3s/config.hcl")
session = agent.session("/my-project", permissive=True)

result = session.send("What files handle authentication?")
print(result.text)
print(f"Tokens: {result.total_tokens}")

Run: python examples/agentic_loop_demo.py Source: sdk/python/examples/agentic_loop_demo.py

Multi-Turn Conversation

History is automatically accumulated after each send() call.

const session = agent.session('/my-project', { permissive: true });

const r1 = await session.send('Create a file called hello.rs');
console.log('Turn 1:', r1.text);

const r2 = await session.send('Now add a main function to it');
console.log('Turn 2:', r2.text);

const r3 = await session.send('Run it and show me the output');
console.log('Turn 3:', r3.text);

const history = session.history();
console.log('Total messages:', history.length);
session = agent.session("/my-project", permissive=True)

r1 = session.send("Create a file called hello.rs")
print(f"Turn 1: {r1.text}")

r2 = session.send("Now add a main function to it")
print(f"Turn 2: {r2.text}")

r3 = session.send("Run it and show me the output")
print(f"Turn 3: {r3.text}")

history = session.history()
print(f"Total messages: {len(history)}")

Resilient Session

Configure parse retries, tool timeout, and circuit breaker for production use.

const session = agent.session('/my-project', {
  permissive: true,
  maxParseRetries: 3,
  toolTimeoutMs: 30_000,
  circuitBreakerThreshold: 5,
});
session = agent.session("/my-project",
    permissive=True,
    max_parse_retries=3,
    tool_timeout_ms=30_000,
    circuit_breaker_threshold=5,
)

permissive: true skips HITL confirmation — suitable for demos and CI. In production, configure a permission policy instead.

API Reference

SessionOptions

Prop

Type

AgentResponse

Prop

Type

On this page