Manus
Manus
LiteLLM을 통해 OpenAI 호환 Responses API로 Manus AI 에이전트를 사용할 수 있어요.
| 속성 | 내용 |
|---|---|
| 설명 | Manus는 복잡한 추론 과제, 문서 분석, 다단계 워크플로우를 위한 AI 에이전트 플랫폼으로, 비동기 태스크 실행을 지원해요. |
| LiteLLM 제공자 라우트 | manus/{agent_profile} |
| 지원 작업 | /responses (Responses API), /files (Files API) |
| 제공자 문서 | Manus API ↗ |
모델 형식 (Model Format)
manus/{agent_profile}
예시:
manus/manus-1.6- 범용 에이전트manus/manus-1.6-lite- 간단한 작업용 경량 에이전트manus/manus-1.6-max- 복잡한 분석용 고급 에이전트
LiteLLM Python SDK
기본 사용법
import litellm
import os
import time
# Set API key
os.environ["MANUS_API_KEY"] = "your-manus-api-key"
# Create task
response = litellm.responses(
model="manus/manus-1.6",
input="What's the capital of France?",
)
print(f"Task ID: {response.id}")
print(f"Status: {response.status}") # "running"
# Poll until complete
task_id = response.id
while response.status == "running":
time.sleep(5)
response = litellm.get_response(
response_id=task_id,
custom_llm_provider="manus",
)
print(f"Status: {response.status}")
# Get results
if response.status == "completed":
for message in response.output:
if message.role == "assistant":
print(message.content[0].text)
LiteLLM AI Gateway
설정 (Setup)
config.yaml
model_list:
- model_name: manus-agent
litellm_params:
model: manus/manus-1.6
api_key: os.environ/MANUS_API_KEY
프록시 시작
litellm --config config.yaml
사용법 (Usage)
- cURL
- OpenAI SDK
태스크 생성
# Create task
curl -X POST http://localhost:4000/responses \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "manus-agent",
"input": "What is the capital of France?"
}'
# Response
{
"id": "task_abc123",
"status": "running",
"metadata": {
"task_url": "https://manus.im/app/task_abc123"
}
}
완료 여부 폴링
# Check status (repeat until status is "completed")
curl http://localhost:4000/responses/task_abc123 \
-H "Authorization: Bearer ***"
# When completed
{
"id": "task_abc123",
"status": "completed",
"output": [
{
"role": "user",
"content": [{"text": "What is the capital of France?"}]
},
{
"role": "assistant",
"content": [{"text": "The capital of France is Paris."}]
}
]
}
태스크 생성 및 폴링
import openai
import time
client = openai.OpenAI(
base_url="http://localhost:4000",
api_key="your-proxy-key"
)
# Create task
response = client.responses.create(
model="manus-agent",
input="What is the capital of France?"
)
print(f"Task ID: {response.id}")
print(f"Status: {response.status}") # "running"
# Poll until complete
task_id = response.id
while response.status == "running":
time.sleep(5)
response = client.responses.retrieve(response_id=task_id)
print(f"Status: {response.status}")
# Get results
if response.status == "completed":
for message in response.output:
if message.role == "assistant":
print(message.content[0].text)
동작 방식 (How It Works)
Manus는 비동기 에이전트 API로 동작해요:
- 태스크 생성 (Create Task):
litellm.responses()를 호출하면 Manus가 태스크를 만들고 즉시status: "running"을 반환해요. - 태스크 실행 (Task Executes): 에이전트가 백그라운드에서 요청을 처리해요.
- 완료 여부 폴링 (Poll for Completion): 상태가
"completed"로 바뀔 때까지litellm.get_response()또는client.responses.retrieve()를 반복 호출해야 해요. - 결과 확인 (Get Results): 완료되면
output필드에 전체 대화가 담겨 있어요.
태스크 상태 (Task Statuses):
running- 에이전트가 작업 중pending- 에이전트가 입력을 기다리는 중completed- 태스크가 성공적으로 완료됨error- 태스크 실패
운영 환경 사용 (Production Usage)
운영 환경 애플리케이션에서는 폴링 대신 웹훅을 사용해 태스크 완료를 통지받는 편이 좋아요.
지원 파라미터 (Supported Parameters)
| 파라미터 | 지원 여부 | 비고 |
|---|---|---|
input |
✅ | 텍스트, 이미지 또는 구조화된 콘텐츠 |
stream |
✅ | 가짜 스트리밍 (태스크는 비동기 실행) |
max_output_tokens |
✅ | 응답 길이 제한 |
previous_response_id |
✅ | 다회차 대화용 |
Files API
Manus는 문서 분석·처리를 위한 파일 업로드를 지원해요. 업로드한 파일은 Responses API 호출에서 참조할 수 있어요.
LiteLLM Python SDK
파일 업로드, 사용, 조회, 삭제
import litellm
import os
# Set API key
os.environ["MANUS_API_KEY"] = "your-manus-api-key"
# Upload file
file_content = b"This is a document for analysis."
created_file = await litellm.acreate_file(
file=("document.txt", file_content),
purpose="assistants",
custom_llm_provider="manus",
)
print(f"Uploaded file: {created_file.id}")
# Use file with Responses API
response = await litellm.aresponses(
model="manus/manus-1.6",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "Summarize this document."},
{"type": "input_file", "file_id": created_file.id},
],
},
],
extra_body={"task_mode": "agent", "agent_profile": "manus-1.6-agent"},
)
print(f"Response: {response.id}")
# Retrieve file
retrieved_file = await litellm.afile_retrieve(
file_id=created_file.id,
custom_llm_provider="manus",
)
print(f"File details: {retrieved_file.filename}, {retrieved_file.bytes} bytes")
# Delete file
deleted_file = await litellm.afile_delete(
file_id=created_file.id,
custom_llm_provider="manus",
)
print(f"Deleted: {deleted_file.deleted}")
LiteLLM AI Gateway
- cURL
- OpenAI SDK
파일 업로드
# Upload file
curl -X POST http://localhost:4000/v1/files \
-H "Authorization: Bearer ***" \
-F "[email protected]" \
-F "purpose=assistants" \
-F "custom_llm_provider=manus"
# Response
{
"id": "file_abc123",
"object": "file",
"bytes": 1024,
"created_at": 1234567890,
"filename": "document.txt",
"purpose": "assistants",
"status": "uploaded"
}
Responses API에서 파일 사용
# Create response with file
curl -X POST http://localhost:4000/responses \
-H "Authorization: Bearer ***" \
-H "Content-Type: application/json" \
-d '{
"model": "manus-agent",
"input": [
{
"role": "user",
"content": [
{"type": "input_text", "text": "Summarize this document."},
{"type": "input_file", "file_id": "file_abc123"}
]
}
]
}'
파일 조회
# Get file details
curl http://localhost:4000/v1/files/file_abc123 \
-H "Authorization: Bearer ***"
# Response
{
"id": "file_abc123",
"object": "file",
"bytes": 1024,
"created_at": 1234567890,
"filename": "document.txt",
"purpose": "assistants",
"status": "uploaded"
}
파일 삭제
# Delete file
curl -X DELETE http://localhost:4000/v1/files/file_abc123 \
-H "Authorization: Bearer ***"
# Response
{
"id": "file_abc123",
"object": "file",
"deleted": true
}
파일 업로드, 사용, 조회, 삭제
import openai
client = openai.OpenAI(
base_url="http://localhost:4000",
api_key="your-proxy-key"
)
# Upload file
with open("document.txt", "rb") as f:
created_file = client.files.create(
file=f,
purpose="assistants",
extra_body={"custom_llm_provider": "manus"}
)
print(f"Uploaded file: {created_file.id}")
# Use file with Responses API
response = client.responses.create(
model="manus-agent",
input=[
{
"role": "user",
"content": [
{"type": "input_text", "text": "Summarize this document."},
{"type": "input_file", "file_id": created_file.id}
]
}
]
)
print(f"Response: {response.id}")
# Retrieve file
retrieved_file = client.files.retrieve(created_file.id)
print(f"File: {retrieved_file.filename}, {retrieved_file.bytes} bytes")
# Delete file
deleted_file = client.files.delete(created_file.id)
print(f"Deleted: {deleted_file.deleted}")
출처: 문서
본문
관련 문서 (Related Documentation)
- LiteLLM Responses API
- LiteLLM Files API
- Manus OpenAI Compatibility