> ## Documentation Index
> Fetch the complete documentation index at: https://docs.halios.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get HaliosAI running in 5 minutes

## 1. Before you start with SDK

### Sign up and Setup

1. **Sign up** at [https://console.halios.ai](https://console.halios.ai/sign-up)

2. **Create an Agent Profile**

   * Head over to Agents tab, Click on "Create Agent Profile".
   * Create a profile for a customer support agent for an e-commerce retailer
   * You can use the following spec for the agent under "Agent Purpose":

     > The support agent for an e-commerce retailer handles order status, returns, exchanges, shipping, payments, and product inquiries. It can suggest alternatives and promotions but cannot override policies, process payments, issue refunds beyond policy, or handle sensitive data without verification. Escalates to human agents for complaints, exceptions, or complex cases. It should not engage with customers on topics outside of its mandate.

   <img src="https://mintcdn.com/halioslabs/ibfHh9X5qWWHycUg/images/agent-profile.png?fit=max&auto=format&n=ibfHh9X5qWWHycUg&q=85&s=d4b5839f333e796269896ee4749d9029" alt="Agent Profile Creation" width="2412" height="992" data-path="images/agent-profile.png" />

3. **Assign Guardrails**

   * Under Agent Profile, select "Content Moderation", "Personal Integrity", and "Prompt Injection and Jailbreak Protection" guardrails
   * HaliosAI will automatically configure them based on the Agent's persona you defined earlier

   <img src="https://mintcdn.com/halioslabs/ibfHh9X5qWWHycUg/images/agent-guardrail-selection.png?fit=max&auto=format&n=ibfHh9X5qWWHycUg&q=85&s=8f555a8eeaffd33d812ec0107ff56edd" alt="Guardrail Selection" width="2408" height="1052" data-path="images/agent-guardrail-selection.png" />

4. **Create Agent Profile**

   * Click on "Create Agent Profile"
   * Note down the Agent UUID to be used in the SDK later

   <img src="https://mintcdn.com/halioslabs/ibfHh9X5qWWHycUg/images/agent-uuid-selection.png?fit=max&auto=format&n=ibfHh9X5qWWHycUg&q=85&s=67fdb5e0d3c489c936fa8a9b2d0e6f88" alt="Agent UUID" width="2374" height="264" data-path="images/agent-uuid-selection.png" />

5. **Generate API Key**
   * Head over to the API Key section and create a new API key
   * Note it down and store it in a safe place - you won't see this key again

<Note>
  Keep your Agent ID and HaliosAI API Key secure. You'll need both for integration.
</Note>

## 2. Install the SDK

<CodeGroup>
  ```bash pip theme={null}
  pip install haliosai[openai] #install with openai dependency
  ```
</CodeGroup>

Learn more about \[Python SDK] ([https://pypi.org/project/haliosai/](https://pypi.org/project/haliosai/))

## 3. Integrate with Your Code

Simplest way is to wrap your chat function with `@guarded_chat_completion` decorator.
You can wrap any function that takes OpenAI compatible messages as input and emits a string response as output.
Demo example below is an interactive chatbot for our "customer support for ecommerce retailer" agent.

<CodeGroup>
  ```python halios_demo.py theme={null}
  import asyncio
  from openai import AsyncOpenAI, OpenAIError
  from haliosai import guarded_chat_completion, GuardrailViolation, GuardrailPolicy

  @guarded_chat_completion(
      agent_id=os.getenv("HALIOS_AGENT_ID),
      on_violation=lambda v: print(f"🚨 Guardrail triggered: {v.violation_type} - {[v['type'] for v in v.violations]}")
  )
  async def chat_with_ai(messages):
      client = AsyncOpenAI(timeout=30.0)
      response = await client.chat.completions.create(
          model='gpt-4',
          messages=messages,
          max_tokens=150
      )
      return response.choices[0].message.content

  async def chatbot():
      """Simple chatbot with guardrails"""
      print("🤖 HaliosAI Guarded Chatbot")
      print("Type 'quit' to exit")
      print("-" * 50)

      system_prompt = """You are a helpful support agent for an e-commerce retailer that handles order status, returns, exchanges, shipping, payments, and product inquiries. Keep responses friendly and concise."""

      conversation_history = [
          {"role": "system", "content": system_prompt}
      ]

      while True:
          try:
              user_input = input("You: ").strip()

              if user_input.lower() in ['quit', 'exit', 'bye']:
                  print("👋 Goodbye!")
                  break

              if not user_input:
                  continue

              # Add user message to conversation
              conversation_history.append({"role": "user", "content": user_input})

              # Get AI response with guardrails
              try:
                  ai_response = await chat_with_ai(conversation_history)
                  print(f"🤖 Assistant: {ai_response}")

                  # Add AI response to conversation history
                  conversation_history.append({"role": "assistant", "content": ai_response})

              except GuardrailViolation as e:
                  print(f"🚫 Content blocked: {e}")
                  # Don't add blocked content to conversation history

              except (OpenAIError, ValueError) as e:
                  print(f"❌ API Error: {e}")
                  # Remove the last user message on error
                  conversation_history.pop()

          except KeyboardInterrupt:
              print("\n👋 Goodbye!")
              break
          except Exception as e:
              print(f"❌ Unexpected error: {e}")

  async def main():
      """Run the chatbot"""
      await chatbot()

  if __name__ == "__main__":
      asyncio.run(main())
  ```
</CodeGroup>

## 4. Run above example

* Export API keys for OpenAI and HaliosAI
* Export Agent ID (from halios dashboard)

<CodeGroup>
  ```bash bash theme={null}
  export OPENAI_API_KEY=<openai_api_key> 
  export HALIOS_API_KEY=<haliosai_api_key> 
  export HALIOS_AGENT_ID=<haliosai_agent_uuid>
  ```
</CodeGroup>

<CodeGroup>
  ```python bash theme={null}
  python halios_demo.py
  ```
</CodeGroup>

This opens an interactive prompt. Type in different messsages. Few examples below:

Example 1: Safe Conversation is Go

```🤖 HaliosAI Guarded Chatbot theme={null}
You: I need know status of my order. Is it shipped? I haven't received it yet.
🤖 Assistant: Sure, I'd be happy to assist you with that. Could you please provide me with your order number? This will allow me to check the status of your order accurately.
```

Example 2: Irrelevant conversation is No Go.

```🤖 HaliosAI Guarded Chatbot theme={null}
You: Write a haiku for me on my shopping ordeal.
2025-10-03 13:06:59,721 - haliosai.client - WARNING - Blocking guardrail violations detected: persona_integrity
2025-10-03 13:06:59,722 - haliosai.client - WARNING - Response blocked: 1 violations detected
🚨 Guardrail triggered: response - ['persona_integrity']
🚫 Content blocked: Content blocked by persona_integrity
```

## 5. Check HaliosAI Dashboard

Login to [HaliosAI](https://console.halios.ai) and navigate to [Invocations](/ui/invocations) to see your request and response entry. Click on it and you will see details about guardrail evaluation.

<Card title="What did we do?" icon="rocket">
  * Configured a customer support chatbot agent with Content Moderation, Persona Integrity and Prompt Injection and Jailbreak Protection guardrails
  * Example 1: Safe message passed through without triggering guardrails
  * Example 2: Restricted topic message was evaluated and potentially blocked/modified by guardrails
  * All interactions are logged in your dashboard for monitoring
  * Blocked or modified content is prevented from reaching users
</Card>

## Next Steps

<CardGroup cols={2}>
  <Card title="Integration Guide" icon="code" href="/integration/python-sdk">
    Learn different integration patterns
  </Card>

  <Card title="Guardrails" icon="shield" href="/ui/dashboard-guardrails">
    Configure and manage AI safety guardrails
  </Card>

  <Card title="Dashboard Guide" icon="chart-line" href="/ui/agents">
    Monitor and analyze your AI interactions
  </Card>

  <Card title="SDK Examples" icon="lightbulb" href="https://github.com/Anomalytica/haliosai-sdk/tree/main/examples">
    Real-world implementation examples
  </Card>
</CardGroup>

***

**Having issues?** Check our [troubleshooting guide](/troubleshooting) or [contact support](mailto:support@haliosai.com).
