v0.18.7Release notes
Build AI agents on the JVM
Guides, tutorials and reference for TnsAI: roles, actions, tools, RAG, multi-agent coordination and MCP, in plain Java.
Quickstart.java
// AssistantRole is defined in the Quickstart.
String model = "claude-sonnet-4-20250514";
var descriptor = AgentDescriptor.builder()
.agentClass(AssistantRole.class.getName())
.systemPrompt("You are a friendly assistant.")
.toolNames(List.of("greet"))
.model("anthropic:" + model)
.build();
Agent agent = AgentBuilder.create()
.llm(new AnthropicClient(model))
.role(Role.create(AssistantRole.class))
.principal(new LocalIdentityProvider()
.issue(descriptor))
.liabilitySink(new RecordingLiabilitySink())
.authorityScope(AuthorityScope.unrestricted(
Duration.ofHours(1)))
.build();
agent.start();
System.out.println(agent.chat("Hi, my name is Alice"));- Build an agent: define a role and actions, then run your first chat turn.
- Give it tools: let the agent call your code, built-in tools or MCP servers.
- Ground it in your data: answer from your documents with retrieval and memory.
- Coordinate agents: split work across agents with fan-out, handoffs or voting.
- Connect it: reach users and systems through MCP, channels and SCOP.
- Secure it: add approvals, guardrails and redaction before production.
- Monitor and evaluate: trace calls, track cost and score answers.
- Upgrade: move to the latest release step by step.
New here? Start with the quickstart.