Sub agent sessions are not getting established when called via OSDK

We have a main agent and a sub-agent. The main agent makes calls to the sub-agent in certain scenarios, and we have exposed the main agent via OSDK. However, it is unable to establish a session ID for the sub-agent.

Everything works fine on the Foundry platform.

A direct main agent call works via OSDK when no sub-agent call is required.

A direct sub-agent call also works via OSDK (We tested this and so it’s not a permission issue).

It only fails when the main agent makes calls to the sub-agent via OSDK.

Hey @RajKarri, the tool call in your screenshot fails because ri.session.main.session.default isn’t a valid session rid. The AIP Agent should either call the function with a real session rid or leave the parameter empty.

From the thought:

"Let me try a different approach by providing a session RID parameter to the Agent."

It appears the AIP Agent already attempted to call the function previously and failed. It would be helpful to examine the previous tool call attempt to understand why that failed.

Initial error was this. Both main agent and sub agent are in the same org, we could make calls to those agents separately via OSDK. Not sure why main agent not able to establish a session for the sub agent here.

Are you using client credentials to call the top-level AIP Agent? Unfortunately, AIP Agent functions do not work when called with client credentials, and this limitation propagates to AIP Agents calling other AIP Agent functions.

Yes, we do. It seems that’s the issue. Is this in your roadmap?
Or, as a workaround, how about we generate a session ID for the sub-agent and pass it as a parameter?

Yes, fixing this limitation is on our roadmap, but we don’t have clear timelines yet.

That’s an excellent workaround idea! You can create the session with the child agent through the platform APIs, which support client credentials, and then pass the session RID to the parent agent as a parameter. You can also use the new deterministic tool inputs feature to automatically pass the session RID parameter to the child agent.

1 Like

Hey @RajKarri as a quick update again here, we’ve added a fix to support using client credentials with AIP Agent functions, which should be rolling out over the next week!

1 Like

Awesome! Thanks for the update.