Agents

Agents are the core building blocks of Engrami. They are intelligent AI entities that can understand context, maintain memory across interactions, and perform complex tasks autonomously.

What is an Agent?

An Engrami agent is more than just a chatbot. It's an AI-powered entity with:

  • Persistent Memory — Remembers past interactions and learned knowledge
  • Configurable Personality — Customizable tone, style, and behavior
  • Tool Access — Can use integrations and external services
  • Autonomous Capability — Can make decisions and take actions

Agent Types

Engrami provides several pre-configured agent types optimized for common use cases. You can also create custom agent types for specialized requirements.

Customer Support

Handle customer inquiries, troubleshoot issues, and provide product information.

Data Analyst

Analyze data, generate reports, and provide insights from your datasets.

Code Assistant

Help with code review, debugging, documentation, and development tasks.

Content Writer

Create blog posts, marketing copy, documentation, and other content.

Sales Assistant

Qualify leads, answer product questions, and assist with the sales process.

Custom Agent

Build a completely custom agent tailored to your specific requirements.

Creating an Agent

You can create agents using the dashboard UI or programmatically via the API/SDK.

Using the Dashboard

  1. Navigate to Agent Studio in the sidebar
  2. Click Create New Agent
  3. Select an agent type or start from scratch
  4. Configure the agent's name, description, and personality
  5. Select memory types (semantic, episodic, procedural, decision graph)
  6. Configure any integrations or tools the agent needs
  7. Review and create the agent

Using the Python SDK

from engrami import EngramiClient

client = EngramiClient()

# Create a customer support agent
agent = client.agents.create(
    name="Support Hero",
    description="A friendly and knowledgeable support agent",
    type="support",

    # Configure memory types
    memory_types=["semantic", "episodic", "procedural"],

    # Agent configuration
    config={
        # Personality and behavior
        "personality": "friendly, professional, and empathetic",
        "response_style": "concise but thorough",
        "language": "en",

        # Capabilities
        "capabilities": [
            "answer_questions",
            "troubleshoot_issues",
            "escalate_to_human"
        ],

        # Knowledge sources
        "knowledge_bases": ["product_docs", "faq"],

        # Guardrails
        "guardrails": {
            "max_response_length": 500,
            "prohibited_topics": ["competitor_pricing"],
            "require_sources": True
        }
    },

    # Model configuration (optional)
    model_config={
        "model": "gpt-4o",
        "temperature": 0.7,
        "max_tokens": 1000
    }
)

print(f"Created agent: {agent.id}")

Agent Configuration

Personality

Define how your agent communicates. This affects tone, formality, and interaction style.

config={
    "personality": "professional yet approachable",
    "tone": "warm and helpful",
    "formality": "semi-formal",
    "emoji_usage": "minimal",  # none, minimal, moderate, frequent
}

Response Style

Control how the agent structures and formats its responses.

config={
    "response_style": "structured",  # concise, detailed, structured
    "use_bullet_points": True,
    "include_examples": True,
    "max_response_length": 500,
}

Guardrails

Set boundaries and safety measures for agent behavior.

config={
    "guardrails": {
        # Content restrictions
        "prohibited_topics": ["medical_advice", "legal_advice"],
        "allowed_domains": ["support", "product", "billing"],

        # Response requirements
        "require_sources": True,
        "require_confidence_score": True,
        "min_confidence": 0.8,

        # Escalation rules
        "escalate_on_low_confidence": True,
        "escalate_on_sensitive_topics": True,
        "max_attempts_before_escalation": 3
    }
}

Important: Test Your Guardrails

Always test your guardrails thoroughly before deploying to production. Use the agent playground to simulate edge cases and ensure proper behavior.

Agent Lifecycle

States

Agents can be in one of several states:

  • Draft — Agent is being configured, not yet active
  • Active — Agent is running and can receive requests
  • Paused — Agent is temporarily disabled
  • Archived — Agent is deactivated but data is preserved

Managing Agent State

# Pause an agent
agent.pause(reason="Scheduled maintenance")

# Resume an agent
agent.resume()

# Archive an agent (preserves memory)
agent.archive()

# Delete an agent (removes all data)
agent.delete(confirm=True)

Interacting with Agents

Chat Interface

# Simple chat
response = agent.chat("How do I reset my password?")
print(response.content)

# Chat with context
response = agent.chat(
    message="I'm having trouble logging in",
    user_id="user_123",
    session_id="session_abc",
    context={
        "user_tier": "premium",
        "account_age_days": 365
    }
)

# Streaming response
for chunk in agent.chat_stream("Tell me about your features"):
    print(chunk.content, end="", flush=True)

Async Operations

import asyncio

async def main():
    # Async chat
    response = await agent.chat_async("What's my account status?")
    print(response.content)

    # Parallel conversations
    tasks = [
        agent.chat_async("Question 1"),
        agent.chat_async("Question 2"),
        agent.chat_async("Question 3"),
    ]
    responses = await asyncio.gather(*tasks)

asyncio.run(main())

Best Practices

Start with Clear Instructions

Provide detailed system instructions that clearly define the agent's role, capabilities, and limitations. The more specific, the better.

Use Appropriate Memory Types

Choose memory types based on your use case. Not every agent needs all four memory types — select what's relevant.

Implement Proper Escalation

Always configure escalation paths for situations the agent can't handle. Know when to hand off to a human.

Monitor and Iterate

Use analytics to track agent performance. Review conversations regularly and refine prompts and configurations based on real interactions.