DEDUPED Hot AI repos, turned into use cases Get 5 a day

How to validate PACT messages with protocol schemas with Openpactprotocol

Check Agent Cards, messages, errors, and JWT claims against the Zod schemas.

Authorization notice. Openpactprotocol is dual-use. Only use it on software, sites and systems you own or have explicit permission to test.

Who it is forA developer or coding agent writing a Provider or personal agent that must reject malformed PACT payloads before acting on them.

The problemHand-written checks drift from the spec, so malformed Agent Cards or JWT claims can slip through.

The outcomeIncoming PACT objects are parsed against the protocol package, and invalid objects produce clear validation errors.

What you need first

  • Node.js and pnpm installed
  • Git access to clone openpactprotocol/openpactprotocol
  • PostgreSQL for the reference Provider, as named in the README
  • Basic familiarity with TypeScript and OAuth concepts

Steps

  1. Open packages/protocol to find the Zod schemas for Agent Card, messages, errors, and JWT claims.
  2. Add @openpactprotocol/protocol to your project with pnpm add @openpactprotocol/protocol. (inferred, check the README)
  3. Call the matching schema's parse or safeParse method on each incoming object.
  4. Log the validation errors for any object that fails and reject it.
  5. Run your existing tests with a sample Agent Card and a malformed one.

Prompt for your agent

In the openpactprotocol/openpactprotocol repo, use the Zod schemas in packages/protocol to validate the sample payload at <payload-path>. Output whether it is an Agent Card, a message, an error, or JWT claims, and list any validation errors. Verify the result by running the schema against one valid and one invalid sample.

Caveat. The package name @openpactprotocol/protocol comes from the README, but the install command is inferred, so confirm the published package name before adding it.

Share: X LinkedIn Hacker News Email Copy link

Disclaimer

Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page