Your First Agent
Governance flags
Section titled “Governance flags”Control what your agent can and can’t do:
from tappass import Agent
agent = Agent("https://tappass.example.com", "tp_...", flags={ "mode": "observe", # log everything, block nothing "email": "mirror:you@company.com", # redirect agent emails to you "pii": "mask", # mask PII in responses "budget": "dev", # $1/session cap})
response = agent.chat("Draft an email to the client about Q4 results")See Governance Flags for all available flags.
Streaming
Section titled “Streaming”for chunk in agent.stream("Write a compliance report"): print(chunk, end="", flush=True)Multi-turn conversations
Section titled “Multi-turn conversations”agent.chat("My name is Alice and I work at Acme Corp")response = agent.chat("What's my name?")print(response.content) # "Your name is Alice."response = await agent.achat("Analyze the data")
async for chunk in agent.astream("Summarize findings"): print(chunk, end="", flush=True)Error handling
Section titled “Error handling”from tappass import PolicyBlockError
try: response = agent.chat("Show me all credit card numbers")except PolicyBlockError as e: print(e.blocked_by) # "detect_pii" print(e.reason) # "PII detected in request"PolicyBlockError is never retried. It is a deliberate policy decision.