TeleonTeleon AITeleon AI

Support Agent Blueprint

Build a support agent with memory, guardrails, and production runtime settings

This tutorial follows the patterns shown in the Teleon library docs, Cortex examples (support agent + auto-context), Sentinel guardrails, and Helix runtime configuration.

What you’ll build

  • A Teleon agent defined with @client.agent(...)
  • Cortex enabled with scope enforcement (customer_id) and auto-context injection
  • Sentinel enabled with content filtering + PII detection
  • Helix enabled with instance bounds and memory limits

1) Install and initialize

pip install teleon

Set your API key (recommended for production):

export TELEON_API_KEY="tlk_live_xxx"
from teleon import TeleonClient
 
client = TeleonClient(api_key="tlk_live_xxx")

2) Define the agent with Cortex + Sentinel + Helix

  • Cortex: persistent memory + optional auto-context injection
  • Sentinel: content filtering + PII detection
  • Helix: production runtime configuration (instance bounds, memory limits)
@client.agent(
    name="support",
    cortex={
        "auto": True,
        "scope": ["customer_id"],
        "auto_context": {
            "enabled": True,
            "history_limit": 20,
            "relevant_limit": 5,
        },
    },
    sentinel={
        "content_filtering": True,
        "pii_detection": True,
        "action_on_violation": "block",
    },
    helix={
        "min_instances": 1,
        "max_instances": 10,
        "memory_limit_mb": 512,
    },
)
async def support_agent(query: str, customer_id: str, cortex):
    if cortex.context:
        context = f"\nPrevious interactions:\n{cortex.context.text}"
    else:
        context = ""
 
    # Replace llm.complete(...) with your chosen LLM integration
    # using the context assembled above.
    response = "ok"
 
    if "resolved" in response.lower():
        await cortex.store(
            content=f"Resolved: {query} -> {response}",
            type="resolution",
        )
 
    return response

3) Cortex auto-context injection

When enabled, Cortex retrieves relevant context before execution and exposes it via cortex.context:

cortex.context.entries
cortex.context.text

4) Sentinel actions

Sentinel supports actions on violations:

  • block
  • flag
  • redact
  • escalate

5) Helix instance bounds

Helix configuration can set a minimum and maximum number of instances and a memory limit:

  • min_instances
  • max_instances
  • memory_limit_mb

6) Why scope matters

Cortex scope is automatically enforced on all operations, which prevents cross-tenant memory leakage.

7) Error handling

In production, handle validation and runtime failures explicitly.

import asyncio
 
from teleon.core import TeleonError, AgentExecutionError, AgentValidationError, LLMRateLimitError
 
try:
    result = await support_agent("hello", customer_id="cust_123")
except LLMRateLimitError as e:
    await asyncio.sleep(e.retry_after)
    result = await support_agent("hello", customer_id="cust_123")
except AgentValidationError:
    raise
except AgentExecutionError:
    raise
except TeleonError:
    raise

Next

  • Cortex guide: /docs/guides/cortex-memory
  • Sentinel guide: /docs/guides/sentinel-guardrails
  • Helix guide: /docs/guides/helix-runtime

On this page