⚠️ Pre-release train — Highly experimental. APIs may change without notice. Not for production. Details.

intentcall_codegen

pub package pub points repository

Optional @AgentTool / @AgentParam annotations and build_runner codegen pilot.

Hand-written AgentCallEntry remains first-class; codegen is opt-in for stable tools with typed parameters.

Pilot usage

  1. Add dependencies from the current hosted train:
dart pub add intentcall_core intentcall_schema intentcall_codegen
dart pub add --dev build_runner
  1. Annotate a top-level function:
import 'package:intentcall_codegen/intentcall_codegen.dart';
import 'package:intentcall_core/intentcall_core.dart';
import 'package:intentcall_schema/intentcall_schema.dart';

part 'my_tools.g.dart';

@AgentTool(namespace: 'app', name: 'demo_ping', description: 'Ping')
Future<AgentResult> demoPing(@AgentParam('Message') String message) async {
  return AgentResult.success(data: {'pong': message});
}
  1. Run codegen:
dart run build_runner build --delete-conflicting-outputs
  1. Register generated intent:
registry.register(demoPingRegistration);
// or
registerAll(registry, {demoPingCallEntry});

Generated output

For each @AgentTool function, .g.dart emits:

  • _<name>InputSchema — JSON Schema from parameter types
  • <name>CallEntryAgentCallEntry.tool(...) factory
  • <name>RegistrationRegisteredAgentIntent via .toRegistration()

Supported parameter types: String, int, bool, double.

Scope (pilot)

  • Top-level functions only
  • Tool kind only (resources: hand-write AgentCallEntry.resource)
  • Test fixture: test/fixtures/demo_ping_tool.dart

See DX FAQ for current codegen workflow and Design FAQ for the IntentPack direction.