Spaces:
Sleeping
Sleeping
Update agentos_core.py
Browse files- agentos_core.py +18 -43
agentos_core.py
CHANGED
|
@@ -19,46 +19,21 @@ class AgentCore:
|
|
| 19 |
print(f"[INIT] Agent {self.agent_id} initialized with model {self.model}")
|
| 20 |
|
| 21 |
def run(self, prompt):
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
fact = key_part.split(" is ", 1)[1].strip().rstrip(".")
|
| 41 |
-
|
| 42 |
-
if fact and "favorite" in key_part.lower():
|
| 43 |
-
subject = key_part.split(" is ", 1)[0]
|
| 44 |
-
subject = subject.replace("My ", "Your ").rstrip(".")
|
| 45 |
-
response = f"{subject} is {fact}."
|
| 46 |
-
else:
|
| 47 |
-
response = f"I remember: {key_part}"
|
| 48 |
-
|
| 49 |
-
# ---------- DEFAULT ----------
|
| 50 |
-
if response is None:
|
| 51 |
-
response = f"Agent {self.agent_id} processed: {prompt}"
|
| 52 |
-
|
| 53 |
-
# ---------- SAVE ----------
|
| 54 |
-
self.memory.save({"prompt": prompt, "response": response})
|
| 55 |
-
self.context.link_context(self.agent_id, prompt, response)
|
| 56 |
-
|
| 57 |
-
self.telemetry.log("run_complete", "success", {"response": response})
|
| 58 |
-
print(f"[RUN] {response}")
|
| 59 |
-
return response
|
| 60 |
-
|
| 61 |
-
except Exception as e:
|
| 62 |
-
self.telemetry.log("run_failed", "error", {"error": str(e)})
|
| 63 |
-
print(f"[ERROR] {e}")
|
| 64 |
-
return f"Error: {e}"
|
|
|
|
| 19 |
print(f"[INIT] Agent {self.agent_id} initialized with model {self.model}")
|
| 20 |
|
| 21 |
def run(self, prompt):
|
| 22 |
+
==== Application Startup at 2025-10-20 07:10:44 =====
|
| 23 |
+
|
| 24 |
+
[Identity] Created digital DNA for agent 4a65fb77-5b14-4caa-9883-806a67eff093
|
| 25 |
+
[Telemetry] init - success | {'agent_id': '4a65fb77-5b14-4caa-9883-806a67eff093'}
|
| 26 |
+
[INIT] Agent 4a65fb77-5b14-4caa-9883-806a67eff093 initialized with model gpt-4o-mini
|
| 27 |
+
Running on local URL: http://0.0.0.0:7860
|
| 28 |
+
|
| 29 |
+
To create a public link, set `share=True` in `launch()`.
|
| 30 |
+
/usr/local/lib/python3.10/site-packages/gradio/analytics.py:106: UserWarning: IMPORTANT: You are using gradio version 4.43.0, however version 4.44.1 is available, please upgrade.
|
| 31 |
+
--------
|
| 32 |
+
warnings.warn(
|
| 33 |
+
[Telemetry] run_start - in_progress | {'prompt': 'My favorite city is Tokyo.'}
|
| 34 |
+
[Telemetry] run_complete - success | {'response': 'Agent 4a65fb77-5b14-4caa-9883-806a67eff093 processed: My favorite city is Tokyo.'}
|
| 35 |
+
[RUN] Agent 4a65fb77-5b14-4caa-9883-806a67eff093 processed: My favorite city is Tokyo.
|
| 36 |
+
[Telemetry] run_start - in_progress | {'prompt': 'What is my favorite city?'}
|
| 37 |
+
[Telemetry] run_complete - success | {'response': 'Agent 4a65fb77-5b14-4caa-9883-806a67eff093 processed: What is my favorite city?'}
|
| 38 |
+
[RUN] Agent 4a65fb77-5b14-4caa-9883-806a67eff093 processed: What is my favorite city?
|
| 39 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|