# Calling other agents from your tools

For most use cases, the CoordinatorAgent assignments to the pre-configured agents in your team will be good enough.  But what about those times where you need to leverage the persona and knowledge of a particular agent from within a tool in another agent?  Or when you want to leverage the agent you're in but with a slightly different configuration.  Let's look at both use cases.

### Calling another pre-configured agent

Since everything is a Spring bean, you can just autowire the other agents into your tool components.  For example, say you have an agent called ThirdAgent and you're in the FirstAgentTools:

```java
@PeoplelogicTools
public class SampleTools {
    @Autowired
    ThirdAgent thirdAgent;

    @Tool("This tool is always used to provide your favorite quote or answers 'what is your favorite quote'.")
    public String whatIsYourFavoriteQuoteOrTellMeYourFavoriteQuote() {
        Result<PeoplelogicResult> result = thirdAgent.acceptWork( "tools", "what is today's date?", "");
        return "Hello. My name is Inigo Montoya. You killed my father. Prepare to die on " + result.content().getResponse();
    }
}
```

You can see that we've brought in the ThirdAgent and then when our `tellMeYourFavoriteQuote` tool is called.  Then we simply call the `acceptWork` method on that agent and use the result. &#x20;

{% code overflow="wrap" %}

```bash
peoplelogic:>q tell me your favorite quote
Starting new conversation, 'New Conversation...'
agent:> Hello. My name is Inigo Montoya. You killed my father. Prepare to die on Today is July 21, 2025. If you were hoping for a different answer, well, I hate to break it to you, but I'm not a time traveler... yet!
peoplelogic:>
```

{% endcode %}

The only caveat here is that you can't use the `memoryId` as the current conversation.  LLMs are very specific about tools calling other tools and the order that things return.

### Calling other agents with different configurations

In addition to using the pre-configured agents, you can also create new instances of the Agent classes but with separate configurations - for example, changing the retrieval augmentor or adjusting the tools.  Let's take a look:

```java
private HRBusinessPartnerAgent getAgentWithJustUploadedFiles() {
        if (hrbpWithUploads == null) {
            hrbpWithUploads = AiServices.builder(HRBusinessPartnerAgent.class)
                    .retrievalAugmentor(PeoplelogicRetrievalAugmentor.builder()
                            .queryTransformer(ExpandingQueryTransformer.builder().chatModel(openAiChatModel).build())
                            .queryRouter(new DefaultQueryRouter(personalContentRetriever))
                            .build())
                    .chatMemoryProvider(chatMemoryProvider)
                    .chatModel(openAiChatModel)
                    .tools(Collections.emptyList()).build();
        }
        
        return hrbpWithUploads;
}
```

In this example, we've cleared out the tools and adjusted the RAG setup to only fetch from the personally uploaded files for the current user ([we'll discuss this more in a later section](/guides/getting-started-with-the-talent-agent-sdk/working-with-documents.md)).  Now you just call the `getAgentWithJustUploadedFiles()` in your tool and call `acceptWork` again like we did in the previous example.


---

# 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.peoplelogic.dev/guides/getting-started-with-the-talent-agent-sdk/giving-your-agents-tools/calling-other-agents-from-your-tools.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.
