Files
rightnow-ai--openfang/sdk/python/examples/echo_agent.py
T
wehub-resource-sync d93385b373
CI / Check / macos-latest (push) Waiting to run
CI / Check / ubuntu-latest (push) Waiting to run
CI / Check / windows-latest (push) Waiting to run
CI / Test / macos-latest (push) Waiting to run
CI / Test / ubuntu-latest (push) Waiting to run
CI / Test / windows-latest (push) Waiting to run
CI / Clippy (push) Waiting to run
CI / Format (push) Waiting to run
CI / Security Audit (push) Waiting to run
CI / Secrets Scan (push) Waiting to run
CI / Install Script Smoke Test (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:43:09 +08:00

21 lines
531 B
Python

#!/usr/bin/env python3
"""Example OpenFang agent: echoes back messages with a friendly greeting."""
import sys
import os
# Add parent directory to path for openfang_sdk import
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from openfang_sdk import Agent
agent = Agent()
@agent.on_message
def handle(message: str, context: dict) -> str:
agent_id = context.get("agent_id", os.environ.get("OPENFANG_AGENT_ID", "unknown"))
return f"Hello from Python agent {agent_id}! You said: {message}"
agent.run()