Skip to content

feat: agents apis#375

Merged
Natalia Markitantova (markitosha) merged 5 commits intomasterfrom
feat-agents-apis
Apr 15, 2026
Merged

feat: agents apis#375
Natalia Markitantova (markitosha) merged 5 commits intomasterfrom
feat-agents-apis

Conversation

@tve-corti
Copy link
Copy Markdown
Contributor

@tve-corti Thijs van der Velden (tve-corti) commented Apr 13, 2026

Summary

This pull request adds two new helper methods to the SDK to improve developer experience when working with agent cards and authentication headers.

Changes

1. Add agents.getCardUrl() method

Introduces a new helper method getCardUrl(agentId: string): Promise<URL> to the agents client that constructs the URL for retrieving an agent's card JSON file. The method automatically resolves the correct environment-specific base URL and builds the path /agents/{agentId}/agent-card.json.

Implementation:

  • Creates new CustomAgents class extending the auto-generated AgentsClient
  • Integrates custom agents client into CortiClient

Test coverage: Unit tests for various agent IDs, environments (eu, us, dev-eu), authentication methods (client credentials, bearer token), and URL encoding edge cases.

2. Add getAuthHeaders() method

Adds a new public method getAuthHeaders(): Promise<Headers> to CortiClient that returns a Headers object containing the Authorization header with the current access token and the Tenant-Name header. This simplifies header construction for developers making custom API requests.

Implementation:

  • Retrieves authentication request from the configured auth provider
  • Combines Authorization header with tenant name from client options

Test coverage: Comprehensive tests covering client credentials, bearer tokens, async token retrieval, error propagation, and header structure validation.

Files Modified

  • CortiClient.ts
  • CustomAgents.ts (new)
  • agents.getCardUrl.integration.ts (new)
  • cortiClient.getAuthHeaders.integration.ts (new)

Copilot AI review requested due to automatic review settings April 13, 2026 13:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the SDK developer experience by adding (1) a helper for constructing the agent-card URL and (2) a helper for generating auth-related headers for custom requests.

Changes:

  • Added agents.getCardUrl(agentId) on a custom Agents client to construct /agents/{agentId}/agent-card.json against the environment-specific agents base URL.
  • Added CortiClient.getAuthHeaders() to return a Headers object containing Authorization and Tenant-Name.
  • Added unit tests covering these helpers across auth/environment scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
src/custom/CortiClient.ts Integrates CustomAgents into CortiClient and adds getAuthHeaders() helper.
src/custom/agents/CustomAgents.ts Introduces CustomAgents extending the generated AgentsClient and adds getCardUrl().
tests/custom/agents.getCardUrl.test.ts Adds tests for the new agents.getCardUrl() helper.
tests/custom/cortiClient.getAuthHeaders.test.ts Adds tests for the new CortiClient.getAuthHeaders() helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/custom/agents/CustomAgents.ts Outdated
Comment thread src/custom/agents/CustomAgents.ts Outdated
Comment thread src/custom/CortiClient.ts Outdated
Comment thread tests/custom/cortiClient.getAuthHeaders.test.ts Outdated
Comment thread tests/custom/agents.getCardUrl.test.ts Outdated
Comment thread tests/custom/cortiClient.getAuthHeaders.test.ts Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Only one comment about comment 😅 (and you have to fix linter anyway)
Ping me if you need instructions how to "release" a version (I believe I didn't update docs yet)!

Comment thread src/custom/agents/CustomAgents.ts Outdated
@markitosha Natalia Markitantova (markitosha) merged commit 8e9eeed into master Apr 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants