Skip to content

feat:added typescript sdk supports openai-sdk#40

Open
Adarsh9977 wants to merge 10 commits into
secureagentics:mainfrom
Adarsh9977:ts-sdk-openai
Open

feat:added typescript sdk supports openai-sdk#40
Adarsh9977 wants to merge 10 commits into
secureagentics:mainfrom
Adarsh9977:ts-sdk-openai

Conversation

@Adarsh9977

Copy link
Copy Markdown
Contributor

Summary

  • Implemented a typescriptsdk supports openai-sdk as of now with proper documentation and examples
  • Clarifies the TypeScript SDK architecture, including the split between the core event/policy pipeline and provider-specific adapters.
  • Expands OpenAI SDK docs with practical examples for chat completions, Responses API, streaming, metadata, tool execution, and policy-block handling.
  • Improves core SDK docs with manual callback wiring, custom event handlers, local-only logging, and environment variable guidance.

Test plan

From Repo root

  • npm test

For Specific Packages

  • npm test -w @secureagentics/adrian
  • npm test -w @secureagentics/adrian-openai

Checklist

  • CLA signed (see CLA.md)
  • Tests pass locally
  • Docs updated where needed
  • British English; no em-dashes; no marketing fluff

@Adarsh9977 Adarsh9977 changed the title Ts sdk OpenAI feat: Added typescript sdk supports openai-sdk Jun 8, 2026
@Adarsh9977 Adarsh9977 changed the title feat: Added typescript sdk supports openai-sdk feat:added typescript sdk supports openai-sdk Jun 8, 2026
@shahtajkhalid shahtajkhalid added the enhancement New feature or request label Jun 9, 2026
@shahtajkhalid

Copy link
Copy Markdown
Contributor

Thanks @Adarsh9977, this is a valuable contribution. To keep this reviewable and to avoid collisions with in-flight internal work, let's split this into three parts:

  1. Repo Restructure: We are handling this and making the current structure extendable. So please drop the sdk/ move and any edits to existing paths from your PRs.

  2. PR 1 - TypeScript Core: Please create a new PR for the typescript conversion. One major thing we'll be looking at in review is block mode on a verdict timeout and during the pre-policy window should fail open to match our documented posture, the current gate fails closed (the feature to support fail-closed is planned too, but it shouldn't be in this PR).

  3. PR 2 - OpenAI Support: pls open this one on top of PR 1.

Also, pls ensure each PR has its relevant tests, no additional changes. Our restructure PR will go first and we'll ping you when it's time to rebase. Once you raise the two split PRs, we'll close this one in favor of them.

Thank you!

@Adarsh9977

Copy link
Copy Markdown
Contributor Author

Thanks @Adarsh9977, this is a valuable contribution. To keep this reviewable and to avoid collisions with in-flight internal work, let's split this into three parts:

  1. Repo Restructure: We are handling this and making the current structure extendable. So please drop the sdk/ move and any edits to existing paths from your PRs.
  2. PR 1 - TypeScript Core: Please create a new PR for the typescript conversion. One major thing we'll be looking at in review is block mode on a verdict timeout and during the pre-policy window should fail open to match our documented posture, the current gate fails closed (the feature to support fail-closed is planned too, but it shouldn't be in this PR).
  3. PR 2 - OpenAI Support: pls open this one on top of PR 1.

Also, pls ensure each PR has its relevant tests, no additional changes. Our restructure PR will go first and we'll ping you when it's time to rebase. Once you raise the two split PRs, we'll close this one in favor of them.

Thank you!

Thanks @shahtajkhalid for your review, I'll look into your mentioned points

@yanny-sec

Copy link
Copy Markdown
Contributor

PR looks good overall, a few things to address first:

  • README claims setting wsUrl to null is for local testing without websocket but if wsUrl is null, it defaults to localhost:8080
  • Block-mode should fail open instead of fail closed as it currently is documented for the Python SDK. In the short term we will allow the user to configure the failure policy too via the dashboard.
  • Quota-exhausted (4003) backoff is unreachable code. This is only relevant for the hosted version but nonetheless should honour it by attempting to reconnect after 60 seconds like the Python SDK.
  • README.md + packages/core/README.md should be merged into one. For each new language the SDK covers, the main repo readme can reference the respective readme at the root of the language.
  • Use switch case instead of repeating if here
  • Core files like sdk/typescript/packages/openai/src/index.ts need more comments.
  • Environment variables shouldn't take precedence over explicit parameters/options on init
  • A bit of a selfish ask can we mirror the Python SDK's adrian.init for TS as well? adrian becomes an object instead of a function.

You can rebase from main now to get the new dir structure of the project that accounts for the new sdk folder.

@Adarsh9977

Copy link
Copy Markdown
Contributor Author

PR looks good overall, a few things to address first:

  • README claims setting wsUrl to null is for local testing without websocket but if wsUrl is null, it defaults to localhost:8080
  • Block-mode should fail open instead of fail closed as it currently is documented for the Python SDK. In the short term we will allow the user to configure the failure policy too via the dashboard.
  • Quota-exhausted (4003) backoff is unreachable code. This is only relevant for the hosted version but nonetheless should honour it by attempting to reconnect after 60 seconds like the Python SDK.
  • README.md + packages/core/README.md should be merged into one. For each new language the SDK covers, the main repo readme can reference the respective readme at the root of the language.
  • Use switch case instead of repeating if here
  • Core files like sdk/typescript/packages/openai/src/index.ts need more comments.
  • Environment variables shouldn't take precedence over explicit parameters/options on init
  • A bit of a selfish ask can we mirror the Python SDK's adrian.init for TS as well? adrian becomes an object instead of a function.

You can rebase from main now to get the new dir structure of the project that accounts for the new sdk folder.

cool @yanny-sec, Thanks for this fast restructure. I'll make sure to cover all your points.

@Adarsh9977 Adarsh9977 mentioned this pull request Jun 11, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants