Hello World Example

This is a simple "Hello World" example to get you started with AgentInterface.

Python

hello_world.py
from agentinterface import AgentInterface, components

# Initialize AgentInterface
agent_interface = AgentInterface()

def generate_response(query: str):
    # Create a simple hello world response
    return agent_interface.create_response() \
        .add(components.Text("Hello, World!")) \
        .to_dict()

JavaScript

hello_world.js
import { AgentInterface, components } from 'agentinterface';

// Initialize AgentInterface
const agentInterface = new AgentInterface();

function generateResponse(query) {
  // Create a simple hello world response
  return agentInterface.createResponse()
    .add(new components.Text("Hello, World!"))
    .toJSON();
}

Output

Hello, World!

Next Steps

Now that you've seen a basic example, check out these other examples: