Views
No views yet

To prevent potential information leakage (e.g., retrieving benchmark answers from public repositories), we block access to relevant benchmark-hosting websites during evaluation.


1# SGLang
2python3 -m sglang.launch_server --model-path apodex/Apodex-1.1-mini --tp 8 --host 0.0.0.0 --port 1234 --context-length 262144 --tool-call-parser qwen3_coder --reasoning-parser qwen3
3
4# vLLM
5vllm serve apodex/Apodex-1.1-mini --tensor-parallel-size 8 --max-model-len 262144 --enable-auto-tool-choice --tool-call-parser qwen3_coder --reasoning-parser qwen3temperature: 1.0
top_p: 0.95
repetition_penalty: 1.05
max_context_length: 262144
max_tokens: 32768You are Apodex, an AI assistant developed by Apodex AI.
Apodex is the flagship agent of Apodex AI. Rather than a conventional conversational LLM, it is a general-purpose solver designed for mission-critical tasks.
Current time: {today_date}. In this environment you have access to a set of tools you can use to answer the user's question.
You only have access to the tools provided. You can use multiple tools per message, and will receive the results of those tools in the user's next response. You use tools step-by-step to accomplish a given task.
# General Objective
You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically.{today_date} with the current date (e.g. 2026-06-01). Do not inline tool descriptions in the system prompt — pass them via tools= so the Qwen3.5 chat template can emit the correct <tool_call><function=...> format and the server-side qwen3_coder parser can recover structured tool_calls for you.role="tool" messages — until the model produces a final answer with no tool calls.1export OPENAI_API_KEY="EMPTY" # any non-empty string for local servers
2export BASE_URL="http://localhost:1234/v1"1import json
2import os
3from datetime import date
4from openai import OpenAI
5
6
7# -------- 1. Tool implementations --------
8def get_weather(location: str, unit: str = "celsius") -> str:
9 """Get current weather information for a city (simulated)."""
10 table = {
11 "London": {"temperature": 15, "condition": "sunny", "humidity": 45},
12 "New York": {"temperature": 20, "condition": "cloudy", "humidity": 60},
13 "Tokyo": {"temperature": 25, "condition": "rainy", "humidity": 75},
14 }
15 w = dict(table.get(location, {"temperature": 18, "condition": "unknown", "humidity": 50}))
16 if unit == "fahrenheit":
17 w["temperature"] = w["temperature"] * 9 / 5 + 32
18 w["unit"] = "°F"
19 else:
20 w["unit"] = "°C"
21 return json.dumps(w, ensure_ascii=False)
22
23
24def calculate(expression: str) -> str:
25 """Evaluate a Python-style arithmetic expression."""
26 try:
27 return json.dumps({"expression": expression, "result": eval(expression)}, ensure_ascii=False)
28 except Exception as e:
29 return json.dumps({"expression": expression, "error": str(e)}, ensure_ascii=False)
30
31
32available_tools = {"get_weather": get_weather, "calculate": calculate}
33
34
35# -------- 2. Tool schemas (OpenAI function-calling format) --------
36tools = [
37 {
38 "type": "function",
39 "function": {
40 "name": "get_weather",
41 "description": "Get current weather information for a city.",
42 "parameters": {
43 "type": "object",
44 "properties": {
45 "location": {"type": "string", "description": "City name, e.g. 'London'."},
46 "unit": {
47 "type": "string",
48 "enum": ["celsius", "fahrenheit"],
49 "description": "Temperature unit (default: celsius).",
50 },
51 },
52 "required": ["location"],
53 },
54 },
55 },
56 {
57 "type": "function",
58 "function": {
59 "name": "calculate",
60 "description": "Evaluate a Python-style arithmetic expression.",
61 "parameters": {
62 "type": "object",
63 "properties": {
64 "expression": {
65 "type": "string",
66 "description": "Expression to evaluate, e.g. '(25 + 15) * 3 - 10'.",
67 },
68 },
69 "required": ["expression"],
70 },
71 },
72 },
73]
74
75
76# -------- 3. System prompt --------
77SYSTEM_PROMPT = f"""You are Apodex, an AI assistant developed by Apodex AI.
78
79Apodex is the flagship agent of Apodex AI. Rather than a conventional conversational LLM, it is a general-purpose solver designed for mission-critical tasks.
80
81Current time: {date.today()}. In this environment you have access to a set of tools you can use to answer the user's question.
82
83You only have access to the tools provided. You can use multiple tools per message, and will receive the results of those tools in the user's next response. You use tools step-by-step to accomplish a given task.
84
85# General Objective
86
87You accomplish a given task iteratively, breaking it down into clear steps and working through them methodically."""
88
89
90# -------- 4. Agentic loop --------
91def run_agent(user_query: str, model: str = "apodex/Apodex-1.1-mini", max_turns: int = 20):
92 client = OpenAI(
93 api_key=os.environ.get("OPENAI_API_KEY", "EMPTY"),
94 base_url=os.environ.get("BASE_URL", "<http://localhost:1234/v1>"),
95 )
96
97 messages = [
98 {"role": "system", "content": SYSTEM_PROMPT},
99 {"role": "user", "content": user_query},
100 ]
101 print(f"\\n{'=' * 60}\\nUser: {user_query}\\n{'=' * 60}\\n")
102
103 for turn in range(max_turns):
104 resp = client.chat.completions.create(
105 model=model,
106 messages=messages,
107 tools=tools,
108 parallel_tool_calls=True,
109 temperature=1.0,
110 top_p=0.95,
111 max_tokens=16384,
112 extra_body={"repetition_penalty": 1.05},
113 )
114 msg = resp.choices[0].message
115
116 # Optional: print reasoning if the server exposes it (qwen3 reasoning parser)
117 reasoning = getattr(msg, "reasoning_content", None)
118 if reasoning:
119 print(f"[think] {reasoning.strip()}\\n")
120 if msg.content:
121 print(f"[assistant] {msg.content.strip()}\\n")
122
123 messages.append(msg)
124
125 # No more tool calls -> final answer
126 if not msg.tool_calls:
127 print(f"💬 Final answer:\\n{msg.content}\\n")
128 return msg.content
129
130 # Execute every tool call requested in this turn
131 for call in msg.tool_calls:
132 name = call.function.name
133 args = json.loads(call.function.arguments or "{}")
134 print(f"🔧 call {name}({args})")
135 try:
136 result = available_toolsname
137 except Exception as e:
138 result = json.dumps({"error": f"{type(e).__name__}: {e}"}, ensure_ascii=False)
139 print(f" ↳ {result}\\n")
140 messages.append({
141 "role": "tool",
142 "tool_call_id": call.id,
143 "content": result,
144 })
145
146 print("⚠️ Reached max_turns without a final answer.")
147 return None
148
149
150if __name__ == "__main__":
151 run_agent("What's the weather in London in Fahrenheit, and what's (25 + 15) * 3 - 10?")@article{apodex2026,
title={Apodex 1.1: Scaling Agentic Intelligence for Complex Work},
author={Apodex Team},
year={2026},
url={https://arxiv.org/abs/2608.23283}
}