43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
# Support both:
|
|
# 1. python -m core_agent.demo
|
|
# 2. python core_agent/demo.py
|
|
if __package__ in (None, ""):
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
|
|
|
from core_agent.agent import CoreAgent
|
|
from core_agent.config import (
|
|
apply_compat_env_aliases,
|
|
build_core_agent_config,
|
|
load_core_agent_env,
|
|
)
|
|
from core_agent.providers.openai_compatible import OpenAICompatibleProvider
|
|
|
|
|
|
def main() -> None:
|
|
workspace = Path.cwd()
|
|
load_core_agent_env()
|
|
apply_compat_env_aliases()
|
|
config = build_core_agent_config()
|
|
provider = OpenAICompatibleProvider(
|
|
model=config.model,
|
|
api_key=config.api_key,
|
|
base_url=config.base_url,
|
|
timeout=config.timeout,
|
|
)
|
|
agent = CoreAgent(
|
|
provider=provider,
|
|
workspace=workspace,
|
|
skill_dirs=[workspace / "skills", Path(__file__).resolve().parent / "sample_skills"],
|
|
)
|
|
result = agent.run("Inspect the workspace, create tasks if useful, and explain what you found.")
|
|
print(result.final_response)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|