Files
hanzoai/example/hanzoai_example.dart
zeekay fe31141cfd hanzoai: Dart client for the Hanzo Cloud /v1/ platform API
First-class services for agents, agent sessions, and machines with Hanzo
IAM-native Bearer auth; raw send() escape hatch for the full /v1/cloud/*
surface. Mirrors the @hanzo/cloud JavaScript client.

dart format + analyze --fatal-infos clean, 22 tests green, pub publish
dry-run: 0 warnings.
2026-07-04 01:10:53 -07:00

26 lines
833 B
Dart

import 'package:hanzoai/hanzoai.dart';
/// Minimal end-to-end shape: create an agent, run it, watch its sessions.
///
/// Run against a real deployment with a Hanzo IAM token:
/// HANZO_TOKEN=... dart run example/hanzoai_example.dart
Future<void> main() async {
final cloud = HanzoCloud(token: const String.fromEnvironment('HANZO_TOKEN'));
final agent = await cloud.agents.create(
name: 'researcher',
model: 'zen-coder',
instructions: 'You research and summarize.',
tools: ['search', 'fetch'],
);
print('created ${agent.name} (${agent.id})');
final run = await cloud.agents.run(agent.name, input: 'Summarize RFC 8628.');
print('run ${run.status}: ${run.output}');
final sessions = await cloud.sessions.list(status: 'running');
print('${sessions.length} running session(s)');
cloud.close();
}