Connect to Agent Tools using connection string and agent id

Varsha Ravichandran 0 Reputation points Microsoft Intern
2025-06-21T00:57:28.97+00:00

Hi,

I am trying to connect to an Agent in AI Foundry. It has its backend code written in C#. It has a few Tools to perform certain actions that require access to azure repos. I am creating a web app, who's backend is in python, that is accessing this Agent via the connection_string and agent_id.

I see that the Tools are not accessible from the web app even though it is present in the agent definition. That is when I print details about the agent, it has id, name, description etc and also "Tools" that has the names of these functions. But when the functions need to be triggered, it says they arent accessible, I get this error saying the function required to perform this action is not present in the toolset.

can someone please help me with this error?

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
3,598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chiugo Okpala 1,905 Reputation points MVP
    2025-06-22T13:26:08.59+00:00

    @Varsha Ravichandran welcome to the Micosoft Q&A community.

    You can troubleshoot the error using the following steps below:

    1. Check Tool Registration in the Agent Backend

    Even though the tools appear in the agent’s metadata (i.e. their names show up when you print), they might not be properly registered or initialized in the backend C# code. Make sure that:

    • The tools are added to the agent's toolset during startup.
    • Any dynamic registration code isn’t skipping them due to configuration or context.
    1. Validate Access Permissions

    Since these tools interact with Azure Repos:

    • Ensure your Agent has the appropriate Azure identity (e.g. managed identity or credentials) and permissions to access those repo resources.
    • If authentication or permission errors occur, the agent might silently fail to attach the tools.
    1. Inspect Tool Execution Interfaces

    Your Python backend likely sends an execution request to the agent for a tool. Confirm that:

    • The tool’s name matches exactly (case-sensitive, no typos).
    • The tool has a defined execution handler in C# that’s exposed through the Agent’s endpoint.
    • If you’re using OpenAPI or a schema registry, confirm that the tool is described properly there and accessible to external callers.
    1. Debug the Agent’s Response

    When the agent replies that the tool isn’t part of the toolset:

    • Log the toolset from the agent’s perspective right before invocation.
    • You might find that although the name appears in a config, it was never fully activated at runtime.
    1. Cross-Language Invocation Check

    Since your app is Python and your agent backend is C#, look into whether:

    • The serialization format is consistent (e.g. JSON schema).
    • The Python client is using the correct API version and authentication tokens when calling the agent.

    N/B: I have generated the above answer using co-pilot as an AI tool. Also I have validated and updated the AI output.

    If you can share a snippet of how you're invoking the tool from Python (minus anything sensitive), I can give more specific guidance.

    I hope these helps. Let me know if you have any further questions or need additional assistance.

    Also if these answers your query, do click the "Upvote" and click "Accept the answer" of which might be beneficial to other community members reading this thread.

    User's image


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.