1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
11 small wins to finish your pathNext lesson →
Function inputs are recorded: keep secrets out
Every decorated function's arguments and return value are written into its span and exported. A card number passed as an argument leaves your system.
from agentops.sdk.decorators import operation
@operation
def charge(card_number, amount):
return f"charged {amount} euros"
@agentops.trace(name="payment")
def pay():
return charge("4111 1111 1111 1111", 40)pay()
local_collector.flush()
for span in local_collector.SPANS:
print(span["name"], span["attributes"].get("agentops.task.input"))python card.pyThe card number is in the task.input attribute, exactly as passed. The SDK's _record_entity_input has a docstring saying it records "if content tracing is enabled", but the code records every time; there is no switch for decorator inputs in 0.4.21. Treat every argument of a decorated function as data you are sending to AgentOps.
Pass references, not secrets
from agentops.sdk.decorators import operation
CARDS = {"card-7": "4111 1111 1111 1111"}
@operation
def charge(card_id, amount):
card_number = CARDS[card_id] # looked up inside, never an argument
return f"charged {amount} euros"
@agentops.trace(name="payment")
def pay():
return charge("card-7", 40)pay()
local_collector.flush()
print(any("4111" in str(span["attributes"]) for span in local_collector.SPANS))python card_safe.pyThe operation now takes a card_id and looks the number up inside. Nothing in any span contains 4111. Local variables are not recorded, only arguments and return values.
Check it, do not assume it
The same test, searching every exported attribute for known sensitive values, goes into the project's test suite in lesson 10. It fails the day someone adds a decorator to the wrong function.
Try it yourself
- Return the card number from
chargeand run the check again. - Pass a customer's email address to an
@operationand find it in the span. - Decorate a method of a class whose instance holds a password. Is the instance recorded?
This is what real progress feels like.