# Agent tools and Java backend RPCs

> November 26, 2026 · https://eldermoraes.com/agent-tools-and-java-backend-rpcs/

On November 19, Ze'ev Klapow explained on the [HubSpot engineering blog](https://hubspot.engineering/blog/aviator-hubspots-agent-harness/) how the company built Aviator, the Java harness that now runs its agents. Most of HubSpot's backend is Java, and the team wanted agents to live inside the services teams already owned, with the same tools, the same data and the same deployment process as the rest of their code. The post includes a production number: Sidekick Code, the cloud coding agent that runs on Aviator, merges more than 2,500 pull requests a week.

The post covers a lot, from switching models mid-conversation to the sandbox. Here I will focus on one part that matters to anyone with a large Java backend: what happens when existing RPCs become agent tools.

## Why a harness of their own

In June 2025, HubSpot started looking for an agent framework for its teams. Each team building an agent made different choices, from the model to the architecture, and the same mistakes kept coming back. According to the post, prompt caching, tool calling and context management are easy to get subtly wrong, and each team was learning that on its own. HubSpot wanted to solve those problems once, so that a fix would reach every agent at the same time.

The DevEx AI team had been trying smolagents, in Python, for internal tooling. It worked, but integrating Python agents with the Java services was a lot of work. The goal was for a team to add an agent to a service it already owned and deploy it with the rest of the code. That became a target: write an agent in under 20 lines of Java.

## The RPC that becomes a tool

HubSpot already had CHIRP, its internal RPC framework, and the CHIRP tools framework, which is part of the company's MCP servers. With it, a team adds annotations to an existing RPC and exposes it as a tool. The tool schema is generated from the request type. In Aviator, the `addChirpTool` method brings the same idea to the agent: an existing RPC becomes a tool, without asking engineers for a lot of new work.

During an infrastructure hackathon, a team that had never built an agent had a debugging agent working in about fifteen minutes, using the RPCs it already had as tools.

I like this path because the tool delegates to the service that already exists. The authorization, auditing and observability in that service keep working. In a [post from May](https://eldermoraes.com/the-mcp-java-sdk-as-an-anti-corruption-layer/), I pointed at the other side of it. A tool should expose a capability of the domain, and a tool that mirrors an endpoint leaks the storage model behind it.

## More than 3,000 tools

Reusing services made it easy to add tools, and that sped up adoption. The problem showed up quickly: Sidekick, HubSpot's primary engineering assistant, came to need more than 3,000 tools.

Aviator ships a few solutions for this, and each team picks the ones it uses. One of them is marking tools as deferred. Their definitions stay out of the agent's initial context and become available through tool search. Anthropic and OpenAI have hosted tool search, with subtle differences between the two, and Aviator uses the provider's version when it exists. For the models HubSpot hosts itself, Aviator builds an internal search index on the fly, based on each agent's configuration.

The post does not show Aviator's internals. To see the idea working, I wrote a sketch using only the JDK. The service gets an annotation, the schema comes from the request record, and deferred tools stay out of the initial context:

```java
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface Tool {
    String description();
    boolean deferred() default false;
}

record DealActivity(long dealId, int days) {}

static class DealService {
    @Tool(description = "Lists the recent activity of a deal", deferred = true)
    public String dealActivity(DealActivity request) {
        return "deal " + request.dealId() + ": 2 meetings in the last " + request.days() + " days";
    }
    // in the full program, two more tools: searchDeals and companyDetails
}

static String schemaOf(Class<?> requestType) {
    return Arrays.stream(requestType.getRecordComponents())
            .map(c -> "\"" + c.getName() + "\": \"" + c.getType().getSimpleName() + "\"")
            .collect(Collectors.joining(", ", "{", "}"));
}

// Only tools that are not deferred go into the initial context.
static List<ToolDefinition> initialContext(List<ToolDefinition> tools) {
    return tools.stream().filter(t -> !t.deferred()).toList();
}

// Deferred tools show up when the agent searches for them.
static List<ToolDefinition> search(List<ToolDefinition> tools, String term) {
    return tools.stream()
            .filter(t -> t.deferred() && t.description().toLowerCase().contains(term.toLowerCase()))
            .toList();
}
```

In the full program, `DealService` has three tools, and only `searchDeals` is not deferred. The initial context carries only that one. A search for "activity" returns `dealActivity`, and the call goes to the service method, which answers the way it always did. The tool schema comes out as `{"dealId": "long", "days": "int"}`, in the order the fields appear in the record.

## Skills that bring their tools

Search finds the tool, but the post itself says that this often fails to give the agent context on how and when to use it. For that, Aviator uses skills, in the SKILL.md format from the [Agent Skills specification](https://agentskills.io/specification). HubSpot added two metadata fields. Tools listed in `load-tools` become callable as soon as the agent loads the skill. Tools listed in `suggested-tools` become findable through search, without being loaded.

Until it loads a skill, the agent sees only its name and description, one line per skill in every prompt. The instructions enter the context only when the agent loads the skill. Breeze Assistant, the AI assistant HubSpot offers its customers inside the product, now uses a minimal set of embedded tools and loads the rest through skills.

I see skills as an answer to the problem from my May post. The tool is still the service RPC. The skill wraps the use case around it: the task, the steps and the tools involved. And each skill is an independent piece that a team can own, evaluate and roll out, the same way it does with code.

## The rest of the harness

Two other Aviator decisions caught my attention. The first is the transcript format. Aviator has its own format for messages, tool calls and results, and that format does not depend on any provider. Each model client translates it to its provider's API. This makes it possible to switch models mid-conversation, for example to fall back to another provider during an outage. The transcript is the complete state of the conversation, and it serializes to JSON. The application can save that JSON and resume the conversation later, on another machine, minutes or days afterwards. That is what lets an agent pause while it waits for someone to approve a tool call.

The second is the sandbox. Aviator gives the agent a Python environment, through [Boomslang](https://github.com/HubSpot/boomslang), and a Bash environment, both running in WASM. That way the sandbox ships inside the Aviator Java library, and an agent that executes code needs nothing external. The code can only reach the few egress points HubSpot defines. Boomslang is public on GitHub, under the Apache 2.0 license.

## The agent inside the service

The post closes by saying they started with twenty lines of Java because they wanted building an agent to be an ordinary part of building a HubSpot service. What I take from it is where the agent runs: inside the Java service, with the deployment, data and tools the team already had. In that place, working with agents stays close to what a Java team already does every day, with contracts, access control and observability.

## References

- Ze'ev Klapow, [Aviator: HubSpot's Agent Harness](https://hubspot.engineering/blog/aviator-hubspots-agent-harness/), HubSpot Engineering, November 19, 2026.
- HubSpot, [Boomslang](https://github.com/HubSpot/boomslang), GitHub repository.
- Agent Skills, [Specification](https://agentskills.io/specification).
- Elder Moraes, [The MCP Java SDK as an Anti-Corruption Layer](https://eldermoraes.com/the-mcp-java-sdk-as-an-anti-corruption-layer/), eldermoraes.com, May 21, 2026.
- Oracle, [java.lang.Class Javadoc](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Class.html) (`getRecordComponents`), Java SE 21.
