Skip to main content

Platform Architecture

Junis is built on a Multi-Agent architecture where specialized AI agents collaborate to solve complex tasks. Understanding these core concepts will help you build effective workflows.

1. Agents

Agents are the fundamental building blocks of Junis. Think of them as AI workers with specific skills and responsibilities.

Agent Types

LLM Agent

Individual AI worker that processes tasks using a language model
  • Has its own instructions and tools
  • Can call sub-agents
  • Specialized for specific tasks

Sequential Agent

Executes sub-agents one after another in order
  • Step-by-step processing
  • Output of one becomes input of next
  • Perfect for pipelines

Parallel Agent

Runs multiple sub-agents simultaneously
  • Concurrent execution
  • Aggregates results
  • Faster for independent tasks

Loop Agent

Repeats sub-agents until a condition is met
  • Iterative processing
  • Configurable max iterations
  • Useful for retry logic

Agent Hierarchy

Orchestrator is a special agent that serves as the entry point for all requests. It routes messages to appropriate sub-agents based on the user’s intent.

2. Multi-Tenant System

Junis is a multi-tenant platform where each organization has isolated data and configurations.

Organization Isolation

Key Points:
  • Each organization has its own Orchestrator
  • Agents are scoped to organizations
  • Sessions and data are completely isolated
  • Users can belong to multiple organizations

Organization Roles

RolePermissions
OWNERFull organization control, manage all settings
ADMINManage agents, tools, schedules, members
MEMBERUse agents, create sessions, upload RAG documents
Platform-level roles (SUPER_ADMIN, SUPPORT) are managed separately for system administration purposes.

3. Sessions

A session represents a conversation between a user and the Junis system. Sessions maintain context across multiple messages.

Session Lifecycle

Session Properties:
  • Persistent: Stored in PostgreSQL database
  • Contextual: Agents remember previous messages
  • Searchable: Full conversation history available via API
  • Resumable: Can continue sessions across disconnections

4. Tools

Tools are functions that agents can call to perform actions or retrieve information.

Tool Categories

  • Built-in Tools
  • MCP Tools
  • RAG Tools
Python Functions registered in the system:
  • various_of_tools: Useful Tools

Tool Calling Flow


5. Model Context Protocol (MCP)

MCP is a standard protocol for connecting AI agents to external services. Junis supports both Remote and Local MCP servers.

MCP Architecture

Authentication Hierarchy

MCP credentials support multi-level authentication. Users can configure credentials at different levels, with automatic fallback to appropriate defaults.
For detailed authentication configuration, including priority systems and credential management, refer to the MCP Integration Guide in the Admin documentation.

6. RAG (Retrieval-Augmented Generation)

RAG enhances agents with knowledge from your documents. When a user asks a question, the system:
  1. Searches relevant documents using semantic search
  2. Retrieves the most relevant excerpts
  3. Augments the agent’s prompt with this context
  4. Generates a response informed by your documents

RAG Workflow

DataStore Structure

Organization: Acme Corp
├── DataStore: salesforce_brands
│   ├── brands_2024_q1.pdf
│   ├── brands_2024_q2.pdf
│   └── brands_pricing.xlsx
├── DataStore: marketing_assets
│   ├── campaign_brief.docx
│   └── creative_guidelines.pdf
└── DataStore: product_docs
    ├── api_reference.md
    └── user_manual.pdf

7. Streaming

Junis supports real-time streaming for better user experience.

Streaming Modes

Server-Sent Events (SSE)

REST API streaming via /api/external/v1/chat/completions
  • HTTP with stream: true
  • OpenAI-compatible format
  • Token-by-token delivery

WebSocket

Persistent connection via /ws/chat
  • Bidirectional communication
  • Pipeline events
  • File uploads
  • Payment flows

Event Types (WebSocket)

Event TypeDescriptionExample
stream_tokenIndividual text token{"type": "stream_token", "token": "Hello"}
agent_routingAgent handoff{"type": "agent_routing", "from": "A", "to": "B"}
agent_startedAgent begins processing{"type": "agent_started", "agent": "Analyzer"}
agent_completedAgent finishes{"type": "agent_completed", "duration_ms": 1234}
stream_completeEntire response complete{"type": "stream_complete"}

8. Performance Optimization

Junis uses intelligent caching and optimization to ensure fast, responsive agent interactions.

Caching System

The platform implements a multi-tier caching strategy:
  • Agent Configuration: Automatically cached for rapid access
  • Session Context: Persisted for conversation continuity
  • External Integrations: Connection pooling and result caching
  • Database Queries: Query-result caching layer

Cache Invalidation

Caches are automatically updated when:
  • Agent configuration changes (Admin UI)
  • Agent relationships modified (Admin UI)
  • Organization settings updated
  • External service credentials change
For detailed information about caching strategy, performance tuning, and optimization techniques, refer to the Operations Guide in the Admin documentation.

9. Scheduled Tasks

Scheduled Tasks enable automation by running agents at specific times or intervals.

Schedule Types

ONCE

Run at a specific date/time

EVERY_MINUTES

Repeat every N minutes

EVERY_HOURS

Repeat every N hours

DAILY

Repeat every day at specified hour

WEEKLY

Run on specific weekdays

MONTHLY

Execute monthly on specific day

Schedule Execution

Key Features:
  • Timezone-aware scheduling
  • Session reuse or new session per run
  • Execution history and logs
  • Enable/disable without deletion

Next Steps

Now that you understand the core concepts, explore these guides: