Skip to main content
This document covers advanced features and best practices for Novita Agent Runtime.

Table of Contents


Configuration File Reference

.novita-agent.yaml Structure

The .novita-agent.yaml configuration file uses Kubernetes-style YAML format:

Modifying Configuration

Modifying CPU and Memory Settings

Modify resource configuration under spec.runtime in .novita-agent.yaml:

Modifying Environment Variables

The spec.envVars in .novita-agent.yaml is only used for the CLI’s agent invoke command and will not be passed to the deployed sandbox template. Modify environment variables under spec.envVars in .novita-agent.yaml:
Note:
  • ⚠️ Do not store sensitive information (such as API Keys) in .novita-agent.yaml
  • You can also pass environment variables via the --env parameter when running the agent invoke command

Redeploy to Apply Configuration Changes

After modifying resource specifications in .novita-agent.yaml, redeploy is required:

Environment Variables Management

There are several ways to pass environment variables to Agents running in sandbox instances:

Method 1: Define in Configuration File (CLI invocation only)

Define environment variables under spec.envVars in .novita-agent.yaml:

Method 2: Pass Dynamically via SDK

When invoking an Agent using the SDK’s invoke_agent_runtime method, pass them dynamically via the envVars parameter:

Streaming Responses

Implementing Streaming with Synchronous Generators

Use Python generators to implement streaming responses:

Implementing Streaming with Async Generators

Use Python async generators:

LangChain Streaming Response Example

Complete example using LangChain for streaming responses:

Invoking a Streaming Agent

Invoke a streaming Agent using the SDK:

Version Management

Deploying a New Agent Version

Modify the version number and deploy a new version:
After successful deployment, a new agent_id is generated. Each deployment generates a unique agent_id that corresponds to a specific version.

Health Checks

Default Health Check Endpoint

AgentRuntimeApp automatically provides a /ping health check endpoint:

Custom Health Checks

Use the @app.ping decorator to customize health check logic:

Supported Health Check Statuses

Agents can return the following health statuses:

Multi-turn Conversations

Using Session ID for Multi-turn Conversations

Use the runtimeSessionId parameter to route multiple requests to the same sandbox instance:

Example Projects

We provide a complete example project based on LangGraph, demonstrating how to build real AI applications with Novita Agent Runtime.

Project Repository

🔗 https://github.com/novitalabs/Novita-CollabHub/tree/main/examples/agent-runtime/agentic-frameworks/langgraph
Last modified on December 2, 2025