Guide

Developer Guide

Learn how to build, deploy, and integrate AI agents in your applications. From zero to production in minutes.

Overview

What is Hikigai?

Hikigai is a platform for deploying and using AI agents. You can:

  • Deploy agents with simple configuration (no infrastructure knowledge needed)
  • Invoke agents via Platform API or Python SDK
  • Scale automatically with managed infrastructure
  • Monitor usage, latency, and errors
1

Get API Key

2

Deploy Agent

3

Call Agent

Getting Started

1

Create an Account

Sign up at hikigai.com to get your developer account.

Tip: The free tier includes 100 invocations/day and 3 agents.
2

Authenticate with Google SSO

Navigate to the Dashboard and click Sign in with Google:

  • Log in using your Google account
  • Navigate to Settings to retrieve your access token
  • Copy your token for API access
# Your token looks like this:
hk_token_abc123def456ghi789...
3

Install the SDK

pip install --index-url https://test.pypi.org/simple/  --extra-index-url https://pypi.org/simple/ hikigai-agentsdk hikigai-appsdk hikigai-core --upgrade
4

Set Your Token

Choose one of these methods:

Environment Variable (Recommended)

export HIKIGAI_API_KEY=hk_token_your_token

In Code

from hikigai import Hikigai
client = Hikigai(api_key="hk_token_your_token")

Deploy Your First Agent

Create a simple sentiment analyzer in just a few lines of code:

from hikigai import Hikigai, AgentConfig

# Initialize client
client = Hikigai()

# Create and deploy agent
agent = client.deploy(AgentConfig(
    name="sentiment-analyzer",
    instruction="""
    You are a sentiment analysis expert.
    Analyze the sentiment of the given text and respond with:
    - "positive" for positive sentiment
    - "negative" for negative sentiment  
    - "neutral" for neutral sentiment
    Also provide a confidence score from 0 to 1.
    Format: {"sentiment": "...", "confidence": 0.XX}
    """,
    model="gemini-2.0-flash",
    description="Analyzes text sentiment",
    category="NLP",
))

print(f"✓ Agent deployed: {agent.id}")
print(f"✓ Endpoint: {agent.endpoint}")
What happens during deploy?
  • Agent configuration is validated
  • Agent is registered in the Hikigai platform
  • Endpoint is created for invocation
  • You get an agent ID for future reference

Use Your Agent

Basic Invocation

# Get your deployed agent
agent = client.agent("sentiment-analyzer")

# Invoke it!
response = agent.invoke("I absolutely love this product!")
print(response.content)
# Output: {"sentiment": "positive", "confidence": 0.95}

With Conversation Memory

# Use session_id to maintain conversation context
session = "user-abc-123"

r1 = agent.invoke("Remember: my favorite color is blue", session_id=session)
r2 = agent.invoke("What's my favorite color?", session_id=session)
print(r2.content)  # "Your favorite color is blue"

Streaming Responses

# Stream for real-time output
for chunk in agent.stream("Write a poem about AI"):
    print(chunk, end="", flush=True)

Using cURL

curl -X POST "https://api.hikigai.com/v1/agents/sentiment-analyzer/invoke" \
  -H "Authorization: Bearer hk_token_your_token" \
  -H "Content-Type: application/json" \
  -d '{"message": "I love this!"}'

Project Collaboration

Hikigai is built for teams. You can invite collaborators to your projects and assign them specific roles.

OWNER

Full access to project settings, billing, member management, and all agents.

ADMIN

Can manage members, agents, and configurations but cannot delete the project.

DEVELOPER

Can deploy, update, and invoke agents. Cannot manage project members.

VIEWER

Read-only access to agent configurations and history. Cannot invoke or deploy.

1

Invite a Member

Navigate to your Project DashboardMembers and click Add Member. Enter their email and select a role.

Bring Your Own Key (BYOK)

For production workloads, you can provide your own LLM provider API keys. This gives you more control over rate limits and direct billing with providers.

Supported Providers

  • OpenAI: GPT-4o, GPT-4-turbo, GPT-3.5
  • Google: Gemini 1.5 Pro, Gemini 1.5 Flash
  • Anthropic: Claude 3.5 Sonnet, Claude 3 Opus/Haiku
  • OpenRouter: Access to hundreds of open-source models
How it works: When you add a provider key to your project, all agents in that project configured to use that provider will automatically use your key instead of the platform's default keys.

Data Connectors (MCP)

Connect your agents to clinical data, EHR systems, and wearable devices using theModel Context Protocol (MCP).

EHR Connectors

Connect to Epic, Cerner, or AthenaHealth via FHIR APIs to retrieve clinical records.

Wearable Connectors

Stream data from Apple Health, Fitbit, or Oura to provide real-time patient monitoring.

Registering a Connector

You can use pre-built connectors from our registry or connect your own private MCP server:

# Register a private MCP server via SDK
project = client.project("my-project")
project.add_connector(
    name="my-internal-ehr",
    mcp_url="https://mcp.your-hospital.org/v1",
    category="EHR"
)

Production Tips

🔒 Security

  • Never expose tokens in client-side code
  • Call Hikigai from your backend server
  • Use environment variables for tokens
  • Tokens expire, implement refresh logic

⚡ Performance

  • Use the async client for high-throughput applications
  • Enable streaming for better user experience
  • Implement retry logic for transient failures
  • Cache responses when appropriate

📊 Monitoring

  • Check response.latency_ms for performance monitoring
  • Track tokens_used for cost optimization
  • Use request_id for debugging
  • Monitor rate limit headers

Example: Production-Ready Code

import asyncio
from hikigai import HikigaiAsync, AgentConfig
from hikigai.exceptions import RateLimitError, HikigaiError

async def invoke_with_retry(agent, message, max_retries=3):
    """Invoke with exponential backoff retry."""
    for attempt in range(max_retries):
        try:
            return await agent.invoke(message)
        except RateLimitError as e:
            if attempt < max_retries - 1:
                await asyncio.sleep(e.retry_after)
            else:
                raise
        except HikigaiError as e:
            if attempt < max_retries - 1:
                await asyncio.sleep(2 ** attempt)
            else:
                raise

async def main():
    async with HikigaiAsync() as client:
        agent = await client.agent("my-agent")
        response = await invoke_with_retry(agent, "Hello!")
        return response.content

asyncio.run(main())

Framework Support

Hikigai is designed to be framework-agnostic. Under the hood, we support:

Google ADK

Full support for Google's Agent Development Kit

Available

LangGraph

Support for LangChain/LangGraph agents

Coming Soon

CrewAI

Support for multi-agent CrewAI frameworks

Coming Soon

Custom Agents

Your own Python agent implementations

Coming Soon
Note: All framework complexity is hidden. You just use the Hikigai SDK regardless of the agent's underlying implementation.

Best Practices

Write Clear Instructions

Be specific about what you want. Include examples, output format, and constraints.

Use Appropriate Models

For simple tasks, use faster models like claude-3-haiku. For complex reasoning, use claude-3.5-sonnet.

Handle Errors Gracefully

Always wrap API calls in try/except blocks. Implement retry logic for production.

Monitor Usage

Use client.usage() to track your API consumption and avoid surprises.

Use Sessions for Conversations

Pass session_id to maintain context across multiple invocations.