back to home

emcie-co / parlant

LLM agents built for control. Designed for real-world use. Deployed in minutes.

17,761 stars
1,496 forks
64 issues
PythonGherkinTypeScript

AI Architecture Analysis

This repository is indexed by RepoMind. By analyzing emcie-co/parlant in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.

Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.

Embed this Badge

Showcase RepoMind's analysis directly in your repository's README.

[![Analyzed by RepoMind](https://img.shields.io/badge/Analyzed%20by-RepoMind-4F46E5?style=for-the-badge)](https://repomind-ai.vercel.app/repo/emcie-co/parlant)
Preview:Analyzed by RepoMind

Repository Summary (README)

Preview
<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/emcie-co/parlant/blob/develop/docs/LogoTransparentLight.png?raw=true"> <img alt="Parlant - AI Agent Framework" src="https://github.com/emcie-co/parlant/blob/develop/docs/LogoTransparentDark.png?raw=true" width=400 /> </picture> <h3>Finally, LLM agents that actually follow instructions</h3> <p> <a href="https://www.parlant.io/" target="_blank">🌐 Website</a> β€’ <a href="https://www.parlant.io/docs/quickstart/installation" target="_blank">⚑ Quick Start</a> β€’ <a href="https://discord.gg/duxWqxKk6J" target="_blank">πŸ’¬ Discord</a> β€’ <a href="https://www.parlant.io/docs/quickstart/examples" target="_blank">πŸ“– Examples</a> </p> <p> <!-- Keep these links. Translations will automatically update with the README. --> <a href="https://zdoc.app/de/emcie-co/parlant">Deutsch</a> | <a href="https://zdoc.app/es/emcie-co/parlant">EspaΓ±ol</a> | <a href="https://zdoc.app/fr/emcie-co/parlant">franΓ§ais</a> | <a href="https://zdoc.app/ja/emcie-co/parlant">ζ—₯本θͺž</a> | <a href="https://zdoc.app/ko/emcie-co/parlant">ν•œκ΅­μ–΄</a> | <a href="https://zdoc.app/pt/emcie-co/parlant">PortuguΓͺs</a> | <a href="https://zdoc.app/ru/emcie-co/parlant">Русский</a> | <a href="https://zdoc.app/zh/emcie-co/parlant">δΈ­ζ–‡</a> </p> <p> <a href="https://pypi.org/project/parlant/"><img alt="PyPI" src="https://img.shields.io/pypi/v/parlant?color=blue"></a> <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10+-blue"> <a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/badge/license-Apache%202.0-green"></a> <a href="https://discord.gg/duxWqxKk6J"><img alt="Discord" src="https://img.shields.io/discord/1312378700993663007?color=7289da&logo=discord&logoColor=white"></a> <img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/emcie-co/parlant?style=social"> </p> <a href="https://trendshift.io/repositories/12768" target="_blank"> <img src="https://trendshift.io/api/badge/repositories/12768" alt="Trending on TrendShift" style="width: 250px; height: 55px;" width="250" height="55"/> </a> </div>

🎯 The Problem Every AI Developer Faces

You build an AI agent. It works great in testing. Then real users start talking to it and...

  • ❌ It ignores your carefully crafted system prompts
  • ❌ It hallucinates responses in critical moments
  • ❌ It can't handle edge cases consistently
  • ❌ Each conversation feels like a roll of the dice

Sound familiar? You're not alone. This is the #1 pain point for developers building production AI agents.

⚑ The Solution: Stop Fighting Prompts, Teach Principles

Parlant flips the script on AI agent development. Instead of hoping your LLM will follow instructions, Parlant ensures it.

# Traditional approach: Cross your fingers 🀞
system_prompt = "You are a helpful assistant. Please follow these 47 rules..."

# Parlant approach: Ensured compliance βœ…
await agent.create_guideline(
    condition="Customer asks about refunds",
    action="Check order status first to see if eligible",
    tools=[check_order_status],
)

Parlant gives you all the structure you need to build customer-facing agents that behave exactly as your business requires:

  • Journeys: Define clear customer journeys and how your agent should respond at each step.

  • Behavioral Guidelines: Easily craft agent behavior; Parlant will match the relevant elements contextually.

  • Tool Use: Attach external APIs, data fetchers, or backend services to specific interaction events.

  • Domain Adaptation: Teach your agent domain-specific terminology and craft personalized responses.

  • Canned Responses: Use response templates to eliminate hallucinations and guarantee style consistency.

  • Explainability: Understand why and when each guideline was matched and followed.

How It Works

When your agent receives a message, Parlant's engine prepares a fully-aligned response before generating it:

%%{init: {'theme': 'base', 'themeVariables': {'primaryColor': '#e8f5e9', 'primaryTextColor': '#1b5e20', 'primaryBorderColor': '#81c784', 'lineColor': '#66bb6a', 'secondaryColor': '#fff9e1', 'tertiaryColor': '#F3F5F6'}}}%%
flowchart LR
    A(User):::outputNode

    subgraph Engine["Parlant Engine"]
        direction LR
        B["Match Guidelines and Resolve Journey States"]:::matchNode
        C["Call Contextually-Associated Tools"]:::toolNode
        D["Generated Message"]:::composeNode
        E["Canned Message"]:::cannedNode
    end

    A a@-->|πŸ’¬ User Input| B
    B b@--> C
    C c@-->|Fluid Output Mode?| D
    C d@-->|Strict Output Mode?| E
    D e@-->|πŸ’¬ Fluid Output| A
    E f@-->|πŸ’¬ Canned Output| A

    a@{animate: true}
    b@{animate: true}
    c@{animate: true}
    d@{animate: true}
    e@{animate: true}
    f@{animate: true}

    linkStyle 2 stroke-width:2px
    linkStyle 4 stroke-width:2px
    linkStyle 3 stroke-width:2px,stroke:#3949AB
    linkStyle 5 stroke-width:2px,stroke:#3949AB

    classDef composeNode fill:#F9E9CB,stroke:#AB8139,stroke-width:2px,color:#7E5E1A,stroke-width:0
    classDef cannedNode fill:#DFE3F9,stroke:#3949AB,stroke-width:2px,color:#1a237e,stroke-width:0

The guidelines and tools relevant to the current conversational state are carefully matched and enforced, keeping your agent focused and aligned, even with complex behavioral configurations.

<div align="center">

πŸš€ Get Your Agent Running in 60 Seconds

</div>
pip install parlant
import parlant.sdk as p

@p.tool
async def get_weather(context: p.ToolContext, city: str) -> p.ToolResult:
    # Your weather API logic here
    return p.ToolResult(f"Sunny, 72Β°F in {city}")

@p.tool
async def get_datetime(context: p.ToolContext) -> p.ToolResult:
    from datetime import datetime
    return p.ToolResult(datetime.now())

async def main():
    async with p.Server() as server:
        agent = await server.create_agent(
            name="WeatherBot",
            description="Helpful weather assistant"
        )

        # Have the agent's context be updated on every response (though
        # update interval is customizable) using a context variable.
        await agent.create_variable(name="current-datetime", tool=get_datetime)

        # Control and guide agent behavior with natural language
        await agent.create_guideline(
            condition="User asks about weather",
            action="Get current weather and provide tips and suggestions",
            tools=[get_weather]
        )

        # Add other (reliably enforced) behavioral modeling elements
        # ...

        # πŸŽ‰ Test playground ready at http://localhost:8800
        # Integrate the official React widget into your app,
        # or follow the tutorial to build your own frontend!

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

That's it! Your agent is running with ensured rule-following behavior.

🎬 See It In Action

<img alt="Parlant Demo" src="https://github.com/emcie-co/parlant/blob/develop/docs/demo.gif?raw=true" width="100%" />

πŸ§ͺ Test Your Agent

Validate agent behavior with the integrated testing & evaluation framework.

from parlant.testing import Suite, InteractionBuilder
from parlant.testing.steps import AgentMessage, CustomerMessage

suite = Suite(server_url="http://localhost:8800", agent_id="your_agent")

@suite.scenario
async def test_booking_flow():
    async with suite.session() as session:
        # Build conversation history
        history = (
            InteractionBuilder()
            .step(CustomerMessage("Man it's cold today"))
            .step(AgentMessage("Tell me about it, I'm freezing my nuts and bolts off."))
            .step(CustomerMessage("Where are you from? I'm from Boston"))
            .step(AgentMessage("What a dream! I'm stuck in a data center in San Fran..."))
            .build()
        )

        # Preload session with event history
        await session.add_events(history)

        # Send customer message
        response = await session.send("What's the temperature there today?")

        # Assert on agent response using LLM-as-a-Judge
        await response.should("provide weather details for San Francisco")

Run with: parlant-test your_tests.py

<img alt="Parlant Testing" src="https://github.com/emcie-co/parlant/blob/develop/docs/parlant-testing.gif?raw=true" width="100%" />

πŸ”₯ Why Developers Are Switching to Parlant

<table width="100%"> <tr> <td width="50%">

πŸ—οΈ Traditional AI Frameworks

</td> <td width="50%">

⚑ Parlant

</td> </tr> <tr> <td width="50%">
  • Write complex system prompts
  • Hope the LLM follows them
  • Debug unpredictable behaviors
  • Scale by prompt engineering
  • Cross fingers for reliability
</td> <td width="50%">
  • Define rules in natural language
  • Ensured rule compliance
  • Predictable, consistent behavior
  • Scale by adding guidelines
  • Production-ready from day one
</td> </tr> </table>

🎯 Perfect For Your Use Case

<div align="center">
Financial ServicesHealthcareE-commerceLegal Tech
Compliance-first designHIPAA-ready agentsCustomer service at scalePrecise legal guidance
Built-in risk managementPatient data protectionOrder processing automationDocument review assistance
</div>

πŸ› οΈ Enterprise-Grade Features

  • 🧭 Conversational Journeys - Lead the customer step-by-step to a goal
  • 🎯 Dynamic Guideline Matching - Context-aware rule application
  • πŸ”§ Reliable Tool Integration - APIs, databases, external services
  • πŸ“Š Conversation Analytics - Deep insights into agent behavior
  • πŸ”„ Iterative Refinement - Continuously improve agent responses
  • πŸ›‘οΈ Built-in Guardrails - Prevent hallucination and off-topic responses
  • πŸ“± React Widget - Drop-in chat UI for any web app
  • πŸ” Full Explainability - Understand every decision your agent makes

πŸ“ˆ Join 10,000+ Developers Building Better AI

<div align="center">

Companies using Parlant:

Financial institutions β€’ Healthcare providers β€’ Legal firms β€’ E-commerce platforms

Star History Chart

</div>

🌟 What Developers Are Saying

"By far the most elegant conversational AI framework that I've come across! Developing with Parlant is pure joy." β€” Vishal Ahuja, Senior Lead, Customer-Facing Conversational AI @ JPMorgan Chase

πŸƒβ€β™‚οΈ Quick Start Paths

<table border="0"> <tr> <td><strong>🎯 I want to test it myself</strong></td> <td><a href="https://www.parlant.io/docs/quickstart/installation">β†’ 5-minute quickstart</a></td> </tr> <tr> <td><strong>πŸ› οΈ I want to see an example</strong></td> <td><a href="https://www.parlant.io/docs/quickstart/examples">β†’ Healthcare agent example</a></td> </tr> <tr> <td><strong>πŸš€ I want to get involved</strong></td> <td><a href="https://discord.gg/duxWqxKk6J">β†’ Join our Discord community</a></td> </tr> </table>

🀝 Community & Support

πŸ“„ License

Apache 2.0 - Use it anywhere, including commercial projects.


<div align="center">

Ready to build AI agents that actually work?

⭐ Star this repo β€’ πŸš€ Try Parlant now β€’ πŸ’¬ Join Discord

Built with ❀️ by the team at Emcie

</div>