Python SDK
Install
Section titled “Install”pip install syloimport osfrom sylo import SyloClient, credential
sylo = SyloClient( api_url="https://sylo.runplex.dev", developer_secret=os.environ["SYLO_SECRET"],)
# Create sessionsession = sylo.create_sandbox_token( tenant_id="acme", expires_in="10m", credentials=[ credential("openai", os.environ["OPENAI_API_KEY"]), ], # mitm is auto-inferred from credential domains policies={"default": "allow"},)
# Get sandbox environment variablesenv = sylo.sandbox_env(session)# Or for proxy mode:env = sylo.proxy_env(session)
# Query audit logaudit = sylo.query_audit(tenant_id="acme")
# Revoke sessionsylo.revoke_session(session.token)credential() helper
Section titled “credential() helper”from sylo import credential
credential("openai", os.environ["OPENAI_API_KEY"])credential("github", token, name="github-read", env_var="GITHUB_READ")Built-in services (12): anthropic, openai, github, stripe, linear, slack, huggingface, cohere, replicate, groq, mistral, fireworks.
For custom APIs, use a dict:
{"name": "custom", "domain": "api.example.com", "header": "Authorization", "value": "Bearer ..."}Security profiles
Section titled “Security profiles”# Create — saved credentials + runtime slotsprofile = sylo.create_profile( name="my-agent", profile_data={ "credentials": [ credential("anthropic", os.environ["ANTHROPIC_API_KEY"]), # saved {"name": "tenant-api", "domain": "api.example.com", "header": "Authorization", "value": None}, # runtime slot ], "policies": {"default": "deny"}, },)
# Use in sessions — fill runtime slotssession = sylo.create_sandbox_token( tenant_id="customer-123", security_profile="my-agent", credentials=[ {"name": "tenant-api", "domain": "api.example.com", "header": "Authorization", "value": f"Bearer {tenant_key}"}, ],)
# CRUDprofiles = sylo.list_profiles()p = sylo.get_profile(profile["id"])sylo.update_profile(profile["id"], name="renamed")sylo.delete_profile(profile["id"])The Python SDK mirrors the TypeScript SDK API. See the TypeScript SDK reference for full parameter documentation.