# AgentBuilder

To create an [Agent](https://github.com/ic4j/ic4j-agent/blob/master/src/main/java/org/ic4j/agent/Agent.java) Java object the [AgentBuilder](https://github.com/ic4j/ic4j-agent/blob/master/src/main/java/org/ic4j/agent/AgentBuilder.java) build method is used.&#x20;

1\) Use transport method passing [ReplicaTransport](/reference/api-reference/replicatransport.md) parameter.

```java
new AgentBuilder().transport(replicaTransport);
```

2\) Use identity method passing [Identity](/reference/api-reference/identity.md) parameter.

```java
new AgentBuilder().identity(identity)
```

3\) IngresExpiry provides a default ingress expiry. This is the delta that will be applied at the time an update or query is made. Use Java [Duration](https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html) type parameter.

```java
new AgentBuilder().ingresExpiry(Duration.ofSeconds(300));
```

4\) Creation of an Agent object.

```java
Agent agent = new AgentBuilder().transport(replicaTransport)
.identity(identity)
.ingresExpiry(Duration.ofSeconds(300))
.build();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ic4j.com/reference/api-reference/agentbuilder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
