smarta2a 0.2.3__tar.gz → 0.2.4__tar.gz

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 (52) hide show
  1. {smarta2a-0.2.3 → smarta2a-0.2.4}/.gitignore +4 -1
  2. {smarta2a-0.2.3 → smarta2a-0.2.4}/PKG-INFO +1 -1
  3. smarta2a-0.2.4/documentation/smarta2a_docs/docs/blog/announcements.md +3 -0
  4. smarta2a-0.2.4/documentation/smarta2a_docs/docs/getting-started/index.md +3 -0
  5. smarta2a-0.2.4/documentation/smarta2a_docs/docs/getting-started/installation.md +3 -0
  6. smarta2a-0.2.4/documentation/smarta2a_docs/docs/getting-started/quickstart.md +3 -0
  7. smarta2a-0.2.4/documentation/smarta2a_docs/docs/index.md +3 -0
  8. smarta2a-0.2.4/documentation/smarta2a_docs/docs/tutorials/example1.md +3 -0
  9. smarta2a-0.2.4/documentation/smarta2a_docs/docs/tutorials/example2.md +3 -0
  10. smarta2a-0.2.4/documentation/smarta2a_docs/mkdocs.yml +21 -0
  11. smarta2a-0.2.4/examples/__init__.py +3 -0
  12. smarta2a-0.2.4/examples/agents/__init__.py +3 -0
  13. {smarta2a-0.2.3 → smarta2a-0.2.4}/pyproject.toml +1 -1
  14. smarta2a-0.2.4/smarta2a/examples/__init__.py +0 -0
  15. smarta2a-0.2.4/smarta2a/examples/echo_server/__init__.py +0 -0
  16. smarta2a-0.2.4/smarta2a/examples/echo_server/curl.txt +1 -0
  17. smarta2a-0.2.4/smarta2a/examples/echo_server/main.py +37 -0
  18. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/server.py +11 -6
  19. {smarta2a-0.2.3 → smarta2a-0.2.4}/LICENSE +0 -0
  20. {smarta2a-0.2.3 → smarta2a-0.2.4}/README.md +0 -0
  21. {smarta2a-0.2.3 → smarta2a-0.2.4}/requirements.txt +0 -0
  22. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/__init__.py +0 -0
  23. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/agent/a2a_agent.py +0 -0
  24. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/agent/a2a_mcp_server.py +0 -0
  25. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/archive/mcp_client.py +0 -0
  26. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/client/__init__.py +0 -0
  27. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/client/a2a_client.py +0 -0
  28. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/client/smart_mcp_client.py +0 -0
  29. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/client/tools_manager.py +0 -0
  30. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/history_update_strategies/__init__.py +0 -0
  31. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/history_update_strategies/append_strategy.py +0 -0
  32. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/history_update_strategies/history_update_strategy.py +0 -0
  33. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/model_providers/__init__.py +0 -0
  34. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/model_providers/base_llm_provider.py +0 -0
  35. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/model_providers/openai_provider.py +0 -0
  36. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/__init__.py +0 -0
  37. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/handler_registry.py +0 -0
  38. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/state_manager.py +0 -0
  39. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/subscription_service.py +0 -0
  40. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/server/task_service.py +0 -0
  41. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/state_stores/__init__.py +0 -0
  42. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/state_stores/base_state_store.py +0 -0
  43. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/state_stores/inmemory_state_store.py +0 -0
  44. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/utils/__init__.py +0 -0
  45. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/utils/prompt_helpers.py +0 -0
  46. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/utils/task_builder.py +0 -0
  47. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/utils/task_request_builder.py +0 -0
  48. {smarta2a-0.2.3 → smarta2a-0.2.4}/smarta2a/utils/types.py +0 -0
  49. {smarta2a-0.2.3 → smarta2a-0.2.4}/tests/__init__.py +0 -0
  50. {smarta2a-0.2.3 → smarta2a-0.2.4}/tests/test_server.py +0 -0
  51. {smarta2a-0.2.3 → smarta2a-0.2.4}/tests/test_server_history.py +0 -0
  52. {smarta2a-0.2.3 → smarta2a-0.2.4}/tests/test_task_request_builder.py +0 -0
@@ -102,4 +102,7 @@ venv.bak/
102
102
  .idea/
103
103
  .vscode/
104
104
  *.swp
105
- *.swo
105
+ *.swo
106
+
107
+ # Apple
108
+ .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smarta2a
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: A simple Python framework (built on top of FastAPI) for creating Agents following Google's Agent2Agent protocol
5
5
  Project-URL: Homepage, https://github.com/siddharthsma/smarta2a
6
6
  Project-URL: Bug Tracker, https://github.com/siddharthsma/smarta2a/issues
@@ -0,0 +1,3 @@
1
+ # Announcements
2
+
3
+ News and major updates.
@@ -0,0 +1,3 @@
1
+ # Getting Started
2
+
3
+ Overview of how to begin using MyProject.
@@ -0,0 +1,3 @@
1
+ # Installation
2
+
3
+ Instructions to install MyProject.
@@ -0,0 +1,3 @@
1
+ # Quickstart
2
+
3
+ Minimal example to get started quickly.
@@ -0,0 +1,3 @@
1
+ # SmartA2A
2
+
3
+ Welcome to the documentation for SmartA2A!
@@ -0,0 +1,3 @@
1
+ # Example 1
2
+
3
+ Step-by-step example tutorial.
@@ -0,0 +1,3 @@
1
+ # Example 2
2
+
3
+ Another tutorial with practical usage.
@@ -0,0 +1,21 @@
1
+ site_name: SmartA2A
2
+ theme:
3
+ name: material
4
+ features:
5
+ - navigation.tabs # Enables top nav tabs
6
+ - navigation.sections
7
+ - toc.integrate # Integrates the TOC into the sidebar (optional)
8
+
9
+ nav:
10
+ - Home: index.md
11
+ - Getting Started:
12
+ - Introduction: getting-started/index.md
13
+ - Installation: getting-started/installation.md
14
+ - Quickstart: getting-started/quickstart.md
15
+ - Tutorials:
16
+ - Tutorials: tutorials/echo_server.md
17
+ - Blog:
18
+ - Announcements: blog/announcements.md
19
+ - Changelog: blog/changelog.md
20
+ - Community: community.md
21
+
@@ -0,0 +1,3 @@
1
+ """
2
+ Example implementations using the SmartA2A framework.
3
+ """
@@ -0,0 +1,3 @@
1
+ """
2
+ Example agent implementations.
3
+ """
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "smarta2a"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  authors = [
9
9
  { name = "Siddharth Ambegaonkar", email = "siddharthsma@gmail.com" },
10
10
  ]
File without changes
@@ -0,0 +1 @@
1
+ curl -X POST -H "Content-Type: application/json" -d '{ "jsonrpc": "2.0", "id": 1, "method": “tasks/send”, "params": {"id": "test-task-1","message": {"role": "user","parts": [{"type": "text", "text": "Test message"}]}} }' http://localhost:8000/
@@ -0,0 +1,37 @@
1
+ from smarta2a.server import SmartA2A
2
+ from smarta2a.utils.types import A2AResponse, TaskStatus, TaskState, TextPart, FileContent, FilePart
3
+
4
+ app = SmartA2A("EchoServer")
5
+
6
+ @app.on_send_task()
7
+ def handle_task(request):
8
+ """Echo the input text back as a completed task"""
9
+ input_text = request.content[0].text
10
+ #return f"Response to task: {input_text}"
11
+ return A2AResponse(
12
+ content=[TextPart(type="text", text="Response to task: " + input_text), FilePart(type="file", file=FileContent(name="test.txt", bytes="test"))],
13
+ status="working"
14
+ )
15
+
16
+ @app.on_send_subscribe_task()
17
+ async def handle_subscribe_task(request):
18
+ """Subscribe to the task"""
19
+ input_text = request.content[0].text
20
+ yield f"First response to the task: {input_text}"
21
+ yield f"Second response to the task: {input_text}"
22
+ yield f"Third response to the task: {input_text}"
23
+
24
+ @app.task_get()
25
+ def handle_get_task(request):
26
+ """Get the task"""
27
+ return f"Task: {request.id}"
28
+
29
+ @app.task_cancel()
30
+ def handle_cancel_task(request):
31
+ """Cancel the task"""
32
+ return f"Task cancelled: {request.id}"
33
+
34
+
35
+
36
+
37
+
@@ -79,8 +79,11 @@ class SmartA2A:
79
79
  "reload": False
80
80
  }
81
81
  self.task_builder = TaskBuilder(default_status=TaskState.COMPLETED)
82
+
83
+ # Add this method to delegate ASGI calls
84
+ async def __call__(self, scope, receive, send):
85
+ return await self.app(scope, receive, send)
82
86
 
83
-
84
87
  def on_send_task(self):
85
88
  def decorator(func: Callable[[SendTaskRequest, Optional[StateData]], Any]) -> Callable:
86
89
  self.registry.register("tasks/send", func)
@@ -447,7 +450,7 @@ class SmartA2A:
447
450
  task = self.task_builder.build(
448
451
  content=raw_result,
449
452
  task_id=request.params.id,
450
- metadata=request.params.metadata or {}
453
+ metadata=getattr(raw_result, "metadata", {}) or {}
451
454
  )
452
455
 
453
456
  return self._finalize_task_response(request, task)
@@ -491,24 +494,26 @@ class SmartA2A:
491
494
  try:
492
495
  raw_result = handler(request)
493
496
 
497
+ cancel_task_builder = TaskBuilder(default_status=TaskState.CANCELED)
494
498
  # Handle direct CancelTaskResponse returns
495
499
  if isinstance(raw_result, CancelTaskResponse):
496
500
  return self._validate_response_id(raw_result, request)
497
501
 
498
502
  # Handle A2AStatus returns
499
503
  if isinstance(raw_result, A2AStatus):
500
- task = self.task_builder.normalize_from_status(
504
+ task = cancel_task_builder.normalize_from_status(
501
505
  status=raw_result.status,
502
506
  task_id=request.params.id,
503
- metadata=raw_result.metadata or {}
507
+ metadata=getattr(raw_result, "metadata", {}) or {}
504
508
  )
505
509
  else:
506
510
  # Existing processing for other return types
507
- task = self.task_builder.build(
511
+ task = cancel_task_builder.build(
508
512
  content=raw_result,
509
513
  task_id=request.params.id,
510
- metadata=raw_result.metadata or {}
514
+ metadata=getattr(raw_result, "metadata", {}) or {}
511
515
  )
516
+ print(task)
512
517
 
513
518
  # Final validation and packaging
514
519
  return self._finalize_cancel_response(request, task)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes