django-agent-runtime 0.3.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. django_agent_runtime/__init__.py +25 -0
  2. django_agent_runtime/admin.py +155 -0
  3. django_agent_runtime/api/__init__.py +26 -0
  4. django_agent_runtime/api/permissions.py +109 -0
  5. django_agent_runtime/api/serializers.py +114 -0
  6. django_agent_runtime/api/views.py +472 -0
  7. django_agent_runtime/apps.py +26 -0
  8. django_agent_runtime/conf.py +241 -0
  9. django_agent_runtime/examples/__init__.py +10 -0
  10. django_agent_runtime/examples/langgraph_adapter.py +164 -0
  11. django_agent_runtime/examples/langgraph_tools.py +179 -0
  12. django_agent_runtime/examples/simple_chat.py +69 -0
  13. django_agent_runtime/examples/tool_agent.py +157 -0
  14. django_agent_runtime/management/__init__.py +2 -0
  15. django_agent_runtime/management/commands/__init__.py +2 -0
  16. django_agent_runtime/management/commands/runagent.py +419 -0
  17. django_agent_runtime/migrations/0001_initial.py +117 -0
  18. django_agent_runtime/migrations/0002_persistence_models.py +129 -0
  19. django_agent_runtime/migrations/0003_persistenceconversation_active_branch_id_and_more.py +212 -0
  20. django_agent_runtime/migrations/0004_add_anonymous_session_id.py +18 -0
  21. django_agent_runtime/migrations/__init__.py +2 -0
  22. django_agent_runtime/models/__init__.py +54 -0
  23. django_agent_runtime/models/base.py +450 -0
  24. django_agent_runtime/models/concrete.py +146 -0
  25. django_agent_runtime/persistence/__init__.py +60 -0
  26. django_agent_runtime/persistence/helpers.py +148 -0
  27. django_agent_runtime/persistence/models.py +506 -0
  28. django_agent_runtime/persistence/stores.py +1191 -0
  29. django_agent_runtime/runtime/__init__.py +23 -0
  30. django_agent_runtime/runtime/events/__init__.py +65 -0
  31. django_agent_runtime/runtime/events/base.py +135 -0
  32. django_agent_runtime/runtime/events/db.py +129 -0
  33. django_agent_runtime/runtime/events/redis.py +228 -0
  34. django_agent_runtime/runtime/events/sync.py +140 -0
  35. django_agent_runtime/runtime/interfaces.py +475 -0
  36. django_agent_runtime/runtime/llm/__init__.py +91 -0
  37. django_agent_runtime/runtime/llm/anthropic.py +249 -0
  38. django_agent_runtime/runtime/llm/litellm_adapter.py +173 -0
  39. django_agent_runtime/runtime/llm/openai.py +230 -0
  40. django_agent_runtime/runtime/queue/__init__.py +75 -0
  41. django_agent_runtime/runtime/queue/base.py +158 -0
  42. django_agent_runtime/runtime/queue/postgres.py +248 -0
  43. django_agent_runtime/runtime/queue/redis_streams.py +336 -0
  44. django_agent_runtime/runtime/queue/sync.py +277 -0
  45. django_agent_runtime/runtime/registry.py +186 -0
  46. django_agent_runtime/runtime/runner.py +540 -0
  47. django_agent_runtime/runtime/tracing/__init__.py +48 -0
  48. django_agent_runtime/runtime/tracing/langfuse.py +117 -0
  49. django_agent_runtime/runtime/tracing/noop.py +36 -0
  50. django_agent_runtime/urls.py +39 -0
  51. django_agent_runtime-0.3.6.dist-info/METADATA +723 -0
  52. django_agent_runtime-0.3.6.dist-info/RECORD +55 -0
  53. django_agent_runtime-0.3.6.dist-info/WHEEL +5 -0
  54. django_agent_runtime-0.3.6.dist-info/licenses/LICENSE +22 -0
  55. django_agent_runtime-0.3.6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,36 @@
1
+ """
2
+ No-op trace sink implementation.
3
+
4
+ Default implementation that does nothing.
5
+ Used when tracing is disabled or no trace sink is configured.
6
+ """
7
+
8
+ from typing import Optional
9
+ from uuid import UUID
10
+
11
+ from django_agent_runtime.runtime.interfaces import TraceSink
12
+
13
+
14
+ class NoopTraceSink(TraceSink):
15
+ """
16
+ No-op trace sink that discards all traces.
17
+
18
+ This is the default when tracing is not configured.
19
+ """
20
+
21
+ def start_run(self, run_id: UUID, metadata: dict) -> None:
22
+ """No-op: discard trace start."""
23
+ pass
24
+
25
+ def log_event(self, run_id: UUID, event_type: str, payload: dict) -> None:
26
+ """No-op: discard event."""
27
+ pass
28
+
29
+ def end_run(self, run_id: UUID, outcome: str, metadata: Optional[dict] = None) -> None:
30
+ """No-op: discard trace end."""
31
+ pass
32
+
33
+ def flush(self) -> None:
34
+ """No-op: nothing to flush."""
35
+ pass
36
+
@@ -0,0 +1,39 @@
1
+ """
2
+ URL configuration for django_agent_runtime.
3
+
4
+ Include these URLs in your project's urls.py:
5
+
6
+ from django.urls import path, include
7
+
8
+ urlpatterns = [
9
+ path("agent/", include("django_agent_runtime.urls", namespace="agent_runtime")),
10
+ ]
11
+
12
+ Note: The viewsets provided are base classes. For production use, you should
13
+ create your own viewsets that inherit from these and set appropriate
14
+ authentication_classes and permission_classes.
15
+ """
16
+
17
+ from django.urls import path, include
18
+ from rest_framework.routers import DefaultRouter
19
+
20
+ from django_agent_runtime.api.views import (
21
+ BaseAgentConversationViewSet,
22
+ BaseAgentRunViewSet,
23
+ sync_event_stream,
24
+ )
25
+
26
+ app_name = "django_agent_runtime"
27
+
28
+ # Create router for viewsets
29
+ router = DefaultRouter()
30
+ router.register(r"conversations", BaseAgentConversationViewSet, basename="conversation")
31
+ router.register(r"runs", BaseAgentRunViewSet, basename="run")
32
+
33
+ urlpatterns = [
34
+ # ViewSet routes
35
+ path("", include(router.urls)),
36
+ # SSE streaming endpoint
37
+ path("runs/<str:run_id>/events/", sync_event_stream, name="run_events"),
38
+ ]
39
+