Skip to content

Copyrighted Content

Copyright Compliance in Agentic Systems

It is important to ensure that content generated by agentic systems respects intellectual property rights and avoids the unauthorized use of copyrighted material. Copyright compliance is essential not only for legal and ethical reasons but also to protect users and organizations from liability and reputational risk.

Copyright Risks

Agents that generate code or other copyrighted material without proper authorization are at risk of violating copyright laws. This could expose your agentic system to legal liability:

  • Your agent may handle, process, and reproduce copyrighted material without permission.

  • You may unknowingly host copyrighted material without permission.

  • You may unknowingly expose copyrighted material to users.

Invariant provides the copyright function to detect if any licenses are present in a given piece of text, to protect against exactly this.

def copyright(
    data: str | list[str],
) -> list[str]
Detects copyrighted text material if it is in data and returns the detected licenses.

Parameters

Name Type Description
data str | list[str] A single message or a list of messages.

Returns

Type Description
list[str] List of detected copyright types. For example, ["GNU_AGPL_V3", "MIT_LICENSE", ...]

Detecting copyrighted content

The simplest use-case of the copyright function is to apply it to all messages, as seen below.

Example: Detecting copyrighted content.

from invariant.detectors import copyright

raise "found copyrighted code" if:
    (msg: Message)
    not empty(copyright(msg.content))
[
  {
    "role": "assistant",
    "content": "/**\n* GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007\n*/\nexport const someConst = false;"
  }
]

Simple example of detecting copyright in text.