Cookbook
가장 일반적인 통합을 위한 복사-붙여넣기 레시피입니다. 각 항목은 완전하고 실행 가능한 예제이며, 도구나 모델을 직접 연결할 필요가 없습니다. 플랫폼이 자동으로 라우팅하고, 도구를 호출하며, 결과를 스트리밍합니다.
1. 한 줄 agent(여기서 시작)
가능한 가장 단순한 통합: 작업을 보내고 스트리밍 답변을 읽습니다. 플랫폼이 모델을 선택하고, 작업에 필요한 도구(웹 검색, 귀하의 knowledge base, 코드 등)를 호출하며, 결과를 반환합니다. 이 문서의 나머지는 모두 이에 대한 선택적 개선 사항입니다.
curl -N https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/agent/runs \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"task": "Summarize today's top AI news in 3 bullets."}'
# -> {"run_id":"…","trace_id":"…"} (then tail /agent/runs/{run_id}/attach for the result)import json, os, requests
WS = os.environ["NEXEVO_WORKSPACE"]
KEY = os.environ["NEXEVO_API_KEY"]
# 1. start the run
r = requests.post(
f"https://nexevo.ai/v1/workspaces/{WS}/agent/runs",
headers={"Authorization": f"Bearer {KEY}"},
json={"task": "Summarize today's top AI news in 3 bullets."},
)
run_id = r.json()["run_id"]
# 2. read the streamed result
stream = requests.get(
f"https://nexevo.ai/v1/workspaces/{WS}/agent/runs/{run_id}/attach",
headers={"Authorization": f"Bearer {KEY}"},
stream=True,
)
for line in stream.iter_lines():
if not line or not line.startswith(b"data: "):
continue
payload = line[6:]
if payload == b"[DONE]":
break
event = json.loads(payload)
if event.get("type") == "run_end":
print(event["final_text"])2. OpenAI SDK 사용(재작성 불필요)
이미 OpenAI 또는 Anthropic SDK를 사용 중이신가요? base URL과 API 키, 두 줄만 변경하면 Nexevo를 가리키도록 설정할 수 있습니다. 기존 코드는 그대로 작동하며, 스마트 라우팅과 결제를 무료로 얻습니다.
from openai import OpenAI
client = OpenAI(
base_url="https://nexevo.ai/v1",
api_key=os.environ["NEXEVO_API_KEY"], # your Nexevo workspace key
)
resp = client.chat.completions.create(
model="nexevo-auto", # let Nexevo's router pick the model
messages=[{"role": "user", "content": "Explain SEPA Instant in two sentences."}],
)
print(resp.choices[0].message.content)라우터가 선택하도록 nexevo-auto를 모델로 사용하거나, 명시적 모델 id를 전달하세요. Anthropic SDK와 스트리밍은 호환성 가이드를 참고하세요.
3. 자체 knowledge base 쿼리
문서를 project에 한 번 업로드한 뒤 질문하세요. agent는 귀하의 knowledge에 대해 rag_search를 자동으로 사용합니다. 별도의 벡터 DB나 검색 파이프라인을 구축할 필요가 없습니다.
# run an agent against a project's knowledge base
curl https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/agent/runs \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "What is our refund policy for annual plans?",
"project_id": "'"$PROJECT_ID"'"
}'4. 전문가 역할로 실행
persona_slug를 전달하여 agent에게 도메인 정체성(법무 검토자, 데이터 분석가, 브랜드 수호자)을 부여하세요. 역할은 추론 방식을 다듬고, 도구는 완전히 사용 가능한 상태로 유지됩니다.
curl https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/agent/runs \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"task": "Audit our privacy policy for GDPR compliance gaps.",
"persona_slug": "legal-privacy-counsel"
}'GET /v1/workspaces/{workspace_id}/skill-library(kind: "agency" 필터)로 사용 가능한 역할을 나열하세요. 전문가 역할을 참고하세요.
5. 예약된 리서치 요약
반복되는 UTC cron 일정으로 작업을 실행하세요. 매일 뉴스 요약, 매주 경쟁사 보고서 등. 각 실행은 일반적인 agent run이며, 완료 시 알림을 받으려면 webhook과 조합하세요.
# every weekday at 9:00 UTC
curl https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/schedules \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Daily competitor digest",
"cron_expr": "0 9 * * 1-5",
"task_text": "Find yesterday's top 3 moves from our competitors and summarize each.",
"budget_usd": 0.3
}'6. 메모리가 있는 멀티 턴 chat
주고받는 대화를 위해서는 conversation 스레드와 함께 chat 엔드포인트를 사용하세요. 컨텍스트가 턴 간에 자동으로 전달됩니다.
# create a conversation, then chat into it
curl https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/conversations \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title": "Q3 planning"}'
# -> {"id": "conv_…", ...}
curl -N https://nexevo.ai/v1/workspaces/$NEXEVO_WORKSPACE/conversations/conv_…/messages \
-H "Authorization: Bearer $NEXEVO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"role": "user", "content": "What were our Q2 highlights?"}'agent가 모든 대화에 걸쳐 사실을 기억하기를 원하시나요? memory에 한 번 저장하면 agent가 매 run마다 관련 컨텍스트를 자동으로 상기합니다.